Details
-
Technical task
-
Resolution: Duplicate
-
P3: Somewhat important
-
None
-
None
Description
Support for masks added in https://codereview.qt-project.org/c/qt/qtdeclarative/+/550157/ does not include the optional "objectBoundingBox" coordinate system.
The way this work, coordinates in the mask item are relative and should be scaled to the coordinate system of the masked item. So a rectangle of [(0.25, 0.25) 0.5x0.5] would have its top left corner at 1/4th of the masked item's height/width respectively, and its width/height would be one half of the masked item's width/height.
There is some additional plumbing needed to make this work:
First of all, in Qt Svg: Instead of passing the maskId string in the SVG node, we should include a pointer to the node itself. We do this for use nodes at the moment, so it's hopefully possible to do it for masks as well. This is because the mask may be declared after it is used, so otherwise we have to do a pre-pass to collect all the mask nodes and match them to names.
Then, when generating the mask node itself, we need to just skip it for now. Instead, every time the mask is used, we instantiate it there instead. We currently have a ShaderEffectSource which samples the global mask item, but in the case of object bounding box mode, we could perhaps create the mask as a child tree of this. We could create a parent item for it which applies the scale to the masked item's coordinate system.
Note: It's possible there will be some issues with inherited transforms. Maybe the ShaderEffectSources should be created as children of the root item?
Attachments
Issue Links
- relates to
-
QTBUG-121537 Implement support for "mask" in SVG generators
- Open