formatStrideForWidth

This function provides a stride value that will respect all alignment requirements of the accelerated image-rendering code within cairo.

int
formatStrideForWidth

Parameters

format Format

The desired Format of an image surface to be created

width int

The desired width of an image surface to be created

Return Value

Type: int

the appropriate stride to use given the desired format and width, or -1 if either the format is invalid or the width too large.

Examples

int stride;
ubyte[] data;
Surface surface;

stride = formatStrideForWidth(format, width);
data = new ubyte[](stride * height); //could also use malloc
surface = new ImageSurface(data, format, width, height, stride);

Meta