Re: NSWindow background image tiled from top-left corner?
Re: NSWindow background image tiled from top-left corner?
- Subject: Re: NSWindow background image tiled from top-left corner?
- From: Rainer Brockerhoff <email@hidden>
- Date: Sun, 19 Sep 2004 16:22:30 -0300
At 12:02 -0700 19/09/2004, email@hidden wrote:
>From: Scott Ruda <email@hidden>
>Date: Sun, 19 Sep 2004 11:57:00 -0700
>
>How can I get a window to have a background image which is tiled and when the window is resized it grows from the top-left corner instead of the bottom-left?
>
>Currently I am doing this, but it tiles from the bottom-left, which looks wrong when the window is live-resized:
>
>[window setBackgroundColor:[NSColor colorWithPatternImage:[NSImage imageNamed:@"walnut.gif"]]];
After this, add something like:
NSRect windowFrame = [window frame];
NSPoint upperLeftCorner = NSMakePoint(windowFrame.origin.x, windowFrame.origin.y+windowFrame.size.height);
[[NSGraphicsContext graphicsContextWithWindow:window] setPatternPhase:upperLeftCorner];
which should do what you want. Disclaimer: compiled in Eudora, etc. ;-)
--
Rainer Brockerhoff <email@hidden>
Belo Horizonte, Brazil
"It's extremely unlucky to be superstitious, for no other reason
than it is always unlucky to be colossally stupid." (Stephen Fry)
Weblog: http://www.brockerhoff.net/bb/viewtopic.php
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden