allan.conda
12/16/2020, 8:48 AMLuis Daivid
12/16/2020, 9:09 AMLuis Daivid
12/16/2020, 9:09 AMallan.conda
12/16/2020, 9:11 AMLuis Daivid
12/16/2020, 9:13 AMrobnik
12/16/2020, 11:51 AMModifier.clip(myShape)
where myShape
is a GenericShape { ... }
. In my preview I have a Slider that changes the width of the clip shape from 0 to 100%.Luis Daivid
12/16/2020, 11:55 AMLuis Daivid
12/16/2020, 11:55 AMrobnik
12/16/2020, 12:04 PMval myClip = GenericShape { size ->
val right = size.width * fraction
lineTo(right, 0f)
lineTo(right, size.height)
lineTo(0f, size.height)
close()
}
And fraction is a float from state, getting moved by a slider.Luis Daivid
12/16/2020, 12:04 PMNader Jawad
12/16/2020, 6:33 PMGenericShape
will work here as a parameter to the clip modifier, however, because this is a rectangle, using RectangleShape
to provide the clipping bounds will be more efficient as it would avoid software rasterization of pathsrobnik
12/16/2020, 8:58 PMRectangleShape
I see is a val
. How do I use it? How do I give it a narrower width so that it actually clips the thing I'm trying to clip/crop?Nader Jawad
12/16/2020, 8:58 PMRectangleShape
Nader Jawad
12/16/2020, 8:59 PMrobnik
12/16/2020, 9:03 PMShape
and return an Outline
that is a Rectangle
instead of a Generic
, and get that performance benefit. Thanks!Luis Daivid
12/17/2020, 12:48 PMallan.conda
12/17/2020, 2:16 PM