Re: IB palettes and [NSBezierPath setDefaultLineWidth:]
Re: IB palettes and [NSBezierPath setDefaultLineWidth:]
- Subject: Re: IB palettes and [NSBezierPath setDefaultLineWidth:]
- From: Pete Yandell <email@hidden>
- Date: Tue, 4 Feb 2003 15:14:16 +1100
On Tuesday, February 4, 2003, at 02:43 PM, Buddy Kurz wrote:
>
I'm thinkin' that since setDefaultLineWidth is a class method and not
>
an instance method that the defaults are stored in the NSBezierPath
>
class and not in the graphics context and you need to save the
>
individual defaults yourself or create an instance and change the
>
values in your instance.
Not according to the docs on setDefaultLineWidth: in NZBezierPath:
"Sets the current graphics context's line width to width points."
I could potentially create an NSBezierPath instance to draw my line and
use setLineWidth: instead, but I'm trying to get my drawing as quick as
possible and instantiating an NSBezierPath object just to draw a single
line seems a waste.
>
On Monday, February 3, 2003, at 06:30 PM, Pete Yandell wrote:
>
>
> I'm building some custom controls along with an Interface Builder
>
> palette for them and am having a weird problem.
>
>
>
> A cell for my control, in its drawInteriorWithFrame:inView: method,
>
> does the following:
>
>
>
> [[NSColor blackColor] set];
>
> [NSBezierPath setDefaultLineWidth:2.0];
>
> [NSBezierPath strokeLineFromPoint:pointA toPoint:pointB];
>
>
>
> The problem I'm having is that when I load the palette containing this
>
> control into IB and create a window containing an instance of the
>
> control, the IB alignment guides in the window go from being single
>
> pixel wide dotted blue lines to being two pixel wide solid blue lines!
>
>
>
> Evidently my control is mucking up the graphics context for the window
>
> and IB is using that context to draw its guides. So, I figured I'd
>
> just save and restore the graphics context:
>
>
>
> - (void)drawInteriorWithFrame:(NSRect)frame inView:(NSView*)view
>
> {
>
> [NSGraphicsContext saveGraphicsState];
>
> ...
>
> [NSGraphicsContext restoreGraphicsState];
>
> }
>
>
>
> Strangely enough, this doesn't help...I still get two pixel wide solid
>
> blue guides.
>
>
>
> Anybody have any good ideas on what I should do?
>
>
>
> Pete Yandell
>
> http://pete.yandell.com/
>
> _______________________________________________
>
> 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.
>
_______________________________________________
>
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.
>
>
Pete Yandell
http://pete.yandell.com/
_______________________________________________
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.