mcfly Posted April 23, 2020 Share Posted April 23, 2020 Hi all. As you see my question is related to masking. Have you ever used PIXI.Container with a PIXI.Graphics child to mask PIXI.DisplayObject? I.e. Pixi.DisplayObject.mask = PIXI.Container I've noticed this approach in a project I'm inheriting. I've tested it and works as expected. However this is a bit strange technique for me as I've never seen this before. Do you foresee any issues with that (i.e. any browser related issues etc.)? Thank you for your time. Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted April 23, 2020 Share Posted April 23, 2020 Yeah, that's only for graphics masks, implemented through stencil. It just renders all elements inside mask container to stencil. Sprite masks (alpha-masks) cant work like that, it will require extra framebuffer operations. After recent mask refactoring its possible to implement it but we just dont have time Quote Link to comment Share on other sites More sharing options...
mcfly Posted April 23, 2020 Author Share Posted April 23, 2020 Hi Ivan, thank you for your reply. In my case I have only graphics in my container that is used as a mask. But am I correct by assuming that approach is not supported by PIXI.CanvasRenderer or I'm missing something? Thank you again. Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted April 23, 2020 Share Posted April 23, 2020 (edited) I have a special magic way to determine that: I look in sources. https://github.com/pixijs/pixi.js/blob/c513e9287112ff8ed3f0326f700b731c204550b9/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.ts#L48 Here's recursive container walker, so it should support such mask. Edited April 23, 2020 by ivan.popelyshev Quote Link to comment Share on other sites More sharing options...
mcfly Posted April 23, 2020 Author Share Posted April 23, 2020 Thank you again, I'll take into account your special magic way ? ivan.popelyshev 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.