spandsp 0.0.6
image_translate.h File Reference

Go to the source code of this file.

Typedefs

typedef struct image_translate_state_s image_translate_state_t
 

Enumerations

enum  {
  IMAGE_TRANSLATE_FROM_MONO = 1 , IMAGE_TRANSLATE_FROM_GRAY_8 = 2 , IMAGE_TRANSLATE_FROM_GRAY_16 = 3 , IMAGE_TRANSLATE_FROM_COLOUR_8 = 4 ,
  IMAGE_TRANSLATE_FROM_COLOUR_16 = 5
}
 

Functions

int image_translate_row (image_translate_state_t *s, uint8_t buf[], size_t len)
 Get the next row of a translated image. More...
 
int image_translate_get_output_width (image_translate_state_t *s)
 Get the width of the image being produced by an image translation context. More...
 
int image_translate_get_output_length (image_translate_state_t *s)
 Get the length of the image being produced by an image translation context. More...
 
image_translate_state_timage_translate_init (image_translate_state_t *s, int input_format, int input_width, int input_length, int output_width, t4_row_read_handler_t row_read_handler, void *row_read_user_data)
 Initialise an image translation context for rescaling and squashing a gray scale or colour image to a bi-level FAX type image. More...
 
int image_translate_release (image_translate_state_t *s)
 Release the resources associated with an image translation context. More...
 
int image_translate_free (image_translate_state_t *s)
 Free the resources associated with an image translation context. More...
 

Function Documentation

◆ image_translate_free()

int image_translate_free ( image_translate_state_t s)

Free the resources associated with an image translation context.

Parameters
sThe image translation context.
Returns
0 for success, otherwise -1.

References image_translate_release().

◆ image_translate_get_output_length()

int image_translate_get_output_length ( image_translate_state_t s)

Get the length of the image being produced by an image translation context.

Parameters
sThe image translation context.
Returns
The length of the output image, in pixel.

◆ image_translate_get_output_width()

int image_translate_get_output_width ( image_translate_state_t s)

Get the width of the image being produced by an image translation context.

Parameters
sThe image translation context.
Returns
The width of the output image, in pixel.

◆ image_translate_init()

image_translate_state_t * image_translate_init ( image_translate_state_t s,
int  input_format,
int  input_width,
int  input_length,
int  output_width,
t4_row_read_handler_t  row_read_handler,
void *  row_read_user_data 
)

Initialise an image translation context for rescaling and squashing a gray scale or colour image to a bi-level FAX type image.

Parameters
sThe image translation context.
input_formatx
input_widthThe width of the source image, in pixels.
input_lengthThe length of the source image, in pixels.
output_widthThe width of the output image, in pixels. The length of the output image will be derived automatically from this and the source image dimension, to main the geometry of the original image.
row_read_handlerA callback routine used to pull rows of pixels from the source image into the translation process.
row_read_user_dataAn opaque point passed to read_row_handler
Returns
A pointer to the context, or NULL if there was a problem.

◆ image_translate_release()

int image_translate_release ( image_translate_state_t s)

Release the resources associated with an image translation context.

Parameters
sThe image translation context.
Returns
0 for success, otherwise -1.

Referenced by image_translate_free().

◆ image_translate_row()

int image_translate_row ( image_translate_state_t s,
uint8_t  buf[],
size_t  len 
)

Get the next row of a translated image.

Parameters
sThe image translation context.
Returns
the length of the row buffer, in bytes