Function formatStrideForWidth

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

Prototype

int formatStrideForWidth(
  cairo_format_t format,
  int width
);

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);

Parameters

NameDescription
format The desired Format of an image surface to be created
width The desired width of an image surface to be created

Returns

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

Authors

Johannes Pfau cairoD
Andrej Mitrovic cairoD
cairo team cairo

Copyright

License

cairoD wrapper/bindings Boost License 1.0
cairo LGPL 2.1 / MPL 1.1