The ADDTABLE, FILLSTYLE, FONT, FONTHEADFOOT, and LINESTYLE messages have a color parameter. This color parameter must contain a valid COLORREF value, which is passed to the printer engine. The formula for calculating a COLORREF is:
 

color = 0
color += red
color += green * 256
color += blue * 65536

Where red is the red value from 0 to 255, green is the green value from 0 to 255, and blue is the blue value from 0 to 255. Black is equal to 0 and white is equal to 16843008.

The setup program for the OIPI installed a function called RGB() that can be called from a Basic+ program to perform the conversion to the COLORREF format. There are three parameters for the RGB() function: red, green, and blue. These parameters must have values between 0 and 255. The value for each color specifies how much of each color component is contained in the COLORREF.

Another method of obtaining a valid COLORREF is to use the Basic+ UTILITY() function. The common dialog box for Colors can be displayed with the first parameter of UTILITY set to CHOOSECOLOR.

The OIPRINT_EQUATES $INSERT record contains constants for common color codes.

  • No labels