Picasso API  2.8
Typedefs | Enumerations | Functions

Typedefs

typedef enum _ps_color_format ps_color_format
 Pixel formats of canvas or image.
 

Enumerations

enum  _ps_color_format {
  COLOR_FORMAT_RGBA, COLOR_FORMAT_ARGB, COLOR_FORMAT_ABGR, COLOR_FORMAT_BGRA,
  COLOR_FORMAT_RGB, COLOR_FORMAT_BGR, COLOR_FORMAT_RGB565, COLOR_FORMAT_RGB555,
  COLOR_FORMAT_UNKNOWN
}
 Pixel formats of canvas or image. More...
 

Functions

PEXPORT ps_canvas *PICAPI ps_canvas_create (ps_color_format fmt, int width, int height)
 Create a new canvas using the given parameters. More...
 
PEXPORT ps_canvas *PICAPI ps_canvas_create_with_data (ps_byte *data, ps_color_format fmt, int width, int height, int pitch)
 Create a new canvas using a given address in memory. More...
 
PEXPORT ps_canvas *PICAPI ps_canvas_create_compatible (const ps_canvas *canvas, int width, int height)
 Create a new canvas to compatible with an existing canvas. More...
 
PEXPORT ps_canvas *PICAPI ps_canvas_create_from_canvas (ps_canvas *canvas, const ps_rect *rect)
 Create a new canvas using part of an existing canvas in same pixel buffer. More...
 
PEXPORT ps_canvas *PICAPI ps_canvas_create_from_image (ps_image *img, const ps_rect *rect)
 Create a new canvas using part of an existing ps_image object in same pixel buffer. More...
 
PEXPORT ps_canvas *PICAPI ps_canvas_replace_data (ps_canvas *canvas, ps_byte *data, ps_color_format fmt, int width, int height, int pitch)
 Replace a canvas target rendering buffer address in memory, which is only use for canvas create by ps_canvas_create_with_data. More...
 
PEXPORT ps_canvas *PICAPI ps_canvas_ref (ps_canvas *canvas)
 Increases the reference count of the canvas by 1. More...
 
PEXPORT void PICAPI ps_canvas_unref (ps_canvas *canvas)
 Decrements the reference count for the canvas object. If the reference count on the canvas falls to 0, the canvas is freed. More...
 
PEXPORT ps_bool PICAPI ps_canvas_get_size (const ps_canvas *canvas, ps_size *rsize)
 Return the size of the canvas. More...
 
PEXPORT ps_color_format PICAPI ps_canvas_get_format (const ps_canvas *canvas)
 Return the pixel format of the canvas. More...
 
PEXPORT void PICAPI ps_canvas_set_mask (ps_canvas *canvas, const ps_mask *mask)
 Set a new mask into an existing canvas object. More...
 
PEXPORT void PICAPI ps_canvas_reset_mask (ps_canvas *canvas)
 Clear the mask from the canvas object. More...
 
PEXPORT void PICAPI ps_canvas_bitblt (ps_canvas *src, const ps_rect *rect, ps_canvas *dst, const ps_point *location)
 Copy raster data between two canvas objects. More...
 

Detailed Description

Enumeration Type Documentation

◆ _ps_color_format

Pixel formats of canvas or image.

Enumerator
COLOR_FORMAT_RGBA 

32bpp, 8bpc, RGBA color space.

COLOR_FORMAT_ARGB 

32bpp, 8bpc, ARGB color space.

COLOR_FORMAT_ABGR 

32bpp, 8bpc, ABGR color space.

COLOR_FORMAT_BGRA 

32bpp, 8bpc, BGRA color space.

COLOR_FORMAT_RGB 

24bpp, 8bpc, RGB color space.

COLOR_FORMAT_BGR 

24bpp, 8bpc, BGR color space.

COLOR_FORMAT_RGB565 

16bpp, 5/6bpc, RGB color space.

COLOR_FORMAT_RGB555 

16bpp, 5bpc, RGB color space.

COLOR_FORMAT_UNKNOWN 

Unsupported color space.

Definition at line 394 of file picasso.h.

Function Documentation

◆ ps_canvas_bitblt()

void ps_canvas_bitblt ( ps_canvas src,
const ps_rect rect,
ps_canvas dst,
const ps_point location 
)

Copy raster data between two canvas objects.

Parameters
srcThe pointer to source canvas object.
rectThe rectangle area will be copied in source canvas, NULL mean the whole area.
dstThe pointer to destination canvas object.
locationThe location of the start point at destination canvas object.
Note
The two canvas's color format must be equal, otherwish will be failed and STATUS_MISMATCHING_FORMAT will be set.
See also
ps_canvas_get_size, ps_canvas_get_format

◆ ps_canvas_create()

ps_canvas * ps_canvas_create ( ps_color_format  fmt,
int  width,
int  height 
)

Create a new canvas using the given parameters.

Parameters
fmtThe Pixel format to use for the canvas.
widthThe width, in pixels, of the required canvas.
heightThe height, in pixels, of the required canvas.
Returns
If the function succeeds, the return value is the pointer to a new canvas object. If the function fails, the return value is NULL.
Note
To get extended error information, call ps_last_status.
See also
ps_canvas_create_with_data, ps_canvas_create_compatible, ps_canvas_create_from_canvas, ps_canvas_create_from_image, ps_canvas_ref, ps_canvas_unref

◆ ps_canvas_create_compatible()

ps_canvas * ps_canvas_create_compatible ( const ps_canvas canvas,
int  width,
int  height 
)

Create a new canvas to compatible with an existing canvas.

Parameters
canvasA pointer to an existing canvas.
widthThe width, in pixels, of the required canvas. If it is not more than zero, the width will be equal to the width of the reference canvas.
heightThe height, in pixels, of the required canvas. If it is not more than zero, the height will be equal to the height of the reference canvas.
Returns
If the function succeeds, the return value is the pointer to a new canvas object. If the function fails, the return value is NULL.
Note
To get extended error information, call ps_last_status.
See also
ps_canvas_create, ps_canvas_create_with_data, ps_canvas_create_from_canvas, ps_canvas_create_from_image, ps_canvas_ref, ps_canvas_unref

◆ ps_canvas_create_from_canvas()

ps_canvas * ps_canvas_create_from_canvas ( ps_canvas canvas,
const ps_rect rect 
)

Create a new canvas using part of an existing canvas in same pixel buffer.

Parameters
canvasA pointer to an existing canvas.
rectThe rectangle area of the canvas from the parent canvas. If it is NULL, the canvas's width and height will be equal to the parant canvas.
Returns
If the function succeeds, the return value is the pointer to a new canvas object. If the function fails, the return value is NULL.
Note
To get extended error information, call ps_last_status.
See also
ps_canvas_create, ps_canvas_create_with_data, ps_canvas_create_compatible, ps_canvas_create_from_image, ps_canvas_ref, ps_canvas_unref

◆ ps_canvas_create_from_image()

ps_canvas * ps_canvas_create_from_image ( ps_image img,
const ps_rect rect 
)

Create a new canvas using part of an existing ps_image object in same pixel buffer.

Parameters
imgA pointer to an existing ps_image object.
rectThe rectangle area of the canvas from the ps_image. If it is NULL, the canvas's width and height will be equal to ps_image object.
Returns
If the function succeeds, the return value is the pointer to a new canvas object. If the function fails, the return value is NULL.
Note
To get extended error information, call ps_last_status.
See also
ps_canvas_create, ps_canvas_create_with_data, ps_canvas_create_compatible, ps_canvas_create_from_canvas, ps_canvas_ref, ps_canvas_unref

◆ ps_canvas_create_with_data()

ps_canvas * ps_canvas_create_with_data ( ps_byte data,
ps_color_format  fmt,
int  width,
int  height,
int  pitch 
)

Create a new canvas using a 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 canvas.
widthThe width, in pixels, of the required canvas.
heightThe height, in pixels, of the required canvas.
pitchThe number of bytes per row, of the required canvas.
Returns
If the function succeeds, the return value is the pointer to a new canvas object. If the function fails, the return value is NULL.
Note
To get extended error information, call ps_last_status.
See also
ps_canvas_create, ps_canvas_create_compatible, ps_canvas_create_from_canvas, ps_canvas_create_from_image, ps_canvas_ref, ps_canvas_unref, ps_canvas_replace_data

◆ ps_canvas_get_format()

ps_color_format ps_canvas_get_format ( const ps_canvas canvas)

Return the pixel format of the canvas.

Parameters
canvasPointer to an existing canvas object.
Returns
If the function succeeds, the return a valid color format. If the function fails, the return value is COLOR_FORMAT_UNKNOWN.
Note
To get extended error information, call ps_last_status.
See also
ps_canvas_get_size

◆ ps_canvas_get_size()

ps_bool ps_canvas_get_size ( const ps_canvas canvas,
ps_size rsize 
)

Return the size of the canvas.

Parameters
canvasPointer to an existing canvas object.
rsizePointer to a buffer to receiving the size.
Returns
True if is success, otherwise False.
Note
To get extended error information, call ps_last_status.
See also
ps_canvas_get_format

◆ ps_canvas_ref()

ps_canvas * ps_canvas_ref ( ps_canvas canvas)

Increases the reference count of the canvas by 1.

Parameters
canvasPointer to an existing canvas object.
Returns
If the function succeeds, the return value is the pointer to the canvas object. If the function fails, the return value is NULL.
Note
To get extended error information, call ps_last_status.
See also
ps_canvas_create, ps_canvas_create_with_data, ps_canvas_create_compatible, ps_canvas_create_from_canvas, ps_canvas_create_from_image, ps_canvas_unref

◆ ps_canvas_replace_data()

ps_canvas *PICAPI ps_canvas_replace_data ( ps_canvas canvas,
ps_byte data,
ps_color_format  fmt,
int  width,
int  height,
int  pitch 
)

Replace a canvas target rendering buffer address in memory, which is only use for canvas create by ps_canvas_create_with_data.

Parameters
canvasPointer to an existing canvas object.
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 canvas.
widthThe width, in pixels, of the required canvas.
heightThe height, in pixels, of the required canvas.
pitchThe number of bytes per row, of the required canvas.
Returns
If the function succeeds, the return value is the pointer to a new canvas object. If the function fails, the return value is NULL.
Note
The data's color format must be equal with target canvas, otherwish will be failed and STATUS_MISMATCHING_FORMAT will be set.
See also
ps_canvas_create_with_data

◆ ps_canvas_reset_mask()

void ps_canvas_reset_mask ( ps_canvas canvas)

Clear the mask from the canvas object.

Parameters
canvasPointer to an existing canvas object.
See also
ps_canvas_set_mask

◆ ps_canvas_set_mask()

void ps_canvas_set_mask ( ps_canvas canvas,
const ps_mask mask 
)

Set a new mask into an existing canvas object.

Parameters
canvasPointer to an existing canvas object.
maskPointer to an existing mask object to be set.
See also
ps_canvas_reset_mask

◆ ps_canvas_unref()

void ps_canvas_unref ( ps_canvas canvas)

Decrements the reference count for the canvas object. If the reference count on the canvas falls to 0, the canvas is freed.

Parameters
canvasPointer to an existing canvas object.
See also
ps_canvas_create, ps_canvas_create_with_data, ps_canvas_create_compatible, ps_canvas_create_from_canvas, ps_canvas_create_from_image, ps_canvas_ref