# The "imw" Package

These routines provide a means to convert from image data to raw images suitable for low level graphics display. Although these routines are made public, their use is NOT recommended. The viewimg package is the suggested means to manage image display.

Library: karma
Link With: -lkarma

#### Functions

imw_to8_bilinear | Convert generic image to 8 bit image, with resizing.
imw_to8_lossy2 | Convert generic image to 8 bit image, with resizing.
imw_to8_lossy | Convert generic image to 8 bit image, with resizing.
imw_to8_magnify | Convert generic image to 8 bit image, increasing size.
imw_to8_oi | Convert generic image to 8 bit image, preserving size.
imw_scmap_16to24_lossy | Write 16bit image to a 24bit image using a software colourmap.
imw_scmap_16to24_o | Write 16bit image to a 24bit image using a software colourmap.

#### Prototype Functions

imw_PROTO_iscale_func | Intensity scaling callback.

## Functions

#### EXPERIMENTAL FUNCTION: subject to change without notice

flag imw_to8_bilinear (unsigned char *out_image, flag flip, iaddr out_hstride, iaddr out_vstride, int out_width, int out_height, CONST char *inp_image, CONST iaddr *inp_hoffsets, CONST iaddr *inp_voffsets, int inp_width, int inp_height, unsigned int inp_type, unsigned int conv_type, unsigned int num_pixels, CONST unsigned char *pixel_values, unsigned char blank_pixel, unsigned char min_sat_pixel, unsigned char max_sat_pixel, double i_min, double i_max, flag (*iscale_func) (), void *iscale_info)

This routine will convert an image from one format to an 8 bit image of pixels, permitting the input and output sizes to differ. If the input image is effectively shrunk, the input data is subsampled.

Parameters:

- out_image : The output image will be written here.
- flip : If TRUE, the output image is flipped vertically relative to the input image.
- out_hstride : The stride between successive horizontal pixels (in bytes).
- out_vstride : The stride between successive vertical pixels (in bytes).
- out_width : The width of the output image.
- out_height : The height of the output image.
- inp_image : The input image data.
- inp_hoffsets : The array of horizontal byte offsets.
- inp_voffsets : The array of vertical byte offsets.
- inp_width : The width of the input image.
- inp_height : The height of the input image.
- inp_type : The type of the input data.
- conv_type : The input conversion type (when the input is complex). See ds_COMPLEX_CONVERSIONS for the list of allowed values.
- num_pixels : The number of pixels in the pixel array.
- pixel_values : The array of pixel values.
- blank_pixel : The pixel value to be used when the intensity value is an undefined value.
- min_sat_pixel : The pixel value to be used when the intensity value is below the minimum value.
- max_sat_pixel : The pixel value to be used when the intensity value is above the maximum value.
- i_min : The minimum intensity value.
- i_max : The maximum intensity value.
- iscale_func : The function to be called when non-linear intensity scaling is required. If NULL, linear intensity scaling is used. The prototype function is imw_PROTO_iscale_func.
- iscale_info : A pointer to arbitrary information for iscale_func.
- magnify_func : The function to call when magnification is required. This may be NULL, in which case a default pixel replication function is used.

Returns: TRUE on success, else FALSE.
Multithreading Level: Unsafe.

#### EXPERIMENTAL FUNCTION: subject to change without notice

flag imw_to8_lossy2 (unsigned char *out_image, flag flip, iaddr out_hstride, iaddr out_vstride, int out_width, int out_height, CONST char *inp_image, CONST iaddr *inp_hoffsets, CONST iaddr *inp_voffsets, int inp_width, int inp_height, unsigned int inp_type, unsigned int conv_type, unsigned int num_pixels,CONST unsigned char *pixel_values, unsigned char blank_pixel, unsigned char min_sat_pixel, unsigned char max_sat_pixel, double i_min, double i_max, flag (*iscale_func) (), void *iscale_info, MagnifyFunc magnify_func)

This routine will convert an image from one format to an 8 bit image of pixels, permitting the input and output sizes to differ. If the input image is effectively shrunk, the input data is subsampled.

Parameters:

- out_image : The output image will be written here.
- flip : If TRUE, the output image is flipped vertically relative to the input image.
- out_hstride : The stride between successive horizontal pixels (in bytes).
- out_vstride : The stride between successive vertical pixels (in bytes).
- out_width : The width of the output image.
- out_height : The height of the output image.
- inp_image : The input image data.
- inp_hoffsets : The array of horizontal byte offsets.
- inp_voffsets : The array of vertical byte offsets.
- inp_width : The width of the input image.
- inp_height : The height of the input image.
- inp_type : The type of the input data.
- conv_type : The input conversion type (when the input is complex).
- num_pixels : The number of pixels in the pixel array.
- pixel_values : The array of pixel values.
- blank_pixel : The pixel value to be used when the intensity value is an undefined value.
- min_sat_pixel : The pixel value to be used when the intensity value is below the minimum value.
- max_sat_pixel : The pixel value to be used when the intensity value is above the maximum value.
- i_min : The minimum intensity value.
- i_max : The maximum intensity value.
- iscale_func : The function to be called when non-linear intensity scaling is required. If NULL, linear intensity scaling is used. The prototype function is imw_PROTO_iscale_func.
- iscale_info : A pointer to arbitrary information for iscale_func.
- magnify_func : The function to call when magnification is required. This may be NULL, in which case a default pixel replication function is used.

Returns: TRUE on success, else FALSE.
Multithreading Level: Unsafe.

flag imw_to8_lossy (unsigned char *out_image, iaddr out_hstride, iaddr out_vstride, int out_width, int out_height, CONST char *inp_image, CONST iaddr *inp_hoffsets, CONST iaddr *inp_voffsets, int inp_width, int inp_height, unsigned int inp_type, unsigned int conv_type, unsigned int num_pixels, CONST unsigned char *pixel_values, unsigned char blank_pixel, unsigned char min_sat_pixel, unsigned char max_sat_pixel, double i_min, double i_max, flag (*iscale_func) (), void *iscale_info)

This routine will convert an image from one format to an 8 bit image of pixels, permitting the input and output sizes to differ. If the input image is effectively shrunk, the input data is subsampled. The output image is flipped vertically relative to the input image.

Parameters:

- out_image : The output image will be written here.
- out_hstride : The stride between successive horizontal pixels (in bytes).
- out_vstride : The stride between successive vertical pixels (in bytes).
- out_width : The width of the output image.
- out_height : The height of the output image.
- inp_image : The input image data.
- inp_hoffsets : The array of horizontal byte offsets.
- inp_voffsets : The array of vertical byte offsets.
- inp_width : The width of the input image.
- inp_height : The height of the input image.
- inp_type : The type of the input data.
- conv_type : The input conversion type (when the input is complex).
- num_pixels : The number of pixels in the pixel array.
- pixel_values : The array of pixel values.
- blank_pixel : The pixel value to be used when the intensity value is an undefined value.
- min_sat_pixel : The pixel value to be used when the intensity value is below the minimum value.
- max_sat_pixel : The pixel value to be used when the intensity value is above the maximum value.
- i_min : The minimum intensity value.
- i_max : The maximum intensity value.
- iscale_func : The function to be called when non-linear intensity scaling is required. If NULL, linear intensity scaling is used. The prototype function is imw_PROTO_iscale_func.
- iscale_info : A pointer to arbitrary information for iscale_func.

Returns: TRUE on success, else FALSE.
Multithreading Level: Unsafe.

#### EXPERIMENTAL FUNCTION: subject to change without notice

flag imw_to8_magnify (unsigned char *out_image, flag flip, iaddr out_hstride, iaddr out_vstride, int inp_width, int inp_height, int mag_factor, CONST char *inp_image, CONST iaddr *inp_hoffsets, CONST iaddr *inp_voffsets, unsigned int inp_type, unsigned int conv_type, unsigned int num_pixels, CONST unsigned char *pixel_values, unsigned char blank_pixel, unsigned char min_sat_pixel, unsigned char max_sat_pixel, double i_min, double i_max, flag (*iscale_func) (), void *iscale_info)

This routine will convert an image from one format to an 8 bit image of pixels, maintaining the aspect ratio of the original image and magnifying. Magnification is performed by pixel replication.

Parameters:

- out_image : The output image will be written here.
- flip : If TRUE, the output image is flipped vertically relative to the input image.
- out_hstride : The stride between successive horizontal pixels (in bytes).
- out_vstride : The stride between successive vertical pixels (in bytes).
- inp_width : The width of the input image.
- inp_height : The height of the input image.
- mag_factor : The magnification factor. A value of 1 would yield an output image the same size as the input.
- inp_image : The input image data.
- inp_hoffsets : The array of horizontal byte offsets.
- inp_voffsets : The array of vertical byte offsets.
- inp_type : The type of the input data.
- conv_type : The input conversion type (when the input is complex). See ds_COMPLEX_CONVERSIONS for the list of allowed values.
- num_pixels : The number of pixels in the pixel array.
- pixel_values : The array of pixel values.
- blank_pixel : The pixel value to be used when the intensity value is an undefined value.
- min_sat_pixel : The pixel value to be used when the intensity value is below the minimum value.
- max_sat_pixel : The pixel value to be used when the intensity value is above the maximum value.
- i_min : The minimum intensity value.
- i_max : The maximum intensity value.
- iscale_func : The function to be called when non-linear intensity scaling is required. If NULL, linear intensity scaling is used. The prototype function is imw_PROTO_iscale_func.
- iscale_info : A pointer to arbitrary information for iscale_func.

Returns: TRUE on success, else FALSE.
Multithreading Level: Unsafe.

flag imw_to8_oi (unsigned char *out_image, iaddr out_hstride, iaddr out_vstride, int width, int height, CONST char *inp_image, CONST iaddr *inp_hoffsets, CONST iaddr *inp_voffsets, unsigned int inp_type, unsigned int conv_type, unsigned int num_pixels, CONST unsigned char *pixel_values, unsigned char blank_pixel, unsigned char min_sat_pixel, unsigned char max_sat_pixel, double i_min, double i_max, flag (*iscale_func) (), void *iscale_info)

This routine will convert an image from one format to an 8 bit image of pixels, maintaining the original image size. The output image is flipped vertically relative to the input image.

Parameters:

- out_image : The output image will be written here.
- out_hstride : The stride between successive horizontal pixels (in bytes).
- out_vstride : The stride between successive vertical pixels (in bytes).
- width : The width of the image.
- height : The height of the image.
- inp_image : The input image data.
- inp_hoffsets : The array of horizontal byte offsets.
- inp_voffsets : The array of vertical byte offsets.
- inp_type : The type of the input data.
- conv_type : The input conversion type (when the input is complex). See ds_COMPLEX_CONVERSIONS for the list of allowed values.
- num_pixels : The number of pixels in the pixel array.
- pixel_values : The array of pixel values.
- blank_pixel : The pixel value to be used when the intensity value is an undefined value.
- min_sat_pixel : The pixel value to be used when the intensity value is below the minimum value.
- max_sat_pixel : The pixel value to be used when the intensity value is above the maximum value.
- i_min : The minimum intensity value.
- i_max : The maximum intensity value.
- iscale_func : The function to be called when non-linear intensity scaling is required. If NULL, linear intensity scaling is used. The prototype function is imw_PROTO_iscale_func.
- iscale_info : A pointer to arbitrary information for iscale_func.

Returns: TRUE on success, else FALSE.
Multithreading Level: Unsafe.

#### EXPERIMENTAL FUNCTION: subject to change without notice

flag imw_scmap_16to24_lossy (unsigned char *out_red_image, unsigned char *out_green_image, unsigned char *out_blue_image, flag preserve_pad, iaddr out_hstride, iaddr out_vstride, int out_width, int out_height, CONST unsigned short *inp_image, int inp_width, int inp_height, CONST iaddr *inp_hoffsets, CONST iaddr *inp_voffsets, CONST unsigned char *cmap_red, CONST unsigned char *cmap_green, CONST unsigned char *cmap_blue, iaddr cmap_stride)

This routine will write a 16bit PseudoColour image into a 24bit TrueColour image using a software colourmap to convert 16bit values to 24bit RGB values. The input and output sizes may be different. The output image is flipped vertically relative to the input image.

Parameters:

- out_red_image : The output red image components will be written here.
- out_green_image : The output green image components will be written here.
- out_blue_image : The output blue image components will be written here.
- preserve_pad : If TRUE, padding bytes between output pixels will be preserved, else they may be overwritten for efficiency.
- out_hstride : The horizontal stride in bytes between output pixels.
- out_vstride : The vertical stride in bytes between output lines.
- out_width : The width of the output image.
- out_height : The height of the output image.
- inp_image : The input 16bit PseudoColour image.
- inp_hoffsets : The array of horizontal input byte offsets.
- inp_voffsets : The array of vertical input byte offsets.
- inp_width : The width of the input image.
- inp_height : The height of the input image.
- cmap_red : The red component virtual colourmap.
- cmap_green : The green component virtual colourmap.
- cmap_blue : The blue component virtual colourmap.
- cmap_stride : The stride in bytes between colourmap entries. The number of entries must be 65536 (16bit addressing).

Returns: TRUE on success, else FALSE.
Multithreading Level: Unsafe.

#### EXPERIMENTAL FUNCTION: subject to change without notice

flag imw_scmap_16to24_o (unsigned char *out_red_image, unsigned char *out_green_image, unsigned char *out_blue_image, flag preserve_pad, iaddr out_hstride, iaddr out_vstride, int width, int height,CONST unsigned short *inp_image, CONST iaddr *inp_hoffsets, CONST iaddr *inp_voffsets, CONST unsigned char *cmap_red, CONST unsigned char *cmap_green, CONST unsigned char *cmap_blue, iaddr cmap_stride)

This routine will write a 16bit PseudoColour image into a 24bit TrueColour image using a software colourmap to convert 16bit values to 24bit RGB values. The image size (in pixels) is preserved. The output image is flipped vertically relative to the input image.

Parameters:

- out_red_image : The output red image components will be written here.
- out_green_image : The output green image components will be written here.
- out_blue_image : The output blue image components will be written here.
- preserve_pad : If TRUE, padding bytes between output pixels will be preserved, else they may be overwritten for efficiency.
- out_hstride : The horizontal stride in bytes between output pixels.
- out_vstride : The vertical stride in bytes between output lines.
- width : The width of the image.
- height : The height of the image.
- inp_image : The input 16bit PseudoColour image.
- inp_hoffsets : The array of horizontal input byte offsets.
- inp_voffsets : The array of vertical input byte offsets.
- cmap_red : The red component virtual colourmap.
- cmap_green : The green component virtual colourmap.
- cmap_blue : The blue component virtual colourmap.
- cmap_stride : The stride in bytes between colourmap entries. The number of entries must be 65536 (16bit addressing).

Returns: TRUE on success, else FALSE.
Multithreading Level: Safe.

## Prototype Functions

flag imw_PROTO_iscale_func (double *out, unsigned int out_stride, CONST double *inp, unsigned int inp_stride, unsigned int num_values, double i_min, double i_max, void *info)

This routine will perform an arbitrary intensity scaling on an array of values. This routine may be called many times to scale an image.

Parameters:

- out : The output array.
- out_stride : The stride (in doubles) of the output array.
- inp : The input array.
- inp_stride : The stride (in doubles) of the input array.
- num_values : The number of values to scale.
- i_min : The minimum intensity value.
- i_max : The maximum intensity value.
- info : A pointer to arbitrary information.

Returns: TRUE on success, else FALSE.
Multithreading Level: Unsafe

Back to Karma Home Page