• 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
Making a new "ICNS file" with NSImage
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Making a new "ICNS file" with NSImage


  • Subject: Making a new "ICNS file" with NSImage
  • From: Squ Aire <email@hidden>
  • Date: Fri, 18 Sep 2009 02:39:03 +0000
  • Importance: Normal

Introduction: I have an actual ICNS file with some nice icon in it. No matter where I draw it within my app, be it a 16x16 square or a 512x512 square, it draws nicely, scales properly, looks crisp at all times. It does this probably (among other things) by using the correct "representation" within the ICNS file to determine which size in that file it should use to do the actual drawing. So far so good.


My problem is this: I want to derive a new "icon file" (simulated by an NSImage somehow) which has some margins applied to it. The margins on each side should be the size of the area being drawn on divided by 100. So for instance, if we are drawing the icon on a 300x300 area, the top,bottom,left,right margins should all be 3. If drawing on a 30x30 area the margins are .3 or simply negligible.


In other words, I somehow want to make an instance of NSImage such that if drawn on a 300x300 rect, it will look slightly smaller than that because of the margins, i.e. it will not fill out the whole rect as the original ICNS would.


But also note that this new derived "ICNS file" (simulated by NSImage) should of course also draw properly when drawn on a, say, 20x20 square. In other words, the new simulated ICNS file (NSImage instance) should also be able to have those original size "representations" in it somehow that the drawing system can choose from to draw correctly at the requested size.


How would you accomplish this? I cannot really make an NSImage, "lock focus" on it and draw on it beforehand like usual, because I cannot know for sure in the beginning at which size the image will be drawn at. Any ideas?


--.
_________________________________________________________________
Windows Liveā„¢: Keep your life in sync. Check it out!
http://windowslive.com/explore?ocid=TXT_TAGLM_WL_t1_allup_explore_012009_______________________________________________

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: Making a new "ICNS file" with NSImage
      • From: Andrew Farmer <email@hidden>
    • Re: Making a new "ICNS file" with NSImage
      • From: Ken Ferry <email@hidden>
  • Prev by Date: Re: [myNSWindow setDocumentEdited:dirtyB] fail ??
  • Next by Date: Re: Finding user's Music folder (and others)?
  • Previous by thread: Re: Finding user's Music folder (and others)?
  • Next by thread: Re: Making a new "ICNS file" with NSImage
  • Index(es):
    • Date
    • Thread