MgraAlloc()函数

Synopsis

Allocate a graphics context.

Format

MIL_ID MgraAlloc(SystemId, GraphContIdPtr)

MIL_ID SystemId; System identifier
MIL_ID *GraphContIdPtr; Storage location for graphics context identifier

Description

This function allocates a graphics context, which specifies drawing and text parameters for use in subsequent MIL graphic functions.

Upon allocation of a graphics context, the drawing and text parameters are set to the following default values:

Foreground color 0xFFFFFFFF
Background color 0x00000000
Font M_FONT_DEFAULT_SMALL
Font scale X = 1.0, Y = 1.0

You can modify these values, using MgraColor, MgraBackColor, MgraFont, and MgraFontScale, or inquire about the current values, using MgraInquire.

You can set the attributes of the graphic context (for example, background transparency), using MgraControl.

When a graphics context is no longer required, release it, using MgraFree.

The SystemId parameter specifies the system on which the graphics context will be allocated. This parameter must be set to a valid system identifier, M_DEFAULT_HOST, or M_DEFAULT. Specify M_DEFAULT_HOST to allocate on the default Host system of the current MIL application. Specify M_DEFAULT to have MIL select the most appropriate system on which to allocate the graphics context (it can be the default Host system or any already allocated system).

The GraphContIdPtr parameter specifies the address of the variable in which the graphics context identifier is to be written. Since the MgraAlloc function also returns the buffer identifier, you can set this parameter to M_NULL. If allocation fails, M_NULL is written as the identifier.

Note, upon allocation of an application, a default graphics context is automatically allocated. Rather than using MgraAlloc to allocate a graphics context, you can use this default graphics context, by specifying M_DEFAULT wherever a graphics context identifier is required.

Returned value

The returned value is the graphics context identifier. If allocation fails, M_NULL is returned.

See also

MgraFree, MgraColor, MgraBackColor, MgraFont, MgraFontScale, MgraInquire