Resizing NSImage in 10.3?
Resizing NSImage in 10.3?
- Subject: Resizing NSImage in 10.3?
- From: Nick Morris <email@hidden>
- Date: Sun, 2 Nov 2003 23:02:27 +0000
Hi,
This used to work in 10.2 and earlier, but for some reason I now get an
'EXC_BAD_ACCESS' on the 'unlockFocus' in 10.3
Any ideas?
Thanks in advance!
Nick
NSImage *theImage;
NSImageRep *theImageRep = [NSImageRep
imageRepWithContentsOfFile:filePath];
NSBitmapImageRep *theBitMapToBeSaved;
NSSize theImageRepSize;
NSSize newSize;
NSData *theImageData;
float theSize = 80.0;
theImageRepSize.width = [theImageRep pixelsWide];
theImageRepSize.height = [theImageRep pixelsHigh];
[theImageRep setSize:theImageRepSize];
theImage = [[NSImage alloc] initWithSize:theImageRepSize];
[theImage setScalesWhenResized:YES];
[theImage addRepresentation:theImageRep];
newSize.width = (theImageRepSize.width * (theSize / 100.0));
newSize.height = (theImageRepSize.height * (theSize / 100.0));
//Change picture size
[theImage lockFocus]; // Lock focus (needed to produce change)
[theImage setSize:newSize]; // Change size
[theImage unlockFocus]; // Unlock focus when finished <--
EXC_BAD_ACCESS occurs here!
_______________________________________________
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.