BlendMode for graphics

15 views
Skip to first unread message

Thomas

unread,
May 8, 2018, 12:14:17 AM5/8/18
to CodenameOne Discussions
I am currently implementing some custom components and, in some cases, I would like to be able to draw a shape over another one in the Graphic object using another Blend mode that the default one (that seems to be the ADD BlendMode). For example, I would like to draw a transparent shape in front of another to make that part of my component transparent. For this I need to apply an ERASE blendMode, else the shape already painted behind would be visible. Currently CN1 graphics api do not seems to support any other blendMode that the default one. Do you think it is something that could be added to the api in the future (most of the target platforms, if not all, should be able to easily support it I guess. At least on desktop and on mobiles with OpenGL it would be the case)?
It would allow the development of more complex components

Shai Almog

unread,
May 8, 2018, 12:24:33 AM5/8/18
to CodenameOne Discussions
This is a bit challenging. There is an issue on this here: https://github.com/codenameone/CodenameOne/issues/2170
It's slated for this release but I can't guarantee it won't get bumped.

Thomas

unread,
May 8, 2018, 12:30:10 AM5/8/18
to CodenameOne Discussions
what graphics library are you using to render graphics on iOS and android? Is it OpenGL? if yes it should be quite easy to implement a setBlendMode() function to the graphics (the same way you have setTransform())  for those case. Same for desktop platforms if you also use OpenGL or directX 

Shai Almog

unread,
May 8, 2018, 3:02:53 AM5/8/18
to CodenameOne Discussions
It's complicated. We use Open GL for some but mutable images for other stuff.
Reply all
Reply to author
Forward
0 new messages