• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Resizing NSImage in 10.3?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.
  • Prev by Date: Re: Setting a horizontal divider in an NSOutlineView
  • Next by Date: NSTableView / NSMatrix+NSScrollView -- What should I use?
  • Previous by thread: Re: XCode - break on Exception?
  • Next by thread: NSTableView / NSMatrix+NSScrollView -- What should I use?
  • Index(es):
    • Date
    • Thread