On 10/08/2009, at 8:18 AM, Mirko Viviani wrote:

I'm using -[NSColor colorWithPatternImage:] to draw a background pattern image and I want to set
a constraint for the drawing starting rectangle.

The docs says that "The image is tiled starting at the bottom of the window"
...
Is there any way to change this behaviour?


Yes, you can use the -setPatternPhase: method of NSGraphicsContext to draw the pattern in the location you expect. You have to calculate the offset yourself.

Have a look at Dave Batton's excellent DBBackgroundView for an example:

http://www.mere-mortal-software.com/blog/details.php?d=2007-01-16

--
Rob Keniger



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to