Re: Problem with paths and images
Re: Problem with paths and images
- Subject: Re: Problem with paths and images
- From: Ronny Reichmann <email@hidden>
- Date: Tue, 19 Dec 2006 18:17:27 +0100
Everything you draw will be anti-aliased. Ever scaled an aliased
drawn line in photoshop?
Don't draw the line inside of the 32x32 pixel image. Draw the line
directly after you did draw the 256x256 one. Thats all.
Am 19.12.2006 um 16:59 schrieb Livio Isaia:
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