Possible bug with SELMODE_COMBO & Brushes

Report any Hollywood bugs here
Post Reply
User avatar
Allanon
Posts: 441
Joined: Sun Feb 14, 2010 8:53 pm
Location: Italy
Contact:

Possible bug with SELMODE_COMBO & Brushes

Post by Allanon » Fri Nov 10, 2017 10:23 pm

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
----------------------------
[Allanon] Fabio Falcucci
AMC - Creative Development // Docs Site // Support Forum
Support me on Patreon for Hollywood libraries!

User avatar
airsoftsoftwair
Posts: 2572
Joined: Fri Feb 12, 2010 3:33 pm
Location: Germany
Contact:

Re: Possible bug with SELMODE_COMBO & Brushes

Post by airsoftsoftwair » Mon Nov 13, 2017 10:34 pm

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.

User avatar
Allanon
Posts: 441
Joined: Sun Feb 14, 2010 8:53 pm
Location: Italy
Contact:

Re: Possible bug with SELMODE_COMBO & Brushes

Post by Allanon » Wed Nov 15, 2017 1:14 am

Thank you for the fix and the tip!
----------------------------
[Allanon] Fabio Falcucci
AMC - Creative Development // Docs Site // Support Forum
Support me on Patreon for Hollywood libraries!

Post Reply