Picasso API  2.8
Typedefs | Functions
XImage Functions

Typedefs

typedef int(* image_writer_fn) (void *param, const ps_byte *data, size_t length)
 Callback function for saving image data.
 

Functions

PEXPORT int PICAPI psx_image_init (void)
 Initialze the library and load resources. More...
 
PEXPORT int PICAPI psx_image_shutdown (void)
 Release resources and shutdoen. More...
 
PEXPORT psx_image *PICAPI psx_image_create_from_data (ps_byte *data, ps_color_format fmt, int width, int height, int pitch, int *err_code)
 Create a new psx_image using a copy of given address in memory. More...
 
PEXPORT psx_image *PICAPI psx_image_load (const char *file_name, int *err_code)
 Create a new psx_image object and load from file. More...
 
PEXPORT psx_image *PICAPI psx_image_load_from_memory (const ps_byte *data, size_t length, int *err_code)
 Create a new psx_image object and load data from memory. More...
 
PEXPORT int PICAPI psx_image_save (const psx_image *image, image_writer_fn func, void *param, const char *type, float quality)
 Encoding psx_image to a gaving format and output it. More...
 
PEXPORT int PICAPI psx_image_save_to_file (const psx_image *image, const char *file_name, const char *type, float quality)
 Encoding psx_image to a gaving format and output to a file. More...
 
PEXPORT int PICAPI psx_image_destroy (psx_image *image)
 Destroy the psx_image object and release resources. More...
 

Detailed Description

Function Documentation

◆ psx_image_create_from_data()

psx_image * psx_image_create_from_data ( ps_byte data,
ps_color_format  fmt,
int  width,
int  height,
int  pitch,
int *  err_code 
)

Create a new psx_image using a copy of given address in memory.

Parameters
dataA pointer to the destination in memory where the drawing is to be rendered. The size of this memory block should be at least (pitch * height) bytes.
fmtThe Pixel format to use for the image.
widthThe width, in pixels, of the required image.
heightThe height, in pixels, of the required image.
pitchThe number of bytes per row, of the required image.
err_codePointer to a value to receiving the result code. can be NULL.
Returns
If the function succeeds, the return value is the pointer to a new psx_image object. If the function fails, the return value is NULL.
See also
psx_image_load psx_image_load_from_memory psx_image_destroy

◆ psx_image_destroy()

int psx_image_destroy ( psx_image image)

Destroy the psx_image object and release resources.

Parameters
imagePointer to an existing psx_image object.
Returns
Result code returned.
See also
psx_image_load psx_image_load_from_memory

◆ psx_image_init()

int psx_image_init ( void  )

Initialze the library and load resources.

Returns
Result code returned.
See also
psx_image_shutdown

◆ psx_image_load()

psx_image * psx_image_load ( const char *  file_name,
int *  err_code 
)

Create a new psx_image object and load from file.

Parameters
file_nameThe image file path which will be loaded, which is encoded by utf8.
err_codePointer to a value to receiving the result code. can be NULL.
Returns
If successs, the return value is the pointer to new psx_image object. If fails, the return value is NULL, and result will be return by err_code.
See also
psx_image_destroy psx_image_load_from_memory psx_image_create_from_data

◆ psx_image_load_from_memory()

psx_image * psx_image_load_from_memory ( const ps_byte data,
size_t  length,
int *  err_code 
)

Create a new psx_image object and load data from memory.

Parameters
dataPointer to data buffer in memeory.
lengthData length bytes.
err_codePointer to a value to receiving the result code. can be NULL.
Returns
If successs, the return value is the pointer to new psx_image object. If fails, the return value is NULL, and result will be return by err_code.
See also
psx_image_destroy psx_image_load

◆ psx_image_save()

int psx_image_save ( const psx_image image,
image_writer_fn  func,
void *  param,
const char *  type,
float  quality 
)

Encoding psx_image to a gaving format and output it.

Parameters
imagePointer to an psx_image object.
funcUser define saving callback function.
paramUser define saving callback param.
typeImage type short name. (i.e "png" "jpg" "bmp")
qualityImage encoding quality. (0.1 ~ 1.0)
Returns
Result code returned.
See also
psx_image_save_to_file

◆ psx_image_save_to_file()

int psx_image_save_to_file ( const psx_image image,
const char *  file_name,
const char *  type,
float  quality 
)

Encoding psx_image to a gaving format and output to a file.

Parameters
imagePointer to an psx_image object.
file_nameThe image file path which will be output, which is encoded by utf8.
typeImage type short name. (i.e "png" "jpg" "bmp")
qualityImage encoding quality. (0.1 ~ 1.0)
Returns
Result code returned.
See also
psx_image_save

◆ psx_image_shutdown()

int psx_image_shutdown ( void  )

Release resources and shutdoen.

Returns
Result code returned.
See also
psx_image_init