• 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
IconRef and NSImageRep
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

IconRef and NSImageRep


  • Subject: IconRef and NSImageRep
  • From: David Catmull <email@hidden>
  • Date: Wed, 19 Dec 2007 11:14:56 -0800

I'm trying to make an NSImageRep subclass that draws IconRefs, but it isn't working - nothing appears on the screen.

I get the IconRef by calling GetIconRef (kOnSystemDisk,kSystemIconsCreator,kGenericFolderIcon,&iconRef), which succeeds by all appearances.

Then I have this method in my NSImageRep subclass:

-(void)draw
{
 NSSize mySize = [self size];
 CGRect drawRect = CGRectMake(0,0,mySize.width,mySize.height);

PlotIconRefInContext((CGContextRef)[[NSGraphicsContext currentContext] graphicsPort],
&drawRect ,kAlignNone,kTransformNone,NULL,kPlotIconRefNormalFlags,iconRef);
}


In the debugger, mySize and drawRect have the expected values (0,0,48,48), but nothing draws. This is in a table cell, and other cells that use images loaded from files appear correctly.

Originally I used [NSWorkspace iconForFileType:], but the resulting image didn't draw well at 48x48. It appeared to be scaled down from the 128x128 image with no smoothing applied. I tried it with and without using setScalesWhenResized.

So, what could I be doing wrong in my NSImageRep? Should I go back to the NSWorkspace approach and try something different?

Thanks,

--
David Catmull
email@hidden
http://www.uncommonplace.com/

_______________________________________________

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


  • Follow-Ups:
    • Re: IconRef and NSImageRep
      • From: Constantine <email@hidden>
  • Prev by Date: Re: Edit textView with IB
  • Next by Date: discovering if a process is busy
  • Previous by thread: Re: Edit textView with IB
  • Next by thread: Re: IconRef and NSImageRep
  • Index(es):
    • Date
    • Thread