Is it possible to "erase" from a Layer?

Hi all,

I was wondering if there is some way to “erase” parts of a layer. For example in the following image:

It is currently being generated by creating rectangles centered at certain locations, and lines going from their left and right sides to the respective edges on the screen. However, I would like for the lines not to cross through the boxes, so I was hoping there may be some way to “erase” certain segments of the layer. It is important that I am not simply overlaying another black box, since I am planning to have more layers underneath.

Any help would be appreciated!

Thanks

I guess there is not something like this, beside what you though of using masks (or black colored rectangles). I would prefer to do it with Paths (create Lines with MoveTo combined with LineTo and then AddRect on a certain position (probably where one of the two lines end/starts). So yes I would suggest to take a look on SKPaths (Skia>Paths).

1 Like

you can achieve this using the correct drawing order. first, draw all lines, then the rectangle outline, and then the reactangle fill. you can also swap the fill and outline order, depending on the effect you want.

I guess there is not something like this, beside what you though of using masks (or black colored rectangles). I would prefer to do it with Paths (create Lines with MoveTo combined with LineTo and then AddRect on a certain position (probably where one of the two lines end/starts). So yes I would suggest to take a look on SKPaths (Skia>Paths).

Ah, I don’t know why I wasn’t think about Masks. What seems to have worked is creating two layers: one of filled squares and one just with strokes. I use the filled squares as a mask to select the layers underneath, and then render them again on top, so as to create the effect of transparency while blocking out the intersecting lines. Thanks!

you can achieve this using the correct drawing order. first, draw all lines, then the rectangle outline, and then the reactangle fill. you can also swap the fill and outline order, depending on the effect you want.

I think this would work, but I was hoping that the center would be “transparent” to reveal the layers below.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.