The RgbAlphaMult() function performs an alpha multiplication between the RGB channels of two colours. The channels of second colour are used to scale the first colour. This allows you to fade the colours channels individually.
FACTS:
* You can find some more detailed examples in the Projects/Examples/Colours folder of your PB installation.
Mini Tutorial:
This example shows the effects of the various Alpha colour operations
ColourA=RGB(100,110,120) ColourB=RGB(50,60,70) PrintHEading("Rgb Alpha Addition") PrintColour( ColourA) PrintColour( ColourB) PrintColour( RgbAlphaAdd(ColourA,ColourB)) PrintHEading("Rgb Alpha SubTract") PrintColour( ColourA) PrintColour( ColourB) PrintColour( RgbAlphaSub(ColourA,ColourB)) PrintHEading("Rgb Alpha Mult") PrintColour( ColourA) PrintColour( ColourB) PrintColour( RgbAlphaMult(ColourA,ColourB)) PrintHEading("Rgb Alpha And") PrintColourHex( ColourA) PrintColourHex( ColourB) PrintColourHex( RgbAlphaAnd(ColourA,ColourB)) PrintHEading("Rgb Result After Alpha OR") PrintColourHex( ColourA) PrintColourHex( ColourB) PrintColourHex( RgbAlphaOr(ColourA,ColourB)) PrintHEading("Rgb Result After Alpha XOR") PrintColourHex( ColourA) PrintColourHex( ColourB) PrintColourHex( RgbAlphaXor(ColourA,ColourB)) Sync WaitKey ; Split the colour into and R,G,B fields and display it Function PrintColour(ThisColour) r=RgbR(ThisCOlour) g=RgbG(ThisCOlour) b=RgbB(ThisCOlour) Print Str$(r)+","+Str$(g)+","+Str$(b) EndFunction ; Show Colour in hex Function PrintColourHex(ThisColour) r$=Right$(Hex$(RgbR(ThisCOlour)),2) g$=Right$(Hex$(RgbG(ThisCOlour)),2) b$=Right$(Hex$(RgbB(ThisCOlour)),2) Print r$+","+g$+","+b$ EndFunction ; Display a heading Function PrintHEading(Heading$) Print "" Print AutoCaps$(Heading$) EndFunction |
This example would output. RGB Alpha Addition 100,110,120 50,60,70 150,170,190 RGB Alpha Subtract 100,110,120 50,60,70 50,50,50 RGB Alpha Mult 100,110,120 50,60,70 19,26,33 RGB Alpha And 64,6E,78 32,3C,46 20,2C,40 RGB Result After Alpha Or 64,6E,78 32,3C,46 76,7E,7E RGB Result After Alpha Xor 64,6E,78 32,3C,46 56,52,3E |
|