Syntax
[C/C++:]
void gGetImageFile(int type, char file[], int coldef, int coloff, int collim, int *xgrid, int *ygrid, int psiz, int pixbuf[]);
[F90:]
subroutine gGetImageFile(type, file, coldef, coloff, collim, xgrid, ygrid, psiz, pix)
integer, intent(in) :: type
character*(*), intent(in) :: file
integer, intent(in) :: coldef,coloff,collim,psiz
integer, intent(out) :: xgrid,ygrid,pixbuf(*)
Arguments
type
Image type
|
= GBMPFILE, |
Uncompressed Windows Bitmap file (BMP) |
|
= GXWDFILE, |
X Windows Dump format (XWD) |
|
= GICOFILE, |
Windows Icon file (ICO) |
|
= GJPEGFILE, |
JPEG image format (JPG) |
|
= GPNGFILE, |
Portable Network Graphics file (PNG) |
file
Image file name
coldef
Colour definition flag
|
= 0, |
Skip colour definition table - use image data only |
|
= 1, |
Read and interpret image file making appropriate GINO colour table changes |
|
= 2 |
Map image to (nearest) GINO colour indices |
coloff
Colour offset
collim
Colour index limit
|
= 0, |
Current device maximum colour index (see gSetColourInfo()) |
xgrid
Image width in pixels
ygrid
Image height in pixels
psiz
Size of image array
pix
pixbuf
Image array
Description
The routine gGetImageFile() will read an image file of the specified type into a pixel array for subsequent GINO processing or output using the image routines. The user must set the size of the pixel array
pixbuf in
psiz which should be large enough to hold any image read in by this routine. The size of the image read is returned in the variables
xgrid and
ygrid.
The image file may contain 1,2,4 or 8bit colour indices (optionally preceded with a list of colour definitions) or consist of 24bit RGB triplets. The data is interpreted according to the setting of the arguments
coldef,
coloff and
collim, taking into account the colour mode of the currently nominated device.
For
coldef=0, any colour index definition data (in an indexed image file) is ignored and the image data is read into the image array as it is stored (adding the specified offset in
coloff). This mode is not permitted when reading 24bit images on colour index devices (monochrome or static or dynamic) as the data would represent an illegal colour index.
For
coldef=1, the image integrity is maintained as far as is possible taking into account the colour facilities of the current device. When reading an image on an indexed device, the GINO colour table is modified, within the range of
coloff and
collim, to match the colours required in the image file and the appropriate index is placed in the image array. On true colour devices, a 24bit RGB triplet is placed in the image array for each pixel read.
For
coldef=2, the image colours, whether indexed or 24bit, are mapped onto the nearest colours in the existing GINO colour table and the resulting index is placed in the image array.  No modifications are made to the GINO colour table. This mode is useful when using an indexed device, but can seriously limit the range of colours in a 24bit image.
Image file size and attributes can be enquired using the routine gEnqImageFile() before using gGetImageFile().
See Also
gGetImageFile UsagegDrawCellArraygDrawPixelArea
gEnqImageFilegPutImageFile