Re: CICN resource into NSImage, help!!!
Re: CICN resource into NSImage, help!!!
- Subject: Re: CICN resource into NSImage, help!!!
- From: Nathan Day <email@hidden>
- Date: Wed, 15 May 2002 16:06:31 +0930
On Wednesday, May 15, 2002, at 03:52 AM, Gore wrote:
- (NSImage *)iconImageforIcon:(int)icon
{
Handle theCIcon = NULL;
IconFamilyHandle iconFamily = (IconFamilyHandle)NewHandle(0);
OSErr theErr=noErr;
if ((theCIcon = GetResource('cicn',icon))==NULL) return nil;
NSLog(@"size=%d", GetHandleSize(theCIcon));
theErr = SetIconFamilyData(iconFamily, 'cicn', theCIcon);
NSLog(@"theErr=%d",theErr);
if (theErr != noErr) return nil;
return [[IconFamily iconFamilyWithIconFamilyHandle: iconFamily]
imageWithAllReps];
}
but it gives me error -180, but with other types such as ICN# it works,
what am i doing wrong? why is it so hard to do this?! if anyone know
how to set up an image rep for the 'cicn' resource then it would be
nice...
IconFamily's can only contain icon family types, cicn isn't one of them,
ICN# is.
My understanding of PICT data is that they are similar to NSImages, they
can contain quick draw drawing instructions or bitmap images. If you can
setup a PICT to be a graf port you then might be able to use the cicn
function PlotCIcon.
Alternatively you might be able to get a pointer to the iconData and
pass it directly to a NSBitmapImageRep. A cicn struct contains a PixMap
element which contains formate information that looks similar to
NSBitmapImageRep's formate information.
struct PixMap {
Ptr baseAddr;
SInt16 rowBytes;
Rect bounds;
SInt16 pmVersion;
SInt16 packType;
SInt32 packSize;
Fixed hRes;
Fixed vRes;
SInt16 pixelType;
SInt16 pixelSize;
SInt16 cmpCount;
SInt16 cmpSize;
SInt32 planeBytes;
CTabHandle pmTable;
SInt32 pmReserved;
};
_______________________________________________
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.