Re: Getting a .icns file from IconRef data
Re: Getting a .icns file from IconRef data
- Subject: Re: Getting a .icns file from IconRef data
- From: Mike Abdullah <email@hidden>
- Date: Mon, 19 Nov 2012 18:36:13 +0000
On 17 Nov 2012, at 04:09, Ken Thomases <email@hidden> wrote:
> On Nov 16, 2012, at 9:20 PM, Kyle Sluder wrote:
>
>> On Nov 16, 2012, at 6:56 PM, John Brownie <email@hidden> wrote:
>>
>>> If I use TISGetInputSourceProperty to get the kTISPropertyIconImageURL property of a keyboard layout, it returns nil, so I get the kTISPropertyIconRef property, which gives me an IconRef. I can turn that into an NSImage with -initWithIconRef, but what I really want to do is to write out a file in the .icns format. I have not been able to find documentation on how to do that step. Lack of internet access has also complicated things, but a search just now didn't throw up anything that looked helpful.
>>
>> Look into CGImageDestination (aka ImageIO). If that doesn't help, you might be stuck using the old Carbon resource manager functions.
>
> You don't need the Resource Manager. There's the Icon Family API for this: SetIconFamilyData().
>
> You should be aware that a bug was introduced to Snow Leopard with its last major update (10.6.8), such that the CGImageDestination API produces corrupt ICNS files. So, if you are maintaining compatibility with that version of the OS, you probably want to use the Icon Family API instead, even though it's obsolete and deprecated.
Have a radar number we can dupe?
_______________________________________________
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