Report-an-Apple-bug Friday! 46
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:
- Create an NSBitmapImageRep with an RGB color space and a bitmapFormat that contains the NSAlphaFirstBitmapFormat bit and not the NSFloatingPointSamplesBitmapFormat bit.
- Call +[NSGraphicsContext graphicsContextWithBitmapImageRep:] with the image rep created in step 1.
- Set the current graphics context to the graphics context created in step 2.
- 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: Apple Bug Friday, applebugfriday