Skip navigation.
 
mlRe: IconRef to NSImage
FROM : Andrew Platzer
DATE : Fri Jan 18 18:41:47 2002

On Friday, January 18, 2002, at 07:14 , Chris Gervais wrote:
> Does anyone have some sample code, or an easy method, of translating a
> Carbon IconRef (as returned by various IconServices APIs) into a NSImage?
> I've looked at plotting the IconRef into a CGContextRef but don't really
> know where to proceed after that point.


NSImage* image = [[NSImage alloc] initWithSize:NSMakeSize(width,height)];
[image lockFocus];
PlotIconRefInContext((CGContextRef)[[NSGraphicsContext currentContext]
graphicsPort],
                      CGRectMake(0,0,width,height),
                      kAlignNone,
                      kTransformNone,
                      NULL /*inLabelColor*/,
                      kPlotIconRefNormalFlags,
                      iconRef);
[image unlockFocus];

Andrew
__________________________________________________________________
A n d r e w  P l a t z e r
  A p p l i c a t i o n    F r a m e w o r k s
    A p p l e


Related mailsAuthorDate
mlIconRef to NSImage Chris Gervais Jan 18, 07:15
mlRe: IconRef to NSImage Nicholas Riley Jan 18, 12:05
mlRe: IconRef to NSImage Andrew Platzer Jan 18, 18:41