Open Ahmed-gamal-elmahdy opened 1 year ago
Hi! Thanks for the report. Will investigate soon
This seems to occur when the AABB of the convex hull of the samples of the custom path does not equal the cropping rectangle. There are two solutions here:
I'll try option 2 and post my findings here.
Unfortunately, after a long day of trying to fix this behavior, I came to the conclusion that it would probably require me to rewrite the FitPolygonInQuad solver completely. This solver assumes that the polygon passed has an AABB that is equal to the crop rect AABB, and if it's not, then it will return a smaller AABB, which is what I observed when playing around with invalid crop shapes. Therefore, I would suggest tweaking the crop shape so that it always fits in the crop rect.
I'll add this in the documentation and enable asserts so that this can't happen.
when using a shape with negative values in cubic, it breaks the crop this is the path used
CropShape myCustomShapFn(vg.PathBuilder builder, Size size) { final path = builder .moveTo(size.width*0.4967222,size.height*0.5193478) .cubicTo(size.width*0.6900278,size.height*0.5193478,size.width*0.9666944,size.height*-0.1071594,size.width*0.9666944,size.height*0.0549420) .cubicTo(size.width*0.9666944,size.height*0.1450290,size.width*0.8323889,size.height*0.9920290,size.width*0.4940556,size.height*0.9920290) .cubicTo(size.width*0.3007500,size.height*0.9920290,size.width*0.0214722,size.height*0.1888551,size.width*0.0214722,size.height*0.0312174) .cubicTo(size.width*0.0214722,size.height*-0.0588406,size.width*0.1584444,size.height*0.5193478,size.width*0.4967222,size.height*0.5193478) .close() .toPath(); return CropShape.custom(path); }
this is the shape as drawn by painter