• 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
Re: Using NSImage in a tool
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using NSImage in a tool


  • Subject: Re: Using NSImage in a tool
  • From: Matt Mashyna <email@hidden>
  • Date: Tue, 26 Jun 2007 09:35:46 -0400

Ah, that's the ticket! If I had know it was so simple I wouldn't have bored everyone with all the details.

Thanks a million,
Matt

On Jun 26, 2007, at 12:29 AM, John Stiles wrote:

You need to call NSApplicationLoad() at the beginning of your app. This bit me in the past as well :)

Matt Mashyna wrote:
I'm trying to use the IconFamily class from Troy Stephens, Thomas Schnitzer, David Remahl, Nathan Day and Ben Haller in a Foundation Tool project. When I use the code in Cocoa application, I have an NSImageView that I can drop files on to and later use the NSImage from it to make an icns file. Works fine with the GUI. When I try to use the same code in a Foundation Tool it crashes.


When I use the same code without a GUI (maybe that's not really the problem) I seem to get a crash from trying to call lockFocus even though newImage is not nil and appears in the debugger to be requested size.


newImage = [[NSImage alloc] initWithSize:NSMakeSize (iconWidth,iconWidth)];
[newImage lockFocus];


Thread 0 Crashed:
0 com.apple.Foundation 0x9282347f _NSRaiseError + 227
1 com.apple.Foundation 0x9284a23f +[NSException raise:format:] + 57
2 com.apple.AppKit 0x932c72ae _NXCreateWindow + 308
3 com.apple.AppKit 0x932c709a CreateWindowNamed + 166
4 com.apple.AppKit 0x932c6cef NewCacheWindowInfo + 76
5 com.apple.AppKit 0x932c6847 _NXAllocateImageCache + 1425
6 com.apple.AppKit 0x932c5f8a -[NSCachedImageRep _initWithSize:depth:separate:alpha:allowDeep:] + 350
7 com.apple.AppKit 0x932c5e26 -[NSCachedImageRep initWithSize:depth:separate:alpha:] + 78
8 com.apple.AppKit 0x932c5d25 -[NSImage lockFocus] + 285
9 makeIcon 0x00006239 +[IconFamily resampleImage:toIconWidth:usingImageInterpolation:] + 770
10 makeIcon 0x00006595 -[IconFamily initWithThumbnailsOfImage:usingImageInterpolation:] + 423
11 makeIcon 0x0000407d -[IconFamily initWithThumbnailsOfImage:] + 41
12 makeIcon 0x00001ea6 makeIcnsFile + 104



My app is a tool and doesn't have a GUI so it seems like a call to CreateWindowNamed is probably not a good thing to need to call. What I am ultimately trying to do is load an NSImage from a URL, rescale it and get it into a NSBitmapImageRep that I can use to make an icon with.


While I seem to be able to load an NSImage from an image file URL, I can't lock focus on an NSImage to change it. I must be missing a step. Can someone help me out ?


Matt _______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
40blizzard.com


This email sent to email@hidden


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Using NSImage in a tool (From: Matt Mashyna <email@hidden>)
 >Re: Using NSImage in a tool (From: John Stiles <email@hidden>)

  • Prev by Date: Re: Play a song with QTMovie
  • Next by Date: Re: Drawing from upper left
  • Previous by thread: Re: Using NSImage in a tool
  • Next by thread: Re: Using NSImage in a tool
  • Index(es):
    • Date
    • Thread