• 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: CGBitmapContextCreate hates me
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CGBitmapContextCreate hates me


  • Subject: Re: CGBitmapContextCreate hates me
  • From: Scott Thompson <email@hidden>
  • Date: Mon, 20 Mar 2006 18:57:31 -0600

data = malloc( dataLength );
memset( data, 0, dataLength );

newImgSetup = CGBitmapContextCreate( data, width, height, bitsPerComponent,
bytesPerRow, colorSpace, alphaInfo );

Core Graphics doesn't support RGB Bitmap contexts (i.e. ones with no storage for alpha channel). Set your components to 4 and use kCGImageAlphaNoneSkipFirst or kCGImageAlphaNoneSkipLast. (depending on your desires).


see also:

<http://developer.apple.com/qa/qa2001/qa1037.html>

Scott

Bah, you know as soon as I read that, it clicked what I had read about 24 bit bitmaps not being supported. I just didn’t see that I was asking CG for a 24bit context. It works now (albeit I get a solid black image for output... hrm).

Well, that's what you ask for :-) memset(data, 0, dataLength) sets XRGB (or RGBX) pixels to an opaque black.


Scott

_______________________________________________
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


References: 
 >Re: CGBitmapContextCreate hates me (From: Jim Turner <email@hidden>)

  • Prev by Date: Re: Threading and NSViews
  • Next by Date: Re: Threading and NSViews
  • Previous by thread: Re: CGBitmapContextCreate hates me
  • Next by thread: launching my app breaks command-tab
  • Index(es):
    • Date
    • Thread