CD_IMIMAGE - RGB Client Image Driver using an inImage structure (cdim.h)

The driver uses the CD_IMAGERGB driver to draw in an imImage. (since 5.9)

Use

The canvas is created by means of a call to function cdCreateCanvas(CD_IMIMAGE, image), after which other functions in the CD library can be called as usual. This function creates a CD canvas to use with an existing imImage, but the image must be a RGB bitmap image (data_type == IM_BYTE and color_space == IM_RGB). The parameter Data is a pointer to the already created imImage. The image can has an alpha channel.

Any amount of such canvases may exist simultaneously. It is important to note that a call to function cdKillCanvas is required to properly end the driver. Call function cdKillCanvas for this driver before calling cdKillCanvas for the client canvas driver.

The drawing functions will work normally as if they were drawn on the image RGB driver.

If the image is resized the canvas must be destroyed and created again.

To use this driver, the application must be linked with the "cdim" library. In Lua, it is necessary to call function cdluaim_open() after a call to function cdlua_open(), apart from linking with the "cdluaim" library. This is not necessary if you do require"cdluaim". 

Behavior of Functions

This driver depends on the RGB Client Image Driver.

Utility Functions

void cdCanvasPutImImage(cdCanvas* canvas, const imImage* image, int x, int y, int w, int h); [in C]
void cdfCanvasPutImImage(cdCanvas* canvas, const imImage* image, double x, double y, double w, double h); [in C]
void wdCanvasPutImImage(cdCanvas* canvas, const imImage* image, double x, double y, double w, double h); (WC) [in C]

canvas:PutImImage(image: imImage, x,y,w,h: number) [in Lua]
canvas:fPutImImage(image: imImage, x,y,w,h: number) [in Lua]
canvas:wPutImImage(image: imImage, x,y,w,h: number) (WC) [in Lua]

Draws an imImage on any canvas. Image must be a displayable image (imImageIsBitmap), and it can has an alpha channel.

void cdCanvasPatternImImage(cdCanvas* canvas, const imImage* image); [in C]

cd.CanvasPatternImImage(canvas: cdCanvas, image: imImage) [in Lua]

Defines an imImage as a pattern on any canvas. Image must be a displayable image (imImageIsBitmap).

void cdCanvasStippleImImage(cdCanvas* canvas, const imImage* image); [in C]

cd.CanvasStippleImImage(canvas: cdCanvas, image: imImage) [in Lua]

Defines an imImage as a stipple on any canvas. Image must be a binary image (color_space=IM_BINARY).

void cdCanvasGetImImage(cdCanvas* canvas, const imImage* image, int x, int y); [in C]
void wdCanvasGetImImage(cdCanvas* canvas, const imImage* image, double x, double y); (WC) [in C]

canvas:GetImImage(image: imImage, x,y: number) [in Lua]
canvas:wGetImImage(image: imImage, x,y: number) (WC) [in Lua]

Retrieves the canvas contents in an imImage. Image must be a display RGB image (color_space=IM_RGB and data_type=IM_BYTE).