Re: [NSBezierPath clipRect] do not do what is says!
Re: [NSBezierPath clipRect] do not do what is says!
- Subject: Re: [NSBezierPath clipRect] do not do what is says!
- From: Jeff Argast <email@hidden>
- Date: Thu, 26 Feb 2004 16:05:25 -0700
I don't know about translateOriginToPoint and rectClip, but the fuzzy
line is most like because anti-aliasing is on in the port. That's
great for objects in the document but for UI elements like guides or
resize rectangles that's not so cool. You can turn off anti-aliasing
as follows
NSGraphicsContext* context = [NSGraphicsContext currentContext];
BOOL antiAlias = [context shouldAntialias];
[context setShouldAntialias:NO];
// Do your drawing here
[context setShouldAntialias:antiAlias];
Also, you can use a stroke weight of 0.0 to indicate a device pixel
regardless of the scale factor on the view, for example:
[[NSColor blackColor] set];
[NSBezierPath setDefaultLineWidth:0.0];
[NSBezierPath strokeRect:rectToStroke];
Jeff
FROM: Eric Forget
DATE: 2004-02-26 23:21
>> clipRect:
>>
>> + (void)clipRect:(NSRect)aRect
>> Intersects the current clipping path, stored in the current
graphics
>> context, with the rectangle referred to by aRect, and replaces the
>> current
>> clipping path with the resulting path.
>>
>> However, from my testing, it replaces the clipping without
>> intersecting with
>> the current one!
>
> Have you filed a bug?
Not yet because I was unable to make a small snippet of code to
reproduce
it.
After some investigation, I've found that it was not clipRect fault
but
[NSView translateOriginToPoint:] instead. In fact it appears that
translateOriginToPoint is resetting the clip rect. Is it a normal
behavior?
I was doing the following to remove fuzzy lines at 1 point:
[self translateOriginToPoint:NSMakePoint(0.5, 0.5)];
Eric
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.