On 24.11.2013 13:02, Riccardo Canalicchio wrote:
> hi there,
> i'm unable to draw a gradient clipped by a bezierpath.
> I'm trying to fill a roundeded rectangle path with a gradient
> here you can see the code that i'm using to draw:
> https://github.com/nongio/gs-testDrawing
> 
> I don't know if it is a cairo backend problem or a NSGradient bug...
> I managed to get it works changing drawInBezierPath method of NSGradients:
> 
> [currentContext saveGraphicsState];
> [path addClip];
> [self drawInRect: [path bounds] angle: angle];
> [currentContext restoreGraphicsState];
> 
> I have changed drawInRect with drawFromPoint:toPoint

Thank you very much for reporting this problem. I used your example
application and was able to reproduce the issue. When I remove the
saveGraphicsState/restoreGraphicsState calls from drawInRect:angle: it
works as expected.
Looking at the cairo backend code again the memory comes back. We are
only able to transfer the clip if it is representable by a set of
rectangles. Which of course is not the case for your rounded corners.
This is a limitation of the cairo backend that we have to live with.

Looks like I need to find a simple solution for the NSGradient code.
It will be easy to move the rest of the code into a new helper method
and use it from both places.

Fred


_______________________________________________
Discuss-gnustep mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/discuss-gnustep

Reply via email to