• 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: Creating a NSBitmapImageRep
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Creating a NSBitmapImageRep


  • Subject: Re: Creating a NSBitmapImageRep
  • From: Dave Hayden <email@hidden>
  • Date: Tue, 2 Jul 2002 22:52:10 -0700 (PDT)

On Tue, 2 Jul 2002, Richard Schreyer wrote:

> The problem is the image isn't getting created correctly. If I give it
> an alpha of 255, everything works, and I get the desired color. If I
> set the alpha to 254, and then display the image, it draws black lines
> across the color in-line with the white portions of the pinstripes
> behind it. If I set the alpha to 253 or lower, I end up with
> transparent gray, it's transparency varying with the alpha.
>
> Does anyone know what might be causing this?

Note this line from the initWithBitmapDataPlanes:... docs:

If a coverage plane exists, the bitmap's color components must be
premultiplied with it.

That means your legal RGB values range from 0 up to alpha, not 255. If
you change your inner loop to

imageBytes[pixIndex] = 0; // red
imageBytes[pixIndex+1] = 0; // green
imageBytes[pixIndex+2] = 128; // blue
imageBytes[pixIndex+3] = 128; // alpha

you'll get a half-transparent fully saturated blue image.

-D
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Creating a NSBitmapImageRep (From: Richard Schreyer <email@hidden>)

  • Prev by Date: Creating a NSBitmapImageRep
  • Next by Date: Re: Cocoa stripping resource forks: does Jaguar fix?
  • Previous by thread: Creating a NSBitmapImageRep
  • Next by thread: Re: Creating a NSBitmapImageRep
  • Index(es):
    • Date
    • Thread