
@c %start of fragment

@deffn Function cairo-format-stride-for-width  (@var{format}@tie{}@code{<cairo-format-t>}) (@var{width}@tie{}@code{<int>}) @result{}@tie{} (@var{ret}@tie{}@code{<int>})
This function provides a stride value that will respect all alignment
requirements of the accelerated image-rendering code within cairo.
Typical usage will be of the form:

@example 

int stride;
unsigned char *data;
cairo_surface_t *surface;

stride = cairo_format_stride_for_width (format, width);
data = malloc (stride * height);
surface = cairo_image_surface_create_for_data (data, format,
					  width, height,
					  stride);
@end example

@table @var
@item format
A @code{<cairo-format-t>} value

@item width
The desired width of an image surface to be created.

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

@end table

Since 1.6

@end deffn

@deffn Function cairo-image-surface-create  (@var{format}@tie{}@code{<cairo-format-t>}) (@var{width}@tie{}@code{<int>}) (@var{height}@tie{}@code{<int>}) @result{}@tie{} (@var{ret}@tie{}@code{<cairo-surface-t >})
Creates an image surface of the specified format and dimensions.
Initially the surface contents are all 0. (Specifically, within each
pixel, each color or alpha channel belonging to format will be 0. The
contents of bits within a pixel, but not belonging to the given format
are undefined).

@table @var
@item format
format of pixels in the surface to create

@item width
width of the surface, in pixels

@item height
height of the surface, in pixels

@item ret
a pointer to the newly created surface. The caller owns the surface and
should call @code{cairo-surface-destroy} when done with it. This
function always returns a valid pointer, but it will return a pointer to
a "nil" surface if an error such as out of memory occurs. You can use
@code{cairo-surface-status} to check for this.

@end table

@end deffn

@deffn Function cairo-image-surface-get-format  (@var{surface}@tie{}@code{<cairo-surface-t>}) @result{}@tie{} (@var{ret}@tie{}@code{<cairo-format-t>})
Get the format of the surface.

@table @var
@item surface
a @code{<cairo-image-surface-t>}

@item ret
the format of the surface

@end table

Since 1.2

@end deffn

@deffn Function cairo-image-surface-get-width  (@var{surface}@tie{}@code{<cairo-surface-t>}) @result{}@tie{} (@var{ret}@tie{}@code{<int>})
Get the width of the image surface in pixels.

@table @var
@item surface
a @code{<cairo-image-surface-t>}

@item ret
the width of the surface in pixels.

@end table

@end deffn

@deffn Function cairo-image-surface-get-height  (@var{surface}@tie{}@code{<cairo-surface-t>}) @result{}@tie{} (@var{ret}@tie{}@code{<int>})
Get the height of the image surface in pixels.

@table @var
@item surface
a @code{<cairo-image-surface-t>}

@item ret
the height of the surface in pixels.

@end table

@end deffn

@deffn Function cairo-image-surface-get-stride  (@var{surface}@tie{}@code{<cairo-surface-t>}) @result{}@tie{} (@var{ret}@tie{}@code{<int>})
Get the stride of the image surface in bytes

@table @var
@item surface
a @code{<cairo-image-surface-t>}

@item ret
the stride of the image surface in bytes (or 0 if @var{surface} is not
an image surface). The stride is the distance in bytes from the
beginning of one row of the image data to the beginning of the next row.

@end table

Since 1.2

@end deffn


@c %end of fragment
