Closed alexpana closed 10 years ago
It looks like this could be achieved by using a layer with geometric mask?
It could, but the wxRegion allows the use of bitmap masks [1], making the region effectively raster.
[1] http://docs.wxwidgets.org/trunk/classwx_region.html#a9b8729b4d3acf9e77188f92ebdfaf168
Hi
Direct2D allows for clipping based on axis aligned rectangles [1] and geometries [2]. However, the wxRegion object allows the use of bitmaps.
[1] http://msdn.microsoft.com/en-us/library/windows/desktop/dd756673%28v=vs.85%29.aspx [2] http://msdn.microsoft.com/en-us/library/windows/desktop/dd756675%28v=vs.85%29.aspx
look at src/osx/carbon/region.cpp there I call a borrowed scanline algorithm to retrieve the geometry, so IMHO just support geometries, don't worry about natively supporting bitmap regions
Best,
Stefan
look at src/osx/carbon/region.cpp there I call a borrowed scanline algorithm to retrieve the geometry, so IMHO just support geometries, don't worry about natively supporting bitmap regions
I was thinking about implementing a similar algorithm, but wasn't sure if it was worth the time. Thanks for this.
just as a reference: for arriving at the geometry from a wxRegion the other useful class is the wxRegionIterator, it iterates through all the wxRects from which the region is made up
I just took a closer look at the rgncmn.cpp source file. I found out regions are only composed out of rectangles and the DoRegionUnion(...) handles the decomposition of the bitmap into rectangles. Does this mean using the wxRegionIterator will cover areas clipped by the bitmaps?
yes, however the wxRegion was created - whether it was by a native HRN or some wxBitmap, the region iterator gives you one rect after the other.
This is implemented in f65c8c55ba1b5c3452eea55f7c923c5f84c55926
Direct2D allows for clipping based on axis aligned rectangles [1] and geometries [2]. However, the wxRegion object allows the use of bitmaps.
[1] http://msdn.microsoft.com/en-us/library/windows/desktop/dd756673%28v=vs.85%29.aspx [2] http://msdn.microsoft.com/en-us/library/windows/desktop/dd756675%28v=vs.85%29.aspx