|
TPCCLIB
|
Functions for reading and writing pixel definition files. More...
#include "libtpcimgio.h"Go to the source code of this file.
Functions | |
| void | pxlInit (IMG_PIXELS *pxl) |
| void | pxlFree (IMG_PIXELS *pxl) |
| int | pxlAllocate (IMG_PIXELS *pxl, long long int pxlNr) |
| int | pxlAllocateMore (IMG_PIXELS *pxl, long long int pxlNr) |
| int | pxlMakeRoom (IMG_PIXELS *list, long long int i, long long int n) |
| int | pxlAdd (IMG_PIXELS *list, IMG_PIXEL *pxl) |
| int | pxlGet (IMG_PIXELS *list, long long int i, IMG_PIXEL *pxl) |
| long long int | pxlAddFromMask (IMG_PIXELS *list, IMG *img) |
| void | pxlMove (IMG_PIXELS *list, long long int from, long long int to) |
| int | pxlRm (IMG_PIXELS *list, long long int index) |
| long long int | pxlRmDuplicates (IMG_PIXELS *list) |
| int | pxlWrite (IMG_PIXELS *pxl, FILE *fp, char *status) |
| int | pxlRead (IMG_PIXELS *pxl, const char *fname, char *status) |
Functions for reading and writing pixel definition files.
Definition in file pixel.c.
| int pxlAdd | ( | IMG_PIXELS * | list, |
| IMG_PIXEL * | pxl ) |
Add given pixel into IMG_PIXELS data.
| list | Pointer to IMG_PIXELS struct, which must be initiated. Memory is added if needed, and pxlNr increased. |
| pxl | Pointer to IMG_PIXEL struct to add. |
Definition at line 139 of file pixel.c.
Referenced by imgMaskFloodFill().
| long long int pxlAddFromMask | ( | IMG_PIXELS * | list, |
| IMG * | img ) |
Add pixel(s) from mask image into IMG_PIXELS data.
| list | Pointer to IMG_PIXELS struct, which must be initiated. Memory is added if needed, and pxlNr increased. |
| img | Pointer to mask image. |
Definition at line 185 of file pixel.c.
| int pxlAllocate | ( | IMG_PIXELS * | pxl, |
| long long int | pxlNr ) |
Allocate memory for IMG_PIXELS data. Any previous contents are deleted. Return Returns 0 when successful.
| pxl | Pointer to initiated IMG_PIXELS struct data; any old contents are deleted. pxlNr inside the struct is set to or kept at zero. |
| pxlNr | Nr of pixels to allocate |
Definition at line 44 of file pixel.c.
Referenced by pxlAllocateMore().
| int pxlAllocateMore | ( | IMG_PIXELS * | pxl, |
| long long int | pxlNr ) |
Allocate memory for more IMG_PIXELS data. Any previous contents are preserved. Return Returns 0 when successful.
| pxl | Pointer to initiated IMG_PIXELS struct data; any old contents are preserved, but existing data is not required. pxlNr inside the struct is set to or kept at zero. |
| pxlNr | Nr of additional pixels to allocate; if struct contains unused space for requested pixels already, then nothing is done. |
Definition at line 74 of file pixel.c.
Referenced by pxlAdd(), pxlAddFromMask(), pxlMakeRoom(), and pxlRead().
| void pxlFree | ( | IMG_PIXELS * | pxl | ) |
Free memory allocated for IMG_PIXELS. All data is cleared.
| pxl | Pointer to IMG_PIXELS struct |
Definition at line 28 of file pixel.c.
Referenced by imgMaskFloodFill(), and pxlAllocate().
| int pxlGet | ( | IMG_PIXELS * | list, |
| long long int | i, | ||
| IMG_PIXEL * | pxl ) |
Get a pixel from IMG_PIXELS list.
| list | Pointer to IMG_PIXELS struct, containing the list of pixels. |
| i | Pixel list index [0..list->pxlNr-1]. |
| pxl | Pointer to IMG_PIXEL struct into which pixel coordinates are written. |
Definition at line 163 of file pixel.c.
Referenced by imgMaskFloodFill().
| void pxlInit | ( | IMG_PIXELS * | pxl | ) |
Initiate the IMG_PIXELS struct before any use.
| pxl | Pointer to IMG_PIXELS |
Definition at line 14 of file pixel.c.
Referenced by imgMaskFloodFill(), and pxlFree().
| int pxlMakeRoom | ( | IMG_PIXELS * | list, |
| long long int | i, | ||
| long long int | n ) |
Make room for new pixels in the IMG_PIXELS list, allocating more memory if needed. Previous contents are preserved but moved in the list.
| list | Pointer to IMG_PIXELS struct with existing contents. |
| i | Index [0..pxlNr] of the new room start position. |
| n | Nr of empty list items to add. |
Definition at line 110 of file pixel.c.
Referenced by imgMaskFloodFill().
| void pxlMove | ( | IMG_PIXELS * | list, |
| long long int | from, | ||
| long long int | to ) |
Move pixel from one slot to another inside IMG_PIXELS data, changing the position of others accordingly.
| list | Pointer to IMG_PIXELS struct, which must be initiated. |
| from | Index [0.._pxlNr-1] of source position. |
| to | Index [0.._pxlNr-1] of target position. |
Definition at line 220 of file pixel.c.
Referenced by pxlRm().
| int pxlRead | ( | IMG_PIXELS * | pxl, |
| const char * | fname, | ||
| char * | status ) |
Read IMG_PIXELS data from specified file.
| pxl | Pointer to IMG_PIXELS struct, into which contents of file are to be added; call pxlInit() once before using this function. |
| fname | Pointer to the file name; this string is not modified. |
| status | Pointer to a string (allocated for at least 64 chars) where error message or other execution status will be written; enter NULL, if not needed |
Definition at line 331 of file pixel.c.
| int pxlRm | ( | IMG_PIXELS * | list, |
| long long int | index ) |
Remove specified pixel from IMG_PIXELS data.
| list | Pointer to IMG_PIXELS struct, which must be initiated. Allocated memory is not reduced, but pxlNr is decreased. |
| index | Index [0..pxlNr-1] of pixel to delete. |
Definition at line 249 of file pixel.c.
Referenced by pxlRmDuplicates().
| long long int pxlRmDuplicates | ( | IMG_PIXELS * | list | ) |
Remove duplicates from IMG_PIXELS data.
| list | Pointer to IMG_PIXELS struct, which must be initiated. Allocated memory is not reduced, but pxlNr is decreased. |
Definition at line 273 of file pixel.c.
| int pxlWrite | ( | IMG_PIXELS * | pxl, |
| FILE * | fp, | ||
| char * | status ) |
Write IMG_PIXELS data into specified file.
| pxl | Pointer to IMG_PIXELS struct, contents of which are to be written |
| fp | Output file pointer |
| status | Pointer to a string (allocated for at least 64 chars) where error message or other execution status will be written; enter NULL, if not needed |
Definition at line 299 of file pixel.c.