Page 1 of 1

Possible bug with SELMODE_COMBO & Brushes

Posted: Fri Nov 10, 2017 10:23 pm
by Allanon
Hello,
AlphaChannel's curse is here again :D

from the Hollywood manual for the SelectBrush command:
...If you pass 2 in combomode, Hollywood will blend color channels and alpha channel of the source image into the destination image's color and alpha channels. When you draw the destination image later, it will look as if the two images had been drawn on top of each other consecutively.
I can get the stated result, seems that only the alpha channel is blended, color instead is replaced by the last drawing function, here is my test snippet:

Code: Select all

 
SetFillStyle(#FILLCOLOR)
Local tmpBrush = CreateBrush(Nil, 200, 200, #WHITE, { Alphachannel = True, Clear = True })
  SelectBrush(tmpBrush, #SELMODE_COMBO, 2)
  box(0, 0, 150, 150, $88ff0000)
  box(50, 50, 150, 150, $880000ff)
EndSelect
      
cls()
box(0, 0, 250, 400, #GREEN)
DisplayBrush(tmpBrush, 150, 150)

WaitLeftMouse()
With this snippet I get a background green box, but the two boxes draw on the brush are not mixed, instead the blue box is drawn over the red one.
If you create a brush without alpha channel the colors are mixed correctly.

I'm on Windows 10

Re: Possible bug with SELMODE_COMBO & Brushes

Posted: Mon Nov 13, 2017 10:34 pm
by airsoftsoftwair
Thanks, fixed:

Code: Select all

- Fix: Box() with a partly transparent foreground colour wasn't mixed correctly when drawn to an
  offscreen brush with #SELMODE_COMBO and combo mode 2
As a workaround, do not use Box() but create a brush that contains the box and then draw this brush instead. Then it should work correctly.

Re: Possible bug with SELMODE_COMBO & Brushes

Posted: Wed Nov 15, 2017 1:14 am
by Allanon
Thank you for the fix and the tip!