Describe your idea (If you have more than one idea, please open the rest in other issues)
In the current overlay system, 2D objects are always rendered in their entirety. This makes certain outcomes difficult (text clipping) or impossible (half/quarter circle). An optional, per-object, rectangular mask would solve many of these issues.
The user surface could be accomplished with a few new 2D object APIs:
- Properties:
maskMinX, maskMinY, maskMaxX, maskMaxY
- Set mask:
setMask(minX, minY, maxX, maxY). There may be utility in a shortened signature of setMask(maxX, maxY) for common overflow use cases.
- Clear mask:
clearMask(). Mask defaults would be the bounding box of the object.
The coordinate system for XY here may need further discussion. There are advantages and disadvantages to using screen coordinates vs relative coordinates.
Simple text clip example:
sg.createText{
x = 50,
y = 50,
content = "This is some really long text",
maskMaxX = 75 -- stop rendering text object pixels after x = 75
}
Describe alternatives you've considered if any
No response
Additional context
No response
Linked Issues
No response
Describe your idea (If you have more than one idea, please open the rest in other issues)
In the current overlay system, 2D objects are always rendered in their entirety. This makes certain outcomes difficult (text clipping) or impossible (half/quarter circle). An optional, per-object, rectangular mask would solve many of these issues.
The user surface could be accomplished with a few new 2D object APIs:
maskMinX,maskMinY,maskMaxX,maskMaxYsetMask(minX, minY, maxX, maxY). There may be utility in a shortened signature ofsetMask(maxX, maxY)for common overflow use cases.clearMask(). Mask defaults would be the bounding box of the object.The coordinate system for XY here may need further discussion. There are advantages and disadvantages to using screen coordinates vs relative coordinates.
Simple text clip example:
Describe alternatives you've considered if any
No response
Additional context
No response
Linked Issues
No response