Short answer: no that's not possible. Only rectangles.
Long answer: most probably that's not possible at all with clipping. This stuff probably could be achieved with masking (intersection of on Shape cut off from another Sprite, or something like that), but that's not yet supported
Even longer answer: - setClip() tells the graphic card to discard pixels outside a rectangular window. This is fast, i.e, no additional processing required. - setMask() (not yet implemented but in my TODO list) would require extra computations: first the masking shape would be rendered into a specific buffer called stencil, then actual rendering would check the stencil buffer to selectively discard masked pixels.
something like do not draw the area where the alpha of the mask image is below the setting threshold. Shader is an advanced topic for most of us, maybe a simple setMask api will be better. )
Also, if there is a shader example for doing that will be a bonus.
Yes, this approach will only work on texture, but if not enough then render target can help. No as efficient as the setMask() approach I intend to code some day, however.
Comments
Long answer: most probably that's not possible at all with clipping. This stuff probably could be achieved with masking (intersection of on Shape cut off from another Sprite, or something like that), but that's not yet supported
- setClip() tells the graphic card to discard pixels outside a rectangular window. This is fast, i.e, no additional processing required.
- setMask() (not yet implemented but in my TODO list) would require extra computations: first the masking shape would be rendered into a specific buffer called stencil, then actual rendering would check the stencil buffer to selectively discard masked pixels.
Shader is an advanced topic for most of us, maybe a simple setMask api will be better. )
Also, if there is a shader example for doing that will be a bonus.
See example attached (replace texture with one your files, 512x512)
I like the idea of setMask, but no need to hurry when I asked I was hoping that there already was something similar in the new features from openGL 2.
Shaders look really interesting, I need to study a bit more because I still can't understand a lot of things in there
Likes: pie
http://www.indiedb.com/tutorials/clipping-in-gideros-with-rendertarget
Likes: pie
Fragmenter - animated loop machine and IKONOMIKON - the memory game