Page 1 of 1

Some brushes are reported to have 0 bits depth

Posted: Thu Mar 13, 2025 6:26 pm
by jPV
In some cases GetAttribute() reports brush depth as 0 bits. The documentation tells "Returns the depth of the brush. If this is less than or equal to 8, the brush is a palette brush."

So, I was detecting brushes as palette brushes if their depth was less than 9, but got issues because some RGB brushes reported their depth as 0.

Here are couple examples where I noticed it. Tested on MorphOS.

Code: Select all

CreateGradientBrush(1, 640, 480, #LINEAR, #WHITE, #BLUE)
DisplayBrush(1, 0, 0)
DebugPrint("CreateGradientBrush depth:", GetAttribute(#BRUSH, 1, #ATTRDEPTH)) ; Why this tells the depth is 0? It's less than 8, but still an RGB brush?

CreateBrush(2, 200, 100, #RED)
DebugPrint("CreateBrush depth:", GetAttribute(#BRUSH, 2, #ATTRDEPTH)) ; Tells it's 24bit.
DisplayBrush(2, 0, 0)
SetClipboard(#CLIPBOARD_IMAGE, 2)
type, id = GetClipboard()
DebugPrint("GetClipboard depth:", GetAttribute(#BRUSH, id, #ATTRDEPTH)) ; Tells it's 0bit.
DisplayBrush(id, 200, 200)

WaitLeftMouse()

Re: Some brushes are reported to have 0 bits depth

Posted: Fri Mar 14, 2025 6:09 pm
by airsoftsoftwair
Clearly a bug, will be fixed. Thanks for reporting!

Re: Some brushes are reported to have 0 bits depth

Posted: Sun May 04, 2025 5:31 pm
by airsoftsoftwair

Code: Select all

- Fix: CreateGradientBrush(), CreateShadowBrush(), CreateBorderBrush(), GrabDesktop(), GetVideoFrame() and
  GetClipboard() always set the brush's depth to 0 instead of 24 or 32