ChartDirector 7.1 (C++ Edition)

DrawArea.setResource


Usage

void setResource(const char *id, MemBlock img);

Description

Assigns a resource ID to a memory block to allow it to be referenced using a resource path.

Many ChartDirector features, such as BaseChart.setBgImage and the <*img*> tag in CDML, expect a file or resource path for loading an image. If the image happens to be in memory, such as if the image is retrieved from a database, setResource can be used to assign a resource ID to the memory. It can then be referenced using "@/res_id", in which res_id is the resource ID.

The assigned resource ID is only valid for the DrawArea object of which this method is called. Use Chart::setResource to assign a resource ID that is valid for all ChartDirector objects.

This method only saves a pointer to the memory. It does not copy the memory. You must ensure the memory contains valid content for as long as the resource is being used.

Arguments

ArgumentDefaultDescription
id(Mandatory)The resource ID to be used to reference the memory image.
img(Mandatory)The memory that the image occupies.

Return Value

None