Page 1 of 1

Drawing an alphachannel brush on a palette brush

Posted: Mon Apr 14, 2025 5:42 pm
by jPV
I found that if I draw a brush with alphachannel or mask on a palette brush, it doesn't remap colors correctly. It never uses the last pen of the palette, but usually the previous or something like that.

If I remove the alphachannel/mask, then it uses all colors of the palette.

I think this is a bug or if I haven't figured out the reason, please let me know. Or if there's any simple workaround... tested on MorphOS.

Code: Select all

@PALETTE 1, {Type = #PALETTE_GRAY4}

SetFillStyle(#FILLCOLOR)

; Palette based brush as the destination
CreateBrush(1, 400, 300, {Palette=1})

pal = GetAttribute(#BRUSH, 1, #ATTRPALETTE)

; Create an alphachannel brush to be pasted on the palette brush
CreateBrush(2, 400, 100, {AlphaChannel=True})
SelectBrush(2)
For Local i = 0 To ListItems(pal) - 1
	Box(i*100, 0, 100, 100, pal[i])
Next
EndSelect()


SelectBrush(1)

; Original colors drawn directly, to be compared with other results.
For Local i = 0 To ListItems(pal) - 1
	Box(i*100, 0, 100, 100, pal[i])
Next

; Let Hollywood remap the alpha channel brush. Last color is mapped wrong.
DisplayBrush(2, 0, 100)

; All colors are remapped correctly if there isn't an alpha channel.
DeleteAlphaChannel(2)
DisplayBrush(2, 0, 200)

EndSelect()


DisplayBrush(1, 0, 0)
WaitLeftMouse()

Re: Drawing an alphachannel brush on a palette brush

Posted: Fri Apr 18, 2025 10:55 pm
by airsoftsoftwair
Yes, this looks like a bug. Will be fixed.

Re: Drawing an alphachannel brush on a palette brush

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

Code: Select all

- Fix: Drawing a brush with an alpha channel or a mask to a palette brush never took the last pen of the
  brush into account when remapping the colors of the source brush to the target palette brush