KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Converting a Color Value to an RGB Color Value
PRODUCT: 4D | VERSION: 2003.3 | PLATFORM: Mac & Win
Published On: July 1, 2004
Your current browser may not allow you to download the asset. We recommend Mozilla Firefox or Google Chrome.
Log In

Here is a simple method that will convert a color value to an RGB color value.

  ` Project Method: ConvertColorToRGB
  ` $1 - Color Value
  ` $2 - Returns Red Colorn Value
  ` $3 - Returns Green Colorn Value
  ` $4 - Returns Blue Colorn Value

C_LONGINT($1;$color)
C_POINTER($2;$3;$4)
C_POINTER($red;$green;$blue)
$color:=$1
$red:=$2
$green:=$3
$blue:=$4
If ($color>0)
    $red->:=$color >> 16
    $color:=$color-($red-> << 16)
    $green->:=($color >> 8)
    $blue->:=$color-($green-> << 8)
Else
    $red->:=0
    $green->:=0
    $blue->:=0
End if


Example method calls:

ConvertColorToRGB (vlColor;->vlRed;->vlGreen;->vlBlue)