LibCapy - image

2D image class.

Macros:

Definition of the dimensions of an image

Definition of a position in the image (from left to right and top to bottom)

Shortcuts for CapyImgCreate()

Shortcuts for CapyImgAlloc()

Enumerations:

Enumeration of image modes

Enumeration to identify the neighours of a pixel

Enumeration for the types of iterator on a CapyImg

Typedefs:

Type for the size of an image (choosen to match png_uint_32)

Dimensions of an image

Type to store a pixel coordinate (should be the signed version of CapyImgDims_t)

Position in the image (from left to right and top to bottom)

CapyImg object predeclaration

CapyImg object

Struct CapyImgPixel :

Struct CapyImgPixel's properties:

Position

Index in the array of pixels

Color data

Struct CapyImgPixel's methods:

None.

Struct CapyImgIterator :

Struct CapyImgIterator's properties:

Index of the current step in the iteration

Returned data type

Current pixel of the iteration

Type of iteration

Image associated to the iteration

Struct CapyImgIterator's methods:

Destructor

Reset the iterator

Output and side effect(s):

Return the first pixel of the iteration

Move the iterator to the previous pixel

Output and side effect(s):

Return the previous pixel of the iteration

Move the iterator to the next pixel

Output and side effect(s):

Return the next pixel of the iteration

Check if the iterator is on a valid pixel

Output and side effect(s):

Return true if the iterator is on a valid pixel, else false

Get the current pixel of the iteration

Output and side effect(s):

Return a pointer to the current pixel

Set the type of the iterator and reset it

Input argument(s):

type: the new type of the iterator

Functions:

Create an iterator on a CapyImg

Input argument(s):

img: the image on which to iterate
type: the type of iterator

Output and side effect(s):

Return the iterator

Allocate memory and create an iterator on a CapyImg

Input argument(s):

img: the image on which to iterate
type: the type of iterator

Output and side effect(s):

Return the iterator

Free the memory used by a pointer to an iterator and reset '*that' to NULL

Input argument(s):

that: a pointer to the iterator to free

Create a CapyImg of given dimensions and mode

Input argument(s):

mode: mode of the image
dims: dimensions of the image

Output and side effect(s):

Return a CapyImg initialised to rgba opaque white

Exception(s):

May raise CapyExc_MallocFailed.

Allocate memory for a new CapyImg and create it

Input argument(s):

mode: mode of the image
dims: dimensions of the image

Output and side effect(s):

Return a CapyImg initialised to rgba opaque white

Exception(s):

May raise CapyExc_MallocFailed.

Load an image to a given path

Input argument(s):

path: the path to the image

Output and side effect(s):

Return a new image.

Exception(s):

May raise CapyExc_MallocFailed, CapyExc_UnsupportedFormat.

Allocate memory and create a clone of an image

Input argument(s):

img: the image to clone

Output and side effect(s):

Return a clone of the image in argument

Exception(s):

May raise CapyExc_MallocFailed.

Free the memory used by a CapyImg* and reset '*that' to NULL

Input argument(s):

that: a pointer to the CapyImg to free

Convert from cm to pixels given a dpi

Input argument(s):

length: the length in centimeter to convert
dpi: the dpi used to convert

Output and side effect(s):

Return the converted length.

Convert from pixels to cm given a dpi

Input argument(s):

length: the length in pixels to convert
dpi: the dpi used to convert

Output and side effect(s):

Return the converted length.

2021-10-21
in LibCapy,
90 views
Copyright 2021-2024 Baillehache Pascal