alexpana / wxWidgets

Read-only mirror of the wxWidgets SVN repo (automatically updated). Report issues here: http://trac.wxwidgets.org/
http://www.wxwidgets.org/
3 stars 0 forks source link

Hatch brushes #14

Closed alexpana closed 10 years ago

alexpana commented 10 years ago

Direct2D doesn't have support for hatch brushes. Two solutions would be:

csomor commented 10 years ago

in CoreGraphics I had the concept of patterns which I'm using in graphics.cpp, if no such thing is available I guess bitmaps are the next stop ...

alexpana commented 10 years ago

I think they might be easily accomplished via a custom implementation of an IWICBitmapSource [1]

[1] http://msdn.microsoft.com/en-us/library/windows/desktop/ee690171%28v=vs.85%29.aspx

alexpana commented 10 years ago

I have implemented hatch brushes using a custom implementation of the IWICBitmapSource COM interface.

Unfortunately, the _NEARESTNEIGHBOR sampling mode sometimes gives rise to artifacts as seen in the cyan / vertical hatch. I've seem this artifact in cross hatches, but not as often as with vertical ones. As you can see, the artifact is also visible with bitmap brushes. Using LINEAR sampling is not a viable option (the lines get too thick, they lose their original color, etc). There is no other sampling mode available.

Please click on the image to see it at full resolution.

hatches

csomor commented 10 years ago

I think this is definitly good enough for the moment, leave this as a 'may be improved' but this level of feature completeness is definitely enough for me

alexpana commented 10 years ago

Thanks. This is implemented in 7b558619c294fe2466dd3f2a7d13a924bea0a4fe