Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

array

The array is a simple "two-dimensional array of numbers" data structure. More...

Typedefs

typedef stp_array stp_array_t
 The array opaque data type.


Functions

stp_array_tstp_array_create (int x_size, int y_size)
 Create a new array.

void stp_array_destroy (stp_array_t *array)
 Destroy an array.

void stp_array_copy (stp_array_t *dest, const stp_array_t *source)
 Copy an array.

stp_array_tstp_array_create_copy (const stp_array_t *array)
 Copy and allocate an array.

void stp_array_set_size (stp_array_t *array, int x_size, int y_size)
 Resize an array.

void stp_array_get_size (const stp_array_t *array, int *x_size, int *y_size)
 Get the size of an array.

void stp_array_set_data (stp_array_t *array, const double *data)
 Set the data in an array.

void stp_array_get_data (const stp_array_t *array, size_t *size, const double **data)
 Get the data in an array.

int stp_array_set_point (stp_array_t *array, int x, int y, double data)
 Set the data at a single point in the array.

int stp_array_get_point (const stp_array_t *array, int x, int y, double *data)
 Get the data at a single point in the array.

const stp_sequence_tstp_array_get_sequence (const stp_array_t *array)
 Get the underlying stp_sequence_t.


Detailed Description

The array is a simple "two-dimensional array of numbers" data structure.

array "inherits" from the sequence data structure (implemented via containment).


Typedef Documentation

typedef struct stp_array stp_array_t
 

The array opaque data type.

Definition at line 52 of file array.h.

Referenced by array_ctor(), array_dtor(), check_array(), stp_array_copy(), stp_array_create(), stp_array_create_copy(), stp_array_create_from_xmltree(), stp_array_destroy(), stp_array_get_data(), stp_array_get_point(), stp_array_get_sequence(), stp_array_get_size(), stp_array_set_data(), stp_array_set_point(), stp_array_set_size(), stp_dither_init(), stp_dither_matrix_init_from_dither_array(), stp_dither_matrix_validate_array(), stp_dither_set_matrix_from_dither_array(), stp_find_standard_dither_array(), stp_printer_create_from_xmltree(), stp_set_array_parameter(), stp_set_default_array_parameter(), stp_xml_get_dither_array(), stp_xmltree_create_from_array(), and stpi_dither_array_create_from_file().


Function Documentation

void stp_array_copy stp_array_t dest,
const stp_array_t source
 

Copy an array.

Both dest and source must be valid arrays previously created with stp_array_create().

Parameters:
dest the destination array.
source the source array.

Definition at line 94 of file array.c.

References check_array(), stp_array::data, stp_array_t, stp_sequence_create_copy(), stp_sequence_destroy(), stp_array::x_size, and stp_array::y_size.

Referenced by stp_array_create_copy().

stp_array_t* stp_array_create int  x_size,
int  y_size
 

Create a new array.

The total size of the array will be (x_size * y_size).

Parameters:
x_size the number of "columns".
y_size the number of "rows".
Returns:
the newly created array.

Definition at line 65 of file array.c.

References array_ctor(), stp_array::data, stp_array_t, stp_zalloc(), stp_array::x_size, and stp_array::y_size.

Referenced by stp_array_create_copy(), and stp_array_create_from_xmltree().

stp_array_t* stp_array_create_copy const stp_array_t array  ) 
 

Copy and allocate an array.

dest will be created, and then the contents of source will be copied into it. dest must not have been previously allocated with stp_array_create().

Parameters:
array the source array.
Returns:
the new copy of the array.

Definition at line 107 of file array.c.

References check_array(), stp_array_copy(), stp_array_create(), and stp_array_t.

Referenced by stp_set_array_parameter(), stp_set_default_array_parameter(), stp_xml_get_dither_array(), and value_copy().

void stp_array_destroy stp_array_t array  ) 
 

Destroy an array.

It is an error to destroy the array more than once.

Parameters:
array the array to destroy.

Definition at line 86 of file array.c.

References array_dtor(), check_array(), stp_array_t, and stp_free().

Referenced by stp_array_create_from_xmltree(), stp_dither_init(), stp_parameter_description_destroy(), stp_printer_create_from_xmltree(), stp_set_array_parameter(), and value_freefunc().

void stp_array_get_data const stp_array_t array,
size_t *  size,
const double **  data
 

Get the data in an array.

Parameters:
array the array to get the data from.
size the number of elements in the array (x_size * y_size) are stored in the size_t pointed to.
data a pointer to the first element of an array of doubles is stored in a pointer to double*.
stp_array_t *array; size_t size; double *data; stp_array_get_data(array, &size, &data);

Definition at line 147 of file array.c.

References check_array(), stp_array::data, stp_array_t, and stp_sequence_get_data().

int stp_array_get_point const stp_array_t array,
int  x,
int  y,
double *  data
 

Get the data at a single point in the array.

Parameters:
array the array to use.
x the x location.
y the y location.
data the datum is stored in the double pointed to.
Returns:
1 on success, 0 on failure.

Definition at line 164 of file array.c.

References check_array(), stp_array::data, stp_array_t, stp_sequence_get_point(), stp_array::x_size, and stp_array::y_size.

const stp_sequence_t* stp_array_get_sequence const stp_array_t array  ) 
 

Get the underlying stp_sequence_t.

Parameters:
array the array to use.
Returns:
the (constant) stp_sequence_t.

Definition at line 175 of file array.c.

References check_array(), stp_array::data, and stp_array_t.

Referenced by stp_dither_matrix_init_from_dither_array(), stp_dither_matrix_validate_array(), and stp_xmltree_create_from_array().

void stp_array_get_size const stp_array_t array,
int *  x_size,
int *  y_size
 

Get the size of an array.

The current x and y sizes are stored in the integers pointed to by x_size and y_size.

Parameters:
array the array to get the size of.
x_size a pointer to an integer to store the x size in.
y_size a pointer to an integer to store the y size in.

Definition at line 130 of file array.c.

References check_array(), stp_array_t, stp_array::x_size, and stp_array::y_size.

Referenced by stp_dither_matrix_init_from_dither_array(), and stp_xmltree_create_from_array().

void stp_array_set_data stp_array_t array,
const double *  data
 

Set the data in an array.

Parameters:
array the array to set.
data a pointer to the first member of an array containing the data to set. This array must be at least as long as (x_size * y_size).

Definition at line 139 of file array.c.

References check_array(), stp_array::data, stp_array_t, stp_sequence_set_data(), stp_array::x_size, and stp_array::y_size.

int stp_array_set_point stp_array_t array,
int  x,
int  y,
double  data
 

Set the data at a single point in the array.

Parameters:
array the array to use.
x the x location.
y the y location.
data the datum to set.
Returns:
1 on success, 0 on failure.

Definition at line 154 of file array.c.

References check_array(), stp_array::data, stp_array_t, stp_sequence_set_point(), stp_array::x_size, and stp_array::y_size.

void stp_array_set_size stp_array_t array,
int  x_size,
int  y_size
 

Resize an array.

Resizing an array will destroy all data stored in the array.

Parameters:
array the array to resize.
x_size the new number of "columns".
y_size the new number of "rows".

Definition at line 118 of file array.c.

References check_array(), stp_array::data, stp_array_t, stp_sequence_create(), stp_sequence_destroy(), stp_sequence_set_size(), stp_array::x_size, and stp_array::y_size.


Generated on Wed Aug 25 07:56:17 2004 for libgimpprint API Reference by doxygen 1.3.6