Image::RGB image on OS X


#1

Apparently on OS X you can’t make images with type Image::RGB. Instead you get an RGBA image.

In other words, in the following code both asserts will fail:

Image img(Image::RGB, 100, 100);
jassert(img.isRGB());
jassert(!img.hasAlphaChannel());

Surprise.

Can this be fixed, or if not can it be mentioned to the docs?


#2

If you don’t specify an ImageType, then it’ll use NativeImageType, and the exact layout of the pixels will depend on what the native format can support.

If you want more control, you could use SoftwareImageType. But yes, I’ll add a note to the docs to make it clearer that the pixel format is really just a hint.


#3

The layout may be different, but that’s still separate from the format. I thought for the layout you have to look at BitmapData::pixelStride, etc, not at the type. The point is that the created image also has a different format.

Not a big deal, since it’s quite unusual for code to depend on the exact image format. A typical case where it’s important is when you convert an image you got via another API, then you have to know if you should write the alpha channel or not.