how do i draw an NSImage into a view in a manner that it is tiled in a single line (there are no incomplete images drawn, and assuming that the image height is equal to the view's height)?
+3
A:
If the image was the same size as the view, you wouldn't need to tile, so I don't quite understand.
However, take a look at NSDrawThreePartImage. On 10.6 you can pass nil for the caps if all you want is a single image tiled either horizontally or vertically.
The other option is to use something along the lines of
[[NSColor colorWithPatternImage:] set];
NSRectFill(rectToBeTiled);
but the phase and scale may not be what you want if you do it this way. Colors draw in what CG calls 'base space' which is kind of like drawing in the coordinate system of the window's content view. So basically, use NSDrawThreePartImage if you can.
Ken
2009-12-17 03:36:30