• 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
Re: Generic Bitmap to NSImage
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Generic Bitmap to NSImage


  • Subject: Re: Generic Bitmap to NSImage
  • From: Graham Cox <email@hidden>
  • Date: Fri, 26 Jun 2015 09:29:17 +1000

> On 26 Jun 2015, at 9:10 am, Raglan T. Tiger <email@hidden> wrote:
>
> I have a list of generic bitmaps that are to be transformed to NSImages.  The list can be long, I haven limits on it.
>
> Here is the code I use to populate an NSMenu that gets set into an NSPopUpButton.
>
> I need to speed this process up ... any suggestions?


Instead of creating a CGBitmapContext to wrap your pixel buffer, then turning it into a CGImage, then copying it to an NSImage, why not create a NSBitmapImageRep directly wrapping the original buffer? Then it can be added to an NSImage as a rep without any copying being necessary at any point. The slowness here (which you imply is a problem) is very likely due to the fact that you are having to copy each bitmap twice (once when you create the CGImage, the second time when you blit that into the NSImage).

—Graham



_______________________________________________

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


References: 
 >Generic Bitmap to NSImage (From: "Raglan T. Tiger" <email@hidden>)

  • Prev by Date: Generic Bitmap to NSImage
  • Next by Date: Re: Generic Bitmap to NSImage
  • Previous by thread: Generic Bitmap to NSImage
  • Next by thread: Re: Generic Bitmap to NSImage
  • Index(es):
    • Date
    • Thread