Problem with paths and images
Problem with paths and images
- Subject: Problem with paths and images
- From: Livio Isaia <email@hidden>
- Date: Tue, 19 Dec 2006 16:59:26 +0100
The problem is that I draw (NSBezierPath stroke method) a black rect
path in an image with locked focus, and then I draw the image in a rect
bigger than the image's size. I'd expect a big black rect drawn, but get
a very different result (see figure please): the color seems gray, not
black, it seems transparent and shouldn't be, it's two times thicker,
has dark little rects at the vertexes etc..
The code is:
... after created the image and the path...
... and supposing the image bounds are (0, 0, 32 32) and the view
bounds (0, 0, 256, 256)...
[path appendBezierPathWithRect:NSMakeRect(6, 6, 20, 20)];//for
example...
[image lockFocus];
[image clearImage];
[pathColor set];
[path stroke];
[image unlockFocus];
then in a view's draw method:
[image drawInRect:[self bounds] fromRect:[image sourceRect]
operation:NSCompositeSourceOver fraction:1.0];
([image sourceRect] simply returns the image bounds; [image clearImage]
simply fills with clearColor the image bounds)
Can anyone tell me something about (why the black rect is not merely a
rect)?
Sorry if I'm tedious with too much code...
Many thanks to all of you,
livio.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden