Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply ColorTransform directly when rendering text and shapes #1246

Closed
wants to merge 7 commits into from

Conversation

vizanto
Copy link
Contributor

@vizanto vizanto commented Aug 18, 2016

This patch refactors and de-duplicates code in the Cairo and Canvas rendering classes and implements the application of color transforms to TextFields and (Shape) Graphics.

Luckily worldColorTransform was already implemented so it turned out to be fairly straightforward :-)

It introduces 2 new macros to ColorTransform that help calculate the RGBA values without temporary allocations. If and when Haxe supports multiple inline return values, these could be rewritten. Hopefully you'll find these readable enough... :)

Drawing Bitmaps with ColorTransform is untested and not implemented by this patch.

@vizanto
Copy link
Contributor Author

vizanto commented Aug 22, 2016

Added some ColorTransforms to my little test program here

Before this patch, the ColorTransforms change nothing on targets other than Flash:

HTML5:
HTML5

Flash:
Flash

vizanto added a commit to vizanto/openfl-linestyle-bug that referenced this pull request Aug 22, 2016
@vizanto
Copy link
Contributor Author

vizanto commented Aug 22, 2016

I just discovered that changing the colorTransform after rendering doesn't invalidate the Graphics and the display is not updated. Working on that now...

Edit: fixed

@vizanto vizanto mentioned this pull request Aug 22, 2016
@vizanto vizanto force-pushed the develop branch 2 times, most recently from 7cf7ee4 to d3afc19 Compare August 23, 2016 09:21
This patch refactors and de-duplicates code in the
 Cairo and Canvas rendering classes and implements
 the application of color transforms to TextFields
 and (Shape) Graphics.

It introduces 2 new macros to ColorTransform that
 help calculate the RGBA values without temporary
 allocations. If and when Haxe supports multiple
 inline return values, these could be rewritten.

Drawing Bitmaps with ColorTransform is untested
 and not implemented by this patch.
@vizanto
Copy link
Contributor Author

vizanto commented Aug 23, 2016

Discovered a copy-pasta error in CanvasGraphics.render. Rebased the proper commit.
(had a call to endFill where should have been endStroke)

@vizanto
Copy link
Contributor Author

vizanto commented Aug 24, 2016

Reopened as #1251 because I keep pushing to this branch :/
Sorry.

@vizanto vizanto closed this Aug 24, 2016
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