Skip to content

better buffer handling#150

Merged
kushalkolar merged 1 commit intomasterfrom
better-buffer-handling
Mar 9, 2023
Merged

better buffer handling#150
kushalkolar merged 1 commit intomasterfrom
better-buffer-handling

Conversation

@kushalkolar
Copy link
Copy Markdown
Member

@kushalkolar kushalkolar commented Mar 9, 2023

partially addresses #147

  • all feature buffers are now public
  • ImageGraphic and HeatmapGraphic allow setting the input array buffer directly as the texture data buffer if isolated_buffer=False. The default is True, so by default the texture data buffer is a new array that is initialized using the shape and type of the input array, and then the isolated texture data buffer is set using the input data array values.

allows this type of behavior:
image

# initialize a buffer with the same shape as the input data
# we do not directly use the input data array as the buffer
# because if the input array is a read-only type, such as
# numpy memmaps, we would not be able to change the image data
Copy link
Copy Markdown
Member

@clewis7 clewis7 Mar 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so, the point of having the option for using an isolated buffer is to be able to change data in the event that the type of the data is read only? will this occur when using improv?

vmin, vmax = quick_min_max(data)

texture_view = pygfx.Texture(self.data(), dim=2).get_view(filter=filter)
texture_view = pygfx.Texture(buffer_init, dim=2).get_view(filter=filter)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

before, Texture and Geometry were all under the hood correct?

@kushalkolar kushalkolar deleted the better-buffer-handling branch May 23, 2023 04:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants