Home

Colors and Patterns

The following subprograms provide the ability to manage colors, patterns, and line styles. AppGraphics provides constants for quickly accessing common colors:

BLACK
RED
GREEN
CYAN
BLUE
MAGENTA
BROWN
LIGHTGRAY
DARKGRAY
LIGHTBLUE
LIGHTGREEN
LIGHTCYAN
LIGHTRED
LIGHTMAGENTA
YELLOW
WHITE

creatergb

C int creatergb (r, g, b)
Fortran function creatergb (r, g, b)

Description

Combines separate red, green, and blue values into a single integer representing the RGB triplet

Parameters

Parameter C Type Fortran Type Description
r int integer The value of red on a scale of 0 to 255
g int integer The value of green on a scale of 0 to 255
b int integer The value of blue on a scale of 0 to 255

Return Value

C int
Fortran integer

The RGB triplet as an integer

getbkcolor

C int getbkcolor ( )
Fortran function getbkcolor ( )

Description

Returns the current background color.

Return Value

integer

C int
Fortran integer

The color being used for the background.

getbluevalue

C int getbluevalue ( col )
Fortran function getbluevalue ( col )

Description

Returns the blue value of the color passed in on a scale of 0 to 255

Return Value

integer

C int
Fortran integer

The blue component of the passed color.

getcolor

C int getcolor ( )
Fortran function getcolor ( )

Description

Returns the current drawing color.

Return Value

C int
Fortran integer

The current foreground drawing color

getdisplaycolor

C int getdisplaycolor (col)
Fortran function getdisplaycolor (col)

Description

Given the color specified, returns the color that would actually be used for drawing on the current device. Because not all colors are necessarily available on all devices, the display color may return the closest value.

Parameters

Parameter C Type Fortran Type Description
col int integer Index of the color of interest

Return Value

C int
Fortran integer

The color that would actually be used for drawing

getfillpattern

C void getfillpattern (pattern)
Fortran subroutine getfillpattern (pattern)

Description

Returns the current byte array representing the pattern used for fill operations. The pattern array is a sequence of 8 characters, with each byte corresponding to 8 pixels in the pattern. Whenever a bit in a pattern byte is set to 1, the corresponding pixel will be plotted.

Parameters

Parameter C Type Fortran Type Description
pattern char * character, dimension(8) The array that receives the pattern

getfillsettings

C void getfillsettings (fillinfo)
Fortran subroutine getfillsettings (fillinfo)

Description

Returns the current fill settings, which includes the pattern index and the current color.

Parameters

Parameter C Type Fortran Type Description
fillinfo fillsettingstype * fillsettingstype The current fill settings

The fillsettingstype struct / derived type has the following members:

Member C Type Fortran Type Description
pattern int integer(kind=c_int) An integer describing the pattern (see: setfillstyle)
color int integer(kind=c_int) The current color

getgreenvalue

C int getgreenvalue ( col )
Fortran function getgreenvalue ( col )

Description

Returns the green value of the color passed in on a scale of 0 to 255

Return Value

integer

C int
Fortran integer

The green component of the passed color.

getlinesettings

C void getlinesettings (lineinfo)
Fortran subroutine getlinesettings (lineinfo)

Description

Returns the current line settings, which includes the style, pattern, and thickness. The style will be one of the following:

SOLID_LINE
DOTTED_LINE
CENTER_LINE
DASHED_LINE
USERBIT_LINE

Parameters

Parameter C Type Fortran Type Description
lineinfo linesettingstype * linesettingstype The current line settings

The linesettingstype struct / derived type has the following members:

Member C Type Fortran Type Description
linestyle int integer(kind=c_int) An integer describing the style (see above)
upattern int integer(kind=c_int) An explicit bit-wise description of the current line pattern
thickness int integer(kind=c_int) The line thickness

getredvalue

C int getredvalue ( col )
Fortran function getredvalue ( col )

Description

Returns the red value of the color passed in on a scale of 0 to 255

Return Value

integer

C int
Fortran integer

The red component of the passed color.

setbkcolor

C void setbkcolor (col)
Fortran subroutine setbkcolor (col)

Description

Set the current background color to the specified value. Setting the background color does not automatically fill a specified window with said value.

Parameters

Parameter C Type Fortran Type Description
col int integer The color to set as the background during drawing

setcolor

C void setcolor (col)
Fortran subroutine setcolor (col)

Description

Set the current foreground color to the specified value. The color may either be an RGB value or a named/indexed color.

Parameters

Parameter C Type Fortran Type Description
col int integer The color to set as the foreground color

setfillpattern

C void setfillpattern (upattern, col)
Fortran subroutine setfillpattern (upattern, col)

Description

Sets the byte array representing the pattern used for fill operations. Additionally, sets the color to use for fill operations. The pattern array is a sequence of 8 characters, with each byte corresponding to 8 pixels in the pattern. Whenever a bit in a pattern byte is set to 1, the corresponding pixel will be plotted.

Parameters

Parameter C Type Fortran Type Description
upattern char[8\] character, dimension(8) The byte array representing the fill pattern
col int integer The color to set as the fill color

setfillsettings

C void setfillsettings (fillinfo)
Fortran subroutine setfillsettings (fillinfo)

Description

Sets the current fill settings, which includes the pattern index and the current color.

Parameters

Parameter C Type Fortran Type Description
fillinfo fillsettingstype fillsettingstype The new fill settings

setfillstyle

C void setfillstyle (pattern, col)
Fortran subroutine setfillstyle (pattern, col)

Description

Sets the current fill style to a predefined pattern for fill operations. Additionally, sets the color to use for fill operations. The pattern may be one of the following:

ID
EMPTY_FILL
SOLID_FILL
LINE_FILL
LTSLASH_FILL
SLASH_FILL
BKSLASH_FILL
LTBKSLASH_FILL
HATCH_FILL
XHATCH_FILL
INTERLEAVE_FILL
WIDE_DOT_FILL
CLOSE_DOT_FILL

Parameters

Parameter C Type Fortran Type Description
pattern int integer The id of the desired fill pattern
col int integer The color to set as the foreground color

setlinesettings

C void setlinesettings (lineinfo)
Fortran subroutine setlinesettings (lineinfo)

Description

Sets the current line settings, which includes the style, pattern, and thickness. The style will be one of the following:

SOLID_LINE
DOTTED_LINE
CENTER_LINE
DASHED_LINE
USERBIT_LINE

Parameters

Parameter C Type Fortran Type Description
lineinfo linesettingstype linesettingstype The new line settings

setlinestyle

C void setlinestyle (linestyle, upattern, thickness)
Fortran subroutine setlinestyle (linestyle, upattern, thickness)

Description

Sets the current line style to either a predefined pattern or a user-specified pattern. Additionally, sets the thickness of lines. The linestyle may be one of the following:

SOLID_LINE
DOTTED_LINE
CENTER_LINE
DASHED_LINE
USERBIT_LINE

If USERBIT_LINE is specified, the line pattern as specified by upattern is used. The upattern parameter will be a 2-byte array where any bit set to 1 will be drawn.

Parameters

Parameter C Type Fortran Type Description
linestyle int integer The id of the desired pre-defined line pattern or USERBIT_LINE
upattern unsigned short integer(kind=c_short) The 16-bit pattern to use for line drawing
thickness int integer The thickness of the line

setwritemode

C void setwritemode (mode)
Fortran subroutine setwritemode (mode)

Description

Configures the graphics write mode to use one of the following operations as specified by mode during drawing:

ID Description
COPY_PUT Drawing will be strictly the specified foreground/background/fill color
XOR_PUT Drawing will be a combination of the colors in the foreground/background/fill color and in the underlying screen, but not in both

Parameters

Parameter C Type Fortran Type Description
mode int integer One of the modes specified above

systemcolor

C int systemcolor (col)
Fortran function systemcolor (col)

Description

Retrieves a valid RGB identifier for the requested system color. Supported system colors currently are:

ID Description
COLOR_WINDOW_BKGD The default Windows background color

Parameters

Parameter C Type Fortran Type Description
col int integer The identifier of the system color to retrieve

Return Value

C int
Fortran integer

The RGB representation of the system color.