Mamba C API reference

Version 2.0

MB_Image.h File Reference

Go to the source code of this file.

Functions

MB_API_ENTRY MB_errcode MB_API_CALL MB_Create (MB_Image *image, Uint32 width, Uint32 height, Uint32 depth)
 
MB_API_ENTRY MB_errcode MB_API_CALL MB_Destroy (MB_Image *image)
 
MB_API_ENTRY Uint32 MB_API_CALL MB_getImageCounter (void)
 
MB_API_ENTRY MB_errcode MB_API_CALL MB_Load (MB_Image *image, PIX8 *indata, Uint32 len)
 
MB_API_ENTRY MB_errcode MB_API_CALL MB_Extract (MB_Image *image, PIX8 **outdata, Uint32 *len)
 
MB_API_ENTRY MB_errcode MB_API_CALL MB_Convert (MB_Image *src, MB_Image *dest)
 
MB_API_ENTRY MB_errcode MB_API_CALL MB_Copy (MB_Image *src, MB_Image *dest)
 
MB_API_ENTRY MB_errcode MB_API_CALL MB_CopyLine (MB_Image *src, MB_Image *dest, Uint32 insrc_pos, Uint32 indest_pos)
 
MB_API_ENTRY MB_errcode MB_API_CALL MB_CropCopy (MB_Image *src, Uint32 x_src, Uint32 y_src, MB_Image *dest, Uint32 x_dest, Uint32 y_dest, Uint32 w, Uint32 h)
 
MB_API_ENTRY MB_errcode MB_API_CALL MB_PutPixel (MB_Image *dest, Uint32 pixVal, Uint32 x, Uint32 y)
 
MB_API_ENTRY MB_errcode MB_API_CALL MB_GetPixel (MB_Image *src, Uint32 *pixVal, Uint32 x, Uint32 y)
 
MB_API_ENTRY MB_errcode MB_API_CALL MB3D_Create (MB3D_Image *image, Uint32 length)
 
MB_API_ENTRY MB_errcode MB_API_CALL MB3D_Stack (MB3D_Image *image, MB_Image *stacked, Uint32 position)
 
MB_API_ENTRY MB_errcode MB_API_CALL MB3D_Destroy (MB3D_Image *image)
 
MB_API_ENTRY MB_errcode MB_API_CALL MB3D_Convert (MB3D_Image *src, MB3D_Image *dest)
 

Function Documentation

MB_API_ENTRY MB_errcode MB_API_CALL MB3D_Convert ( MB3D_Image src,
MB3D_Image dest 
)

Converts a 3D image of a given depth into another depth. Supported conversions are: 1->8, 8->1 and 32->8 (downscaling).

Parameters
src3D source image
dest3D destination image
Returns
An error code (NO_ERR if successful)
MB_API_ENTRY MB_errcode MB_API_CALL MB3D_Create ( MB3D_Image image,
Uint32  length 
)

Creates a 3D image container. 3D images are just a list of 2D images stacked together.

Parameters
imagethe created image
lengththe length of the 3D image (number of images stacked)
Returns
an error code (NO_ERR if everything went OK).
MB_API_ENTRY MB_errcode MB_API_CALL MB3D_Destroy ( MB3D_Image image)

Destroys the 3D image (free memory).

Parameters
imagethe image to destroy
Returns
an error code.
MB_API_ENTRY MB_errcode MB_API_CALL MB3D_Stack ( MB3D_Image image,
MB_Image stacked,
Uint32  position 
)

Stack the 2D image at the given position.

Parameters
imagethe 3D image
stackedthe 2D image stacked in the 3D image
positionthe position in the 3D image of the 2D image
Returns
an error code (NO_ERR if everything went OK).
MB_API_ENTRY MB_errcode MB_API_CALL MB_Convert ( MB_Image src,
MB_Image dest 
)

Converts an image of a given depth into another depth. All possible conversions are supported.

Parameters
srcsource image
destdestination image
Returns
An error code (NO_ERR if successful)
MB_API_ENTRY MB_errcode MB_API_CALL MB_Copy ( MB_Image src,
MB_Image dest 
)

Copies an image data contents into another image. This copy works with same size images.

Parameters
srcthe source image
destthe destination image
Returns
An error code (NO_ERR if successful)
MB_API_ENTRY MB_errcode MB_API_CALL MB_CopyLine ( MB_Image src,
MB_Image dest,
Uint32  insrc_pos,
Uint32  indest_pos 
)

Copies an image line contents into another image line.

Parameters
srcthe source image
destthe destination image
insrc_posthe position of the line copied from src
indest_posthe position in dest in which the line is copied
Returns
An error code (NO_ERR if successful)
MB_API_ENTRY MB_errcode MB_API_CALL MB_Create ( MB_Image image,
Uint32  width,
Uint32  height,
Uint32  depth 
)

Creates an image (memory allocation) with the correct size and depth given as argument. The size is deduced from the requested size given in argument. The size must be a multiple of MB_ROUND_W for width and MB_ROUND_H for height. The size cannot be greater than MB_MAX_IMAGE_SIZE.

Parameters
imagethe created image
widththe width of the created image
heightthe height of the created image
depththe depth of the created image
Returns
An error code (NO_ERR if successful)
MB_API_ENTRY MB_errcode MB_API_CALL MB_CropCopy ( MB_Image src,
Uint32  x_src,
Uint32  y_src,
MB_Image dest,
Uint32  x_dest,
Uint32  y_dest,
Uint32  w,
Uint32  h 
)

Copies an image data contents into another image. This copy can work with image of different sizes. As the size can be different the position where the copy occurs must be specified for both images as well as the size of the copy. The function will compute the actual crop inside the source and destination images. Works only with non binary images.

Parameters
srcthe source image
x_srcthe x position in the source image where the copy should begin
y_srcthe y position in the source image where the copy should begin
destthe destination image
x_destthe x position in the destination image where the copy should happen
y_destthe y position in the destination image where the copy should happen
wthe width of the copy
hthe height of the copy
Returns
An error code (NO_ERR if successful)
MB_API_ENTRY MB_errcode MB_API_CALL MB_Destroy ( MB_Image image)

Destroys an image (memory freeing).

Parameters
imagethe image to be destroyed
Returns
An error code (NO_ERR if successful)
MB_API_ENTRY MB_errcode MB_API_CALL MB_Extract ( MB_Image image,
PIX8 **  outdata,
Uint32 len 
)

Reads an image data contents and put it in an array.

Parameters
imagethe image to read
outdatapointer to the array created (malloc) and filled with the pixel data of the image
lenthe length in bytes of data extracted (0 if an error occured)
Returns
An error code (NO_ERR if successful)
MB_API_ENTRY Uint32 MB_API_CALL MB_getImageCounter ( void  )
Returns
the number of image that have been allocated so far
MB_API_ENTRY MB_errcode MB_API_CALL MB_GetPixel ( MB_Image src,
Uint32 pixVal,
Uint32  x,
Uint32  y 
)

Gets the pixel value inside the image at the given position.

Parameters
srcthe image
pixValthe returned pixel value
xposition in x of the pixel targeted
yposition in y of the pixel targeted
Returns
An error code (NO_ERR if successful)
MB_API_ENTRY MB_errcode MB_API_CALL MB_Load ( MB_Image image,
PIX8 indata,
Uint32  len 
)

Loads an image data with data given in argument.

Parameters
imagethe image to fill
indatathe data to fill the image with (complete pixels values)
lenthe length of data given
Returns
An error code (NO_ERR if successful)
MB_API_ENTRY MB_errcode MB_API_CALL MB_PutPixel ( MB_Image dest,
Uint32  pixVal,
Uint32  x,
Uint32  y 
)

Puts the pixel value inside the image at the given position.

Parameters
destthe image
pixValthe pixel value
xposition in x of the pixel targeted
yposition in y of the pixel targeted
Returns
An error code (NO_ERR if successful)