Home

Images

These procedures can be used for loading, saving, and printing images to and from a window. Images are always saved as Windows Bitmap files, although other image types may be loaded.

allocateimage

Fortran subroutine allocateimage (img, width, height)

Description

Allocates an image object capable of storing an image of the desired width and height

Parameters

Parameter Fortran Type Description
img type(imagetype), intent(out) The properly allocated image buffer
width integer Desired image width
height integer Desired image height

copyimage

Fortran subroutine copyimage (left, top, img)

Description

Copies an image from the current window starting at the given coordinates. The width and height of the copy region is determined by the allocated image object.

Parameters

Parameter Fortran Type Description
left integer Left window coordinate of region to copy
top integer Top window coordinate of region to copy
img type(imagetype), intent(inout) An allocated image buffer

freeimage

Fortran subroutine freeimage (img)

Description

Frees the memory associated with an image object

Parameters

Parameter Fortran Type Description
img type(imagetype) An allocated image buffer

getimage

C void getimage (left, top, right, bottom, img)

Description

Retrieves image data from the current window, storing it in the already-allocated buffer img.

Parameters

Parameter C Type Description
left int Left edge of the image
top int Top edge of the image
right int Right inclusive edge of the image
bottom int Bottom inclusive edge of the image
img void * A buffer allocated to hold the image

imagesize

C unsigned long imagesize (width, height)

Description

Calculates the number of bytes necessary to store an image of a given width and height. This function is normally used to determine the size of a necessary image buffer prior to allocation.

Parameters

Parameter C Type Description
width long Width of the image
height long Height of the image

Return Value

C unsigned long

The number of bytes necessary to store the image

pasteimage

Fortran subroutine pasteimage (left, top, img, operation)

Description

Pastes an image into the current window starting at the given coordinates. The value of operation determines how the operation is handled:

ID Description
COPY_PUT Copy
XOR_PUT Exclusive Or
OR_PUT Inclusive Or
AND_PUT And
NOT_PUT Copy the inverse of the source

Parameters

Parameter Fortran Type Description
left integer Left window coordinate to apply the paste operation
top integer Top window coordinate to apply the paste operation
img type(imagetype) An allocated image buffer
operation integer The operation to use for pasting

printimage

C void printimage (title, left, top, right, bottom, active)
Fortran subroutine printimage (title, left, top, right, bottom, active)

Description

Prints the region specified in the current window to a printer after displaying a “Print” dialog. The active flag can be used in double-buffering situations to speccify the active buffer. By default, the entire active buffer is printed. This procedure will scale the selected region to fill the printed page with a reasonable border encircling it.

Parameters

Parameter C Type Fortran Type Description
title char * character(*)1 The title to print at the top of the document
left int integer1 The left coordinate in the window
top int integer1 The top coordinate in the window
right int integer1 The right coordinate in the window
bottom int integer1 The bottom coordinate in the window
active bool logical1 True to use the active graphics buffer, False to use the visible buffer

putimage

C void putimage (left, top, img, operation)

Description

Draws the image into the current window at the specified location. The value of operation determines how the operation is handled:

ID Description
COPY_PUT Copy
XOR_PUT Exclusive Or
OR_PUT Inclusive Or
AND_PUT And
NOT_PUT Copy the inverse of the source

Parameters

Parameter C Type Description
left int Left edge of the image
top int Top edge of the image
img void * A pointer to the image data
operation int The operation to use for pasting

readimagefile

C void readimagefile (filename, left, top, right, bottom)
Fortran subroutine readimagefile (filename, left, top, right, bottom)

Description

Reads in an image file specified by filename and draws the resulting image at the coordinates specified. If filename is NULL or omitted, an “Open” dialog will appear. Image data falling outside the specified bounds will be clipped, not scaled. If the coordinates specify a region bigger than the image itself, the image will be drawn starting at the left-top position.

Parameters

Parameter C Type Fortran Type Description
filename char * character(*)1 The filename to read
left int integer1 The left coordinate at which to draw the loaded image in the window
top int integer1 The top coordinate at which to draw the loaded image in the window
right int integer1 The right coordinate at which to draw the loaded image in the window
bottom int integer1 The bottom coordinate at which to draw the loaded image in the window

writeimagefile

C void writeimagefile (filename, left, top, right, bottom, active)
Fortran subroutine writeimagefile (filename, left, top, right, bottom, active)

Description

Writes an image file specified by filename using the graphics at the coordinates specified. If filename is NULL or omitted, an “Save As…” dialog will appear. The active flag can be used in double-buffering situations to speccify the active buffer. By default, the entire active buffer is saved.

Parameters

Parameter C Type Fortran Type Description
filename char * character(*)1 The filename to read
left int integer1 The left coordinate in the window
top int integer1 The top coordinate in the window
right int integer1 The right coordinate in the window
bottom int integer1 The bottom coordinate in the window
active bool logical1 True to use the active graphics buffer, False to use the visible buffer

1 Optional named argument