Module Rgb.pkg

     1//************************************************************************
     2//--- RGB.pkg
     3//
     4// Copyright (c) 1983-1997 Data Access Corporation, Miami Florida,
     5// All rights reserved.
     6// DataFlex is a registered trademark of Data Access Corporation.
     7//
     8//************************************************************************
     9//  Description:
    10//      Provide basic functions and symbols required to use Windows'
    11//      RGB colors.
    12//
    13//  Author: Stuart W. Booth
    14//************************************************************************
    15// 02/06/98 JJT - changed system colors "clxxxx" to standard windows
    16//                system colors with highest bit set ($800000xx). Used by
    17//                new colors.
    18//************************************************************************
    19
    20// constants for RGB color schemes NOTE: these are for backwards compatibility - do not use them!
    21#REPLACE CLR_BLACK 0,0,0
    22#REPLACE CLR_WHITE 255,255,255
    23#REPLACE CLR_LIGHT_GREY 192,192,192
    24#REPLACE CLR_DARK_GREY 128,128,128
    25
    26// The following symbols mirror the "System-Colors" of Windows and
    27// can be used wherever a RGB value is expected
    28
    29// In VDF a rgb system color is recognized by setting the hi bit
    30// to true and passing the windows system color constant in the lower
    31// bytes. for example: ColorButtonFace in WinUser is $0F. In VDF you can
    32// set the color by setting the value $8000000F.
    33//     Set Color to $8000000F   or Set Color to clBtnFace
    34// VDF will do the system color conversion. It will also recognize that
    35// this is a system color and change the color if the system colors change.
    36//
    37//  If you were using any of these in the past you will now get different
    38//  values. You should be able to use them as before, but the actual value
    39//  is different. If you want to get the actual rgb color for this, use the
    40//  following: Move (GetSysColor(clName IAND $FFFFFF))
    41//  Note that these are better values for setting colors because they
    42//  will change if the system colors are changed.
    43#REPLACE clScrollBar           (|CI$80000000)
    44#REPLACE clBackground          (|CI$80000001)
    45#REPLACE clActiveCaption       (|CI$80000002)
    46#REPLACE clInactiveCaption     (|CI$80000003)
    47#REPLACE clMenu                (|CI$80000004)
    48#REPLACE clWindow              (|CI$80000005)
    49#REPLACE clWindowFrame         (|CI$80000006)
    50#REPLACE clMenuText            (|CI$80000007)
    51#REPLACE clWindowText          (|CI$80000008)
    52#REPLACE clCaptionText         (|CI$80000009)
    53#REPLACE clActiveBorder        (|CI$8000000A)
    54#REPLACE clInactiveBorder      (|CI$8000000B)
    55#REPLACE clAppWorkSpace        (|CI$8000000C)
    56#REPLACE clHighlight           (|CI$8000000D)
    57#REPLACE clHighlightText       (|CI$8000000E)
    58#REPLACE clBtnFace             (|CI$8000000F)
    59#REPLACE clBtnShadow           (|CI$80000010)
    60#REPLACE clGrayText            (|CI$80000011)
    61#REPLACE clBtnText             (|CI$80000012)
    62#REPLACE clInactiveCaptionText (|CI$80000013)
    63#REPLACE clBtnHighlight        (|CI$80000014)
    64#REPLACE cl3DDkShadow          (|CI$80000015)
    65#REPLACE cl3DLight             (|CI$80000016)
    66#REPLACE clInfoText            (|CI$80000017)
    67#REPLACE clInfoBk              (|CI$80000018)
    68
    69
    70#REPLACE clAqua    |CI$00FFFF00
    71#REPLACE clBlack   |CI$00000000
    72#REPLACE clBlue    |CI$00FF0000
    73#REPLACE clDkGray  |CI$00808080
    74#REPLACE clFuchsia |CI$00FF00FF
    75#REPLACE clGray    |CI$00808080
    76#REPLACE clGreen   |CI$00008000
    77#REPLACE clLime    |CI$0000FF00
    78#REPLACE clLtGray  |CI$00C0C0C0
    79#REPLACE clMaroon  |CI$00000080
    80#REPLACE clNavy    |CI$00800000
    81#REPLACE clOlive   |CI$00008080
    82#REPLACE clPurple  |CI$00800080
    83#REPLACE clRed     |CI$000000FF
    84#REPLACE clSilver  |CI$00C0C0C0
    85#REPLACE clTeal    |CI$00808000
    86#REPLACE clWhite   |CI$00FFFFFF
    87#REPLACE clYellow  |CI$0000FFFF
    88
    89Define clNone    for |CI$FFFFFFFF
    90Define clDefault for |CI$FF000000
    91
    92// Function RGB
    93// this function is used to generate a COLORREF value for GDI functions
    94
    95Function RGB Global Integer iRed Integer iGreen Integer iBlue Returns Integer
    96    Function_Return (iRed+(iGreen*256)+(iBlue*65536))
    97End_Function
    98
    99Function R_From_RGB Global Integer rgbColor returns Integer
   100    Function_Return (rgbColor IAND $0000FF)
   101End_Function
   102
   103Function G_From_RGB Global Integer rgbColor returns Integer
   104    Function_Return ((rgbColor IAND $00FF00) /256)
   105End_Function
   106
   107Function B_From_RGB Global Integer rgbColor returns Integer
   108    Function_Return ((rgbColor IAND $FF0000) /65536)
   109End_Function
   110
   111