|
libsdfio 1.0.0
Reader and writer for ISO 25178-71 SDF surface data files in C
|
Layout of a buffer in memory. More...
Go to the source code of this file.
Data Structures | |
| struct | sdfio_layout |
| Description of a buffer of the caller for heights or for the values of the data area: the type of its elements, and how the matrix lies in memory. More... | |
Typedefs | |
| typedef struct sdfio_layout | sdfio_layout |
| Description of a buffer of the caller for heights or for the values of the data area: the type of its elements, and how the matrix lies in memory. | |
Functions | |
| void | sdfio_layout_init (sdfio_layout *layout) |
| Initializes a layout of a plain array of float elements: the elements follow each other and the rows follow each other. | |
| const sdfio_layout * | sdfio_layout_packed (sdfio_data_type type) |
| Returns the layout of a plain array: the elements follow each other and the rows follow each other. | |
Layout of a buffer in memory.
A layout lets the functions transfer a matrix in place when it is part of something else: a member of a structure, a column-major matrix or a matrix upside down.
| typedef struct sdfio_layout sdfio_layout |
Description of a buffer of the caller for heights or for the values of the data area: the type of its elements, and how the matrix lies in memory.
The element (y, x) is at data + y * row_stride + x * element_stride. Both strides can be negative. They must keep the elements apart: either the rows or the columns must not overlap. This allows heights and values to be read or written in place where they are not contiguous, for example the z member of an array of points, one channel of an interleaved image or a column-major matrix. sdfio_layout_packed() describes a plain array. Without an initializer, call sdfio_layout_init() before assigning fields.
The structure is frozen for the major version: it has these three fields and a new property of a buffer is a new function.
| void sdfio_layout_init | ( | sdfio_layout * | layout | ) |
Initializes a layout of a plain array of float elements: the elements follow each other and the rows follow each other.
The caller sets the type and every other field that differs.
| [out] | layout | The layout to initialize. |
| const sdfio_layout * sdfio_layout_packed | ( | sdfio_data_type | type | ) |
Returns the layout of a plain array: the elements follow each other and the rows follow each other.
The layout is a constant of the library, valid for the life of the program, and the same for every thread. Other strides require a copy of it, or sdfio_layout_init().
| type | The type of the elements: SDFIO_TYPE_FLOAT or SDFIO_TYPE_DOUBLE for heights, and the data type of the file for the values of the data area. |