Expand the painting/child area of a component

Why not turn this into a feature request? I think a setPaintBounds() or expandPaintBounds() function would be very useful and probably not hard to implement.

3 Likes

Agree, In the GMPI Drawing API each object has both a layout rectangle and a clipping rectangle.
They both default to the same rectangle, but when for example you want to draw a thick border (where some pixels end up outside the layout rect, it is easy to express that without hacks and having to redo the entire layout of the UI.

// bounds for the purpose of layout. May not include all drawn pixels.
virtual GmpiDrawing::Rect getLayoutRect() override { return bounds_; }

// bounds for the purpose of invalidating every single drawn pixel, Including those outside layout boundary.
virtual GmpiDrawing::Rect GetClipRect() override { return bounds_; }
4 Likes

I am not sure if it would be easy to implement free clipping, since it depends on the component hierarchy. From what I have seen it is possible if the clipping is inside the parent component, since the paint function is called from it. The only issue I have found is that if the paint needs to be updated the entire parent component must be called to repaint. So it is more suitable for static drawings.

Another way that I don’t know if it would be possible is to be able to expand the boundaries at any time during the drawing, similar to when reducing with g.reduceClipRegion.