mlib_imageresetstruct(3mlib) [sunos man page]
mlib_ImageResetStruct(3MLIB) mlib_ImageResetStruct(3MLIB) NAME
mlib_ImageResetStruct - reset image data structure SYNOPSIS
cc [ flag... ] file... -lmlib [ library... ] #include <mlib.h> mlib_status mlib_ImageResetStruct(mlib_image *image, mlib_type type, mlib_s32 channels, mlib_s32 width, mlib_s32 height, mlib_s32 stride, const void *datbuf); The mlib_ImageResetStruct() function resets a mediaLib image data structure using parameters supplied by the user. The mlib_ImageResetStruct() function returns MLIB_FAILURE if the supplied parameters do not pass the following sanity checks: o image should not be NULL o type should be MLIB_BIT, MLIB_BYTE, MLIB_SHORT, MLIB_USHORT, MLIB_INT, MLIB_FLOAT, or MLIB_DOUBLE o channels should be between 1 and 4 o width should be greater than 0 o height should be greater than 0 o stride should be no less than width * channels * (size of type in bytes) Whenever MLIB_FAILURE is returned, the original image data structure is not changed. When datbuf is NULL, the original data buffer is reused. If mlib_ImageIsUserAllocated(image)==0, such as the case the image data structure was created by mlib_ImageCreate(), and the data buffer size required by the parameters supplied is larger than the original, MLIB_FAILURE is returned. When datbuf is not NULL, if mlib_ImageIsUserAllocated(image)==0, the original data buffer is freed, otherwise the original data buffer is not freed. If datbuf points to the original data buffer, it is not freed. The function takes the following arguments: image Pointer to the image data structure. type Image data type. It can be MLIB_BIT, MLIB_BYTE, MLIB_SHORT, MLIB_USHORT, MLIB_INT, MLIB_FLOAT, or MLIB_DOUBLE. channels Number of channels in the image. width Width of image in pixels. height Height of image in pixels. stride Stride of each row of the data space in bytes. datbuf Pointer to the image data buffer. MLIB_SUCCESS is returned if the image data structure is reset successfully. MLIB_FAILURE is returned when the image data structure can not be reset according to the parameters supplied. See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Evolving | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ mlib_ImageCreate(3MLIB), mlib_ImageCreateSubimage(3MLIB), mlib_ImageCreateStruct(3MLIB), mlib_ImageSetStruct(3MLIB), mlib_ImageDelete(3MLIB), mlib_ImageSetFormat(3MLIB), mlib_ImageSetPaddings(3MLIB), attributes(5) 1 Mar 2005 mlib_ImageResetStruct(3MLIB)
Check Out this Related Man Page
mlib_ImageDataTypeConvert(3MLIB) mediaLib Library Functions mlib_ImageDataTypeConvert(3MLIB) NAME
mlib_ImageDataTypeConvert - data type conversion SYNOPSIS
cc [ flag... ] file... -lmlib [ library... ] #include <mlib.h> mlib_status mlib_ImageDataTypeConvert(mlib_image *dst, const mlib_image *src); DESCRIPTION
The mlib_ImageDataTypeConvert() function converts between data types MLIB_BIT, MLIB_BYTE, MLIB_SHORT, MLIB_USHORT, MLIB_INT, MLIB_FLOAT, and MLIB_DOUBLE. The input and output data images must have the same width, height, and number of channels. Conversion to a smaller pixel format clamps the source value to the dynamic range of the destination pixel. See the following table for available variations of the data type conversion function. Source Type Dest. Type Action MLIB_BYTE MLIB_BIT (x > 0) ? 1 : 0 MLIB_SHORT MLIB_BIT (x > 0) ? 1 : 0 MLIB_USHORT MLIB_BIT (x > 0) ? 1 : 0 MLIB_INT MLIB_BIT (x > 0) ? 1 : 0 MLIB_FLOAT MLIB_BIT (x > 0) ? 1 : 0 MLIB_DOUBLE MLIB_BIT (x > 0) ? 1 : 0 MLIB_BIT MLIB_BYTE (x == 1) ? 1 : 0 MLIB_SHORT MLIB_BYTE (mlib_u8)clamp(x, 0, 255) MLIB_USHORT MLIB_BYTE (mlib_u8)clamp(x, 0, 255) MLIB_INT MLIB_BYTE (mlib_u8)clamp(x, 0, 255) MLIB_FLOAT MLIB_BYTE (mlib_u8)clamp(x, 0, 255) MLIB_DOUBLE MLIB_BYTE (mlib_u8)clamp(x, 0, 255) MLIB_BIT MLIB_SHORT (x == 1) ? 1 : 0 MLIB_BYTE MLIB_SHORT (mlib_s16)x MLIB_USHORT MLIB_SHORT (mlib_s16)clamp(x, -32768, 32767) MLIB_INT MLIB_SHORT (mlib_s16)clamp(x, -32768, 32767) MLIB_FLOAT MLIB_SHORT (mlib_s16)clamp(x, -32768, 32767) MLIB_DOUBLE MLIB_SHORT (mlib_s16)clamp(x, -32768, 32767) MLIB_BIT MLIB_USHORT (x == 1) ? 1 : 0 MLIB_BYTE MLIB_USHORT (mlib_u16)x MLIB_SHORT MLIB_USHORT (mlib_u16)clamp(x, 0, 65535) MLIB_INT MLIB_USHORT (mlib_u16)clamp(x, 0, 65535) MLIB_FLOAT MLIB_USHORT (mlib_u16)clamp(x, 0, 65535) MLIB_DOUBLE MLIB_USHORT (mlib_u16)clamp(x, 0, 65535) MLIB_BIT MLIB_INT (x == 1) ? 1 : 0 MLIB_BYTE MLIB_INT (mlib_s32)x MLIB_SHORT MLIB_INT (mlib_s32)x MLIB_USHORT MLIB_INT (mlib_s32)x MLIB_FLOAT MLIB_INT (mlib_s32)clamp(x, -2147483647-1, 2147483647) MLIB_DOUBLE MLIB_INT (mlib_s32)clamp(x, -2147483647-1, 2147483647) MLIB_BIT MLIB_FLOAT (x == 1) ? 1.0 : 0.0 MLIB_BYTE MLIB_FLOAT (mlib_f32)x MLIB_SHORT MLIB_FLOAT (mlib_f32)x MLIB_USHORT MLIB_FLOAT (mlib_f32)x MLIB_INT MLIB_FLOAT (mlib_f32)x MLIB_DOUBLE MLIB_FLOAT (mlib_f32)x MLIB_BIT MLIB_DOUBLE (x == 1) ? 1.0 : 0.0 MLIB_BYTE MLIB_DOUBLE (mlib_d64)x MLIB_SHORT MLIB_DOUBLE (mlib_d64)x MLIB_USHORT MLIB_DOUBLE (mlib_d64)x MLIB_INT MLIB_DOUBLE (mlib_d64)x MLIB_FLOAT MLIB_DOUBLE (mlib_d64)x The actions are defined in C-style pseudo-code. All type casts follow the rules of standard C. clamp() can be defined as a macro: #define clamp(x, low, high) (((x) < (low)) ? (low) : (((x) > (high)) ? (high) : (x))) PARAMETERS
The function takes the following arguments: dst Pointer to destination image. src Pointer to source image. RETURN VALUES
The function returns MLIB_SUCCESS if successful. Otherwise it returns MLIB_FAILURE. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Evolving | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ SEE ALSO
mlib_ImageReformat(3MLIB), attributes(5) SunOS 5.10 9 Nov 2004 mlib_ImageDataTypeConvert(3MLIB)