Re: NSDrawNinePartImage not working ?
Re: NSDrawNinePartImage not working ?
- Subject: Re: NSDrawNinePartImage not working ?
- From: PCWiz <email@hidden>
- Date: Tue, 16 Feb 2010 18:22:25 -0700
You shouldn't be doing any drawing in awakeFromNib. See this example code:
http://developer.apple.com/mac/library/samplecode/RoundTransparentWindow/index.html
It demonstrates how to create and display a custom window using an NSWindow subclass.
On 2010-02-14, at 10:36 PM, Sandro Noël wrote:
> Ok I know I must be missing something dumb.
> i'm trying to draw borders for the window,
>
> - (void) awakeFromNib{
>
> [window setStyleMask:NSBorderlessWindowMask];
> [window setOpaque:YES];
>
> NSDrawNinePartImage([[window contentView]frame],
> nil,
> nil,
> nil,
> [NSImage imageNamed:@"right3.png"],
> nil,
> [NSImage imageNamed:@"left3.png"],
> [NSImage imageNamed:@"right4.png"],
> [NSImage imageNamed:@"left5.png"],
> [NSImage imageNamed:@"left4.png"],
> NSCompositeClear,
> 1.0,
> NO);
>
>
> but i get an error on runtime.
> <Error>: CGContextGetStyle: invalid context 0x0
> It does not make sense to draw an image when [NSGraphicsContext currentContext] is nil. This is a programming error.
> Break on _NSWarnForDrawingImageWithNoCurrentContext to debug. This will be logged only once. This may break in the future.
> CGContextClipToRect: invalid context 0x0
> <Error>: CGContextSetAlpha: invalid context 0x0
> <Error>: CGContextGetUserSpaceToDeviceSpaceTransform: invalid context 0x0
> <Error>: CGContextDrawTiledImage: invalid context 0x0
> <Error>: CGContextClipToRect: invalid context 0x0
> <Error>: CGContextSetAlpha: invalid context 0x0
> <Error>: CGContextGetUserSpaceToDeviceSpaceTransform: invalid context 0x0
> <Error>: CGContextDrawTiledImage: invalid context 0x0
>
> I looked in the docsa little but did not find any indication that i had to provide a Graphics context.
>
> any pointers ?
>
>
> Sandro.
>
>
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please 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)
Please 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