RgbAlphaSub
NewRGB = RgbAlphaSub(RGBValue1, RGBValue2)
 
Parameters:

    RGBValue1 = An RGB Colour Value
    RGBValue2 = An RGB Colour Value
Returns:

    NewRGB = The resulting colour after this operation
 

      The RgbAlphaSub() function performs an Alpha subtraction between the RGB channels of two colours. If any channel underflows ( the result after the subtraction is lower than 0), then result is clipped to the minimum value of 0.



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
  
  

 
Related Info: RGB | RgbAlphaAdd | RgbAlphaAnd | RGBAlphaBlend | RgbAlphaMult | RgbAlphaOr | RgbAlphaXOr | RGBB | RGBFade | RGBG | RGBGreyScale | RGBR :
 


(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com