• 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: How to convert 32bit to 24 bit NSBitmapImageRep
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to convert 32bit to 24 bit NSBitmapImageRep


  • Subject: Re: How to convert 32bit to 24 bit NSBitmapImageRep
  • From: "Michael Ash" <email@hidden>
  • Date: Wed, 26 Jul 2006 21:05:39 -0400

On 7/26/06, Vinay Prabhu <email@hidden> wrote:
Hi,

Is there any direct API to convert from 32 bit to 24 bit NSBitmapImageRep?

I couldn't find any direct way, I have tried 2 methods,
1) Obtained the data pointer from 32 bit NSBitmapImageRep, and created new
image rep
using the initWithBitmapDataPlanes API.
This resulted in junk output.

2) Created a new image rep using the initWithBitmapDataPlanes API by passing
"nil" for data pointer.
Then obtained the data pointer using "bitmapData" API and copied the data
from 32 bit to 24 bit, without passing alpha information.
This also resulted in junk output

Any better method to do this?

If you can require Tiger, create a 24-bit NSBitmapImageRep, then create a new NSGraphicsContext from it, and draw your 32-bit rep into it. This will make the graphics system handle all the annoying conversions automatically.

If that is not an option, attempt #2 should have worked. If you got
junk output, that just means your conversion was written wrong.

Mike
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • RE: How to convert 32bit to 24 bit NSBitmapImageRep
      • From: Vinay Prabhu <email@hidden>
References: 
 >How to convert 32bit to 24 bit NSBitmapImageRep (From: Vinay Prabhu <email@hidden>)

  • Prev by Date: Re: NSTextView, style, and weird Core Data issue
  • Next by Date: Re: How would you convert a \r to its UTF-8 counterpart ?
  • Previous by thread: How to convert 32bit to 24 bit NSBitmapImageRep
  • Next by thread: RE: How to convert 32bit to 24 bit NSBitmapImageRep
  • Index(es):
    • Date
    • Thread