Hi, Larry. I believe that you'll want to create a new NSImage that's the precise size of all of the assembled pieces. Then you'll lock focus on it, use drawing operations for the other images, and then unlock focus.
This was composed in Mail.app, and assumes the existence of some constants like tileHeight and tileWidth. Someone else is likely to notice an error or two--you might need to specify a rectangle (there are a few variations of compositeToPoint:) and drawAtPoint: might also be an option in your case, depending on the situation.
---start code ---
NSSize combinedTileSize = ....; // Figure out your big image size
NSImage *theBigPicture = [[NSImage alloc] initWithSize:combinedTileSize];
[theBigPicture lockFocus];
int x, y;
/* come up with an algorithm to place the tiles here; for example: */
/*for (x = 0; x < theBigPictureTotalColumns; ++x) {
for (y = 0; y < theBigPictureTotalRows; ++y) {
[theTileForThisPosition compositeToPoint:NSMakePoint(x * tileWidth, y * tileHeight)
operation:NSCompositeCopy];
}
}*/
[theBigPicture unlockFocus];
/* do stuff with your picture */
[theBigPicture release]; // don't forget that!
----end code-----
Best wishes,
Andrew Merenbach
On May 31, 2005, at 3:58 PM, Larry Gerndt wrote:
My application receives an image from a server which sends the image as a series of tiles-- that is, it grids the image and sends each section of the grid as a separate message. I know how to convert each received tile into an NSImage, but I don't know how to assemble these individual NSImages into one whole NSImage. Can anyone give me some advice? Thanks in advance.