Report-an-Apple-bug Friday! 46

2006-08-18 19:17:00 -08:00

This bug is +graphicsContextWithBitmapImageRep: doesn’t properly map bitmap format to Quartz. It was filed on 2006-08-17 at 19:07 PDT.


Summary:

+[NSGraphicsContext graphicsContextWithBitmapImageRep:] always returns a RGBA context, even when the image rep is ARGB.

Steps to Reproduce:

  1. Create an NSBitmapImageRep with an RGB color space and a bitmapFormat that contains the NSAlphaFirstBitmapFormat bit and not the NSFloatingPointSamplesBitmapFormat bit.
  2. Call +[NSGraphicsContext graphicsContextWithBitmapImageRep:] with the image rep created in step 1.
  3. Set the current graphics context to the graphics context created in step 2.
  4. Draw.

Expected Results:

WYD (draw) IWYG.

Actual Results:

The components in each pixel come out of the image rep permuted, since you expect ARGB from the image rep, but the graphics context put RGBA into it instead.

Regression:

None known.

Notes:

I did not test with the NSFloatingPointSamplesBitmapFormat bit; therefore, I do not know whether the bug exists with it or only without it.

Workaround:

Reinvent the +graphicsContextWithBitmapImageRep: wheel.


Technorati tags: ,

Leave a Reply

Do not delete the second sentence.