OSX CreateImage(depth24) but BufferPixelFormat=32?

Mac OSX specific forum
User avatar
Keya
Addict
Addict
Posts: 1891
Joined: Thu Jun 04, 2015 7:10 am

OSX CreateImage(depth24) but BufferPixelFormat=32?

Post by Keya »

Hello im wondering if OSX only supports 32-bit images (OS limitation)? or perhaps a bug with DrawingBufferPixelFormat or CreateImage, or by design? i have no idea! I checked the helpfile in CreateImage/LoadImage but didnt see a mention. Apologies if this has been brought up before but i wasnt sure what to search for

I ask because when i use CreateImage(24) vs CreateImage(32) depths i get a different value for DrawingBufferPixelFormat() for each on Windows and Linux, but OSX returns the same DrawingBufferPixelFormat() for both 24-bit and 32-bit CreateImage, is this correct? thankyou. (tested in 5.42 LTS, x64 on OSX)

[update] DrawingBufferPitch() remained the same suggesting both CreateImage(24) and CreateImage(32) are 32bit

Code: Select all

#Depth=24 ;32
hImg = CreateImage(#PB_Any,100,100,#Depth)
StartDrawing(ImageOutput(hImg))
Fmt = DrawingBufferPixelFormat()
StopDrawing()
Debug "Fmt=$"+Hex(Fmt)
 
;my results:
; Win-24: $8010 = #PB_PixelFormat_24Bits_BGR + #PB_PixelFormat_ReversedY
; Win-32: $8040 = #PB_PixelFormat_32Bits_BGR + #PB_PixelFormat_ReversedY
; Lnx-24: $8    = #PB_PixelFormat_24Bits_RGB
; Lnx-32: $20   = #PB_PixelFormat_32Bits_RGB ;shared
; OSX-24: $20   = #PB_PixelFormat_32Bits_RGB ;shared \ same?
; OSX-32: $20   = #PB_PixelFormat_32Bits_RGB ;shared / same?
Last edited by Keya on Tue Jun 28, 2016 5:08 pm, edited 1 time in total.
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3870
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Re: OSX CreateImage(depth24) but BufferPixelFormat=32?

Post by wilbert »

OSX itself doesn't support 24 bit images so it's true that the internal format for OSX will be 32 bits when you try to create a 24 bit image with CreateImage.

You can tell how it was created.

Code: Select all

CreateImage(1, 100, 100, 24)
Debug ImageDepth(1, #PB_Image_InternalDepth)
Debug ImageDepth(1, #PB_Image_OriginalDepth)

CreateImage(2, 100, 100, 32)
Debug ImageDepth(2, #PB_Image_InternalDepth)
Debug ImageDepth(2, #PB_Image_OriginalDepth)
Windows (x64)
Raspberry Pi OS (Arm64)
User avatar
Keya
Addict
Addict
Posts: 1891
Joined: Thu Jun 04, 2015 7:10 am

Re: OSX CreateImage(depth24) but BufferPixelFormat=32?

Post by Keya »

Ahh ok, cool! its not a problem at all, i just wanted to be sure it was expected behavior. Can keep motoring ahead now lol, thankyou
Post Reply