Image::RGB image on OS X

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);


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

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.

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.