• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSWindow background image tiled from top-left corner?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: NSWindow background image tiled from top-left corner?
      • From: Scott Ruda <email@hidden>
  • Prev by Date: NSWindow background image tiled from top-left corner?
  • Next by Date: Re: NSWindow background image tiled from top-left corner?
  • Previous by thread: NSWindow background image tiled from top-left corner?
  • Next by thread: Re: NSWindow background image tiled from top-left corner?
  • Index(es):
    • Date
    • Thread