MgraControl()函数

Synopsis

Control the specified graphic context.

Format

void MgraControl(GraphContId, ControlType, Value)

MIL_ID GraphContId; Graphic context identifier
long ControlType; Control type
long ControlValue; Control value

Description

This function allows you to set the attributes of a graphic context.

The GraphContId parameter specifies the identifier of the graphic context (MgraAlloc). To control the default graphic context of the current MIL application, set this parameter to M_DEFAULT.

The ControlType and ControlValue parameters specify the graphic features to control and the values needed for the control. These two parameters can be set to one of the following combinations:

ControlType Description & ControlValue
M_BACKGROUND_MODE Controls the setting of background color on the drawing surface.
M_OPAQUE Fill background with the current background color before drawing text. This is the default value (M_DEFAULT).
M_TRANSPARENT Do not change background before drawing text. This creates a transparent background for printed characters.
M_COLOR Sets the foreground color of a specified graphics context.
M_BACKCOLOR Sets the background color of a specified graphics context.

For M_COLOR and M_BACKCOLOR, if your RGB values are 8 bits, you can draw in true color by using the M_RGB888 macro:

MgraControl(M_DEFAULT, M_COLOR, M_RGB888(red component, green component, blue component)

If your RGB values are 16 or 32 bits, you must call MgraControl for each color component (R,G, and B). Add M_RED, M_GREEN or M_BLUE to M_COLOR or M_BACKCOLOR to specify the component. For example, for a 16-bit RGB color, you would call the following macro for the red color component:

MgraControl(M_DEFAULT, M_COLOR+M_RED, red color component)

Note that if you do not add the color components to M_COLOR and M_BACKCOLOR, you draw in grayscale. Therefore, the following macro can be used to draw in grayscale:

MgraControl(M_COLOR, value)

See also

MgraAlloc, MgraText

《MgraControl()函数》上有1条评论

评论已关闭。