graphics refactor, again #88
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
some ideas from #85 and more
Added:
CmapFeaturewhich basically wrapsColorFeatureand just provides a__setitem__that parses a user providedstrcmap to a[n_points, rgba]array usingn_colorsbased on the sliceImageCmapFeatureImageDataFeaturewhich handlesImageGraphicdata as aspygfx.TexturePointsDataFeaturewhich handles data forLineGraphicandScatterGraphicBaseGraphicwhich just parses the class name in__init_subclass__and adds a stringtypeclass attribute which is used bySubplotto add the variousadd_<graphic_name>methods.Graphichas apositionproperty which is basically justworld_object.positionModified:
Graphicdoesn't instantiate any of the graphic features now, it just handles name and a few other thing and some methods. The individual graphics now handle their features like data, colors, cmap, etc.ImageGraphicuses vmin, vmax now instead of clim, updateImageWidgetaccordingly.ImageGraphicusesTextureViewto setgeometry.gridinstead ofTexture, this allows setting thefilterargument toTexture.get_view(filter=...), default is "nearest"ImageGraphiccmap setting is now functional, it uses aImageCmapFeatureinstance to manage it.Subplot.add_graphicsets thez_positionbased on the number of Graphics in the subplotutils.fix_dataandutils.to_float32, these are now in the data features classes or module