(no subject)
(no subject)
- Subject: (no subject)
- From: John Brewer <email@hidden>
- Date: Fri, 25 Jul 2003 02:17:48 -0700
Anyone know how to do a simple CopyBits in Cocoa? I'm trying:
workImage = [[NSImage alloc] initWithSize:NSMakeSize(size, size)];
[workImage setCacheMode: NSImageCacheNever];
workImageRep = [[[NSBitmapImageRep alloc]
initWithBitmapDataPlanes: NULL
pixelsWide: size
pixelsHigh: size
bitsPerSample: 8
samplesPerPixel: 4
hasAlpha: YES
isPlanar: NO
colorSpaceName: NSDeviceRGBColorSpace
bytesPerRow: rowBytes
bitsPerPixel: 0]
autorelease];
[workImage addRepresentation: workImageRep];
NSLog([[workImage representations] description]);
[workImage lockFocusOnRepresentation: workImageRep];
[seedImage compositeToPoint: NSZeroPoint fromRect: offScreenRect
operation: NSCompositeCopy];
[workImage unlockFocus];
NSLog([[workImage representations] description]);
(seedImage's NSImageRep is an NSBitmapImageRep, in case that
matters). The first NSLog indicates that workImage's sole NSImageRep
is an NSBitmapImageRep. The second NSLog indicates that workImage's
sole NSImageRep is an NSCachedImageRep, from which I can't extract
the image data, which was the whole point of this exercise in the
first place.
Basically, I'd like way to say, "copy this rectangle in seedImage to
this rectangle in workImage". In this case, the rectangles are the
same size, but I'd hope there's also a way that works like
QuickDraw's CopyBits, which could do arbitrary scaling.
Thanks,
--
John Brewer
Jera Design
Extreme Programming FAQ:
http://www.jera.com/techinfo/xpfaq.html
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.