Home Page - SourceForge Project Page
IconFamily
IconFamily is a Cocoa/Objective-C wrapper for the Mac OS X Carbon API's "icon family" data type. Its main purpose is to enable Cocoa applications to easily create custom file icons from NSImage instances, and thus take advantage of Mac OS X's high-resolution RGBA "thumbnail" icon formats to provide richly detailed thumbnail previews of the files' contents.
Using IconFamily, this becomes as simple as:
[iconFamily setAsCustomIconForFile:anExistingFile];
You can also write an icon family to an .icns file using the -writeToFile: method.
Method Types
+ iconFamilyWithContentsOfFile:
+ iconFamilyWithIconFamilyHandle:
+ iconFamilyWithIconOfFile:
+ iconFamilyWithScrap
+ iconFamilyWithSystemIcon:
+ iconFamilyWithThumbnailsOfImage:
+ iconFamilyWithThumbnailsOfImage:usingImageInterpolation:
- init
- initWithContentsOfFile:
- initWithIconFamilyHandle:
- initWithIconOfFile:
- initWithScrap
- initWithSystemIcon:
- initWithThumbnailsOfImage:
- initWithThumbnailsOfImage:usingImageInterpolation:
Class Methods
Returns YES if an IconFamily can be created from 'icns' data on the pasteboard, NO if no such data is present.
Returns an autoreleased IconFamily initialized using the -init method.
Returns an autoreleased IconFamily initialized using the -initWithContentsOfFile: method.
Returns an autoreleased IconFamily initialized using the -initWithIconFamilyHandle: method.
Returns an autoreleased IconFamily initialized using the -initWithIconOfFile: method.
Returns an autoreleased IconFamily initialized using the -initWithScrap method.
Returns an autoreleased IconFamily initialized using the -initWithSystemIcon: method.
Returns an autoreleased IconFamily initialized using the -initWithThumbnailsOfImage: method.
Returns an autoreleased IconFamily initialized using the -initWithThumbnailsOfImage:usingImageInterpolation: method.
Removes the custom icon (if any) from the specified folder.
Removes the custom icon (if any) from the specified file's resource fork, and clears the necessary Finder bits for the file.
Instance Methods
Gets the image data for one of the icon family's elements as a new, 32-bit RGBA NSBitmapImageRep. The specified elementType should be one of kIconServices512PixelDataARGB, kIconServices256PixelDataARGB, kThumbnail32BitData, kLarge32BitData, or kSmall32BitData.
The returned NSBitmapImageRep will have the corresponding 8-bit mask data in its alpha channel, or a fully opaque alpha channel if the icon family has no 8-bit mask data for the specified alpha channel.
Returns nil if the requested element cannot be retrieved (e.g. if the icon family has no such 32BitData element).
Creates and returns an NSImage that contains the icon family's various elements as its NSImageReps.
Initializes the receiver as a new, empty IconFamily. This is IconFamily's designated initializer method.
Initializes an IconFamily by loading the contents of an .icns file.
Initializes an IconFamily from an existing Carbon IconFamilyHandle.
Initializes an IconFamily by loading the Finder icon that's assigned to a file.
Initializes an IconFamily from 'icns' data on the pasteboard. Use +canInitWithScrap to determine whether such data is present.
Initializes an IconFamily by referencing a standard system icon.
Initializes an IconFamily by creating its elements from a resampled NSImage. This is equivalent to invoking -initWithThumbnailsOfImage:usingImageInterpolation: with an imageInterpolation parameter of NSImageInterpolationHigh, which produces highly smoothed thumbnails.
Initializes an IconFamily by creating its elements from an NSImage, resampled using the interpolation mode specified by imageInterpolation.
Copies an IconFamily to the pasteboard as 'icns' data.
Performs the same function as -setAsCustomIconForFile:, but is implemented slightly differently as needed for folders (directories).
Performs the same function as -setAsCustomIconForFile:withCompatibility:, but is implemented slightly differently as needed for folders (directories).
Writes the icon family to the resource fork of the specified file as its kCustomIconResource, and sets the necessary Finder bits so the icon will be displayed for the file in Finder views. This is equivalent to invoking -setAsCustomIconForFile:withCompatibility: with a compat parameter of NO.
Writes the icon family to the resource fork of the specified file as its kCustomIconResource, and sets the necessary Finder bits so the icon will be displayed for the file in Finder views. If compat is YES, additional copies of the IconFamily's "large" (32 x 32) and "small" (16 x 16) elements will be written to the file's resource fork as separate resources. This takes additional space in the resource fork, but provides compatibility with pre-Mac OS X versions of Finder, which won't otherwise find and display the custom icon.
Sets the image data for one of the icon family's elements from an NSBitmapImageRep. The elementType parameter must be one of the icon family element types listed below, and the format of the bitmapImageRep must match the corresponding requirements specified below. In all cases, the bitmapImageRep must also be non-planar and have 8 bits per sample.
elementType | dimensions | format |
kIconServices512PixelDataARGB | 512 x 512 | 32-bit RGBA, 32-bit RGB, or 24-bit RGB |
kIconServices256PixelDataARGB | 256 x 256 | 32-bit RGBA, 32-bit RGB, or 24-bit RGB |
kThumbnail32BitData | 128 x 128 | 32-bit RGBA, 32-bit RGB, or 24-bit RGB |
kThumbnail8BitMask | 128 x 128 | 32-bit RGBA or 8-bit intensity |
kLarge32BitData | 32 x 32 | 32-bit RGBA, 32-bit RGB, or 24-bit RGB |
kLarge8BitMask | 32 x 32 | 32-bit RGBA or 8-bit intensity |
kLarge1BitMask | 32 x 32 | 32-bit RGBA, 8-bit intensity, or 1-bit |
kSmall32BitData | 16 x 16 | 32-bit RGBA, 32-bit RGB, or 24-bit RGB |
kSmall8BitMask | 16 x 16 | 32-bit RGBA or 8-bit intensity |
kSmall1BitMask | 16 x 16 | 32-bit RGBA, 8-bit intensity, or 1-bit |
When an RGBA image is supplied to set a "Mask" element, the mask data is taken from the image's alpha channel.
Writes the icon family to an .icns file.