Some brushes are reported to have 0 bits depth
Posted: Thu Mar 13, 2025 6:26 pm
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.
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()