I'm painting two layers of graphs on one CustomPaint
. The first will occlude over half of the second layer.
Problem
Currently I just paint the first data and then second data using two Paint
s, with their blendMode
set.
This creates an overlay of two data, which blends. But I don't need the blend, just the area of difference to be painted using the second Paint
, i.e., a complementary composite view.
On the performance side, I don't know if blending would have internal optimization to avoid drawing the occluded part.
Reference image
Notice that all these data graphs blend but I just need them to occlude each other, while the overlapped parts don't draw at all for performance.
Attempts
I could use a new path to only draw the difference, but I'm not sure this is the easiest way.
I checked RepaintBoundary
but it's a widget that handles infrequent data changes, not exactly what I need here.
Similarly Overlay
seems a standalone widget, so I don't know how to fit it into CustomPaint
.
Question
Is there a standard way to achieve the occlusion I need?