Re: Problem with paths and images
Re: Problem with paths and images
- Subject: Re: Problem with paths and images
- From: Ryan Britton <email@hidden>
- Date: Tue, 19 Dec 2006 09:14:26 -0800
This has to do with how pixel coordinates are interpreted by OS X.
See here: http://www.cocoadev.com/index.pl?NSBezierPath
On Dec 19, 2006, at 7:59 AM, Livio Isaia wrote:
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.
<Bigger black rect.tiff>
_______________________________________________
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
_______________________________________________
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