| 1 |
|
| 2 |
@c %start of fragment |
| 3 |
|
| 4 |
@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>}) |
| 5 |
This function provides a stride value that will respect all alignment |
| 6 |
requirements of the accelerated image-rendering code within cairo. |
| 7 |
Typical usage will be of the form: |
| 8 |
|
| 9 |
@example |
| 10 |
|
| 11 |
int stride; |
| 12 |
unsigned char *data; |
| 13 |
cairo_surface_t *surface; |
| 14 |
|
| 15 |
stride = cairo_format_stride_for_width (format, width); |
| 16 |
data = malloc (stride * height); |
| 17 |
surface = cairo_image_surface_create_for_data (data, format, |
| 18 |
width, height, |
| 19 |
stride); |
| 20 |
@end example |
| 21 |
|
| 22 |
@table @var |
| 23 |
@item format |
| 24 |
A @code{<cairo-format-t>} value |
| 25 |
|
| 26 |
@item width |
| 27 |
The desired width of an image surface to be created. |
| 28 |
|
| 29 |
@item ret |
| 30 |
the appropriate stride to use given the desired format and width, or -1 |
| 31 |
if either the format is invalid or the width too large. |
| 32 |
|
| 33 |
@end table |
| 34 |
|
| 35 |
Since 1.6 |
| 36 |
|
| 37 |
@end deffn |
| 38 |
|
| 39 |
@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 >}) |
| 40 |
Creates an image surface of the specified format and dimensions. |
| 41 |
Initially the surface contents are all 0. (Specifically, within each |
| 42 |
pixel, each color or alpha channel belonging to format will be 0. The |
| 43 |
contents of bits within a pixel, but not belonging to the given format |
| 44 |
are undefined). |
| 45 |
|
| 46 |
@table @var |
| 47 |
@item format |
| 48 |
format of pixels in the surface to create |
| 49 |
|
| 50 |
@item width |
| 51 |
width of the surface, in pixels |
| 52 |
|
| 53 |
@item height |
| 54 |
height of the surface, in pixels |
| 55 |
|
| 56 |
@item ret |
| 57 |
a pointer to the newly created surface. The caller owns the surface and |
| 58 |
should call @code{cairo-surface-destroy} when done with it. This |
| 59 |
function always returns a valid pointer, but it will return a pointer to |
| 60 |
a "nil" surface if an error such as out of memory occurs. You can use |
| 61 |
@code{cairo-surface-status} to check for this. |
| 62 |
|
| 63 |
@end table |
| 64 |
|
| 65 |
@end deffn |
| 66 |
|
| 67 |
@deffn Function cairo-image-surface-get-format (@var{surface}@tie{}@code{<cairo-surface-t>}) @result{}@tie{} (@var{ret}@tie{}@code{<cairo-format-t>}) |
| 68 |
Get the format of the surface. |
| 69 |
|
| 70 |
@table @var |
| 71 |
@item surface |
| 72 |
a @code{<cairo-image-surface-t>} |
| 73 |
|
| 74 |
@item ret |
| 75 |
the format of the surface |
| 76 |
|
| 77 |
@end table |
| 78 |
|
| 79 |
Since 1.2 |
| 80 |
|
| 81 |
@end deffn |
| 82 |
|
| 83 |
@deffn Function cairo-image-surface-get-width (@var{surface}@tie{}@code{<cairo-surface-t>}) @result{}@tie{} (@var{ret}@tie{}@code{<int>}) |
| 84 |
Get the width of the image surface in pixels. |
| 85 |
|
| 86 |
@table @var |
| 87 |
@item surface |
| 88 |
a @code{<cairo-image-surface-t>} |
| 89 |
|
| 90 |
@item ret |
| 91 |
the width of the surface in pixels. |
| 92 |
|
| 93 |
@end table |
| 94 |
|
| 95 |
@end deffn |
| 96 |
|
| 97 |
@deffn Function cairo-image-surface-get-height (@var{surface}@tie{}@code{<cairo-surface-t>}) @result{}@tie{} (@var{ret}@tie{}@code{<int>}) |
| 98 |
Get the height of the image surface in pixels. |
| 99 |
|
| 100 |
@table @var |
| 101 |
@item surface |
| 102 |
a @code{<cairo-image-surface-t>} |
| 103 |
|
| 104 |
@item ret |
| 105 |
the height of the surface in pixels. |
| 106 |
|
| 107 |
@end table |
| 108 |
|
| 109 |
@end deffn |
| 110 |
|
| 111 |
@deffn Function cairo-image-surface-get-stride (@var{surface}@tie{}@code{<cairo-surface-t>}) @result{}@tie{} (@var{ret}@tie{}@code{<int>}) |
| 112 |
Get the stride of the image surface in bytes |
| 113 |
|
| 114 |
@table @var |
| 115 |
@item surface |
| 116 |
a @code{<cairo-image-surface-t>} |
| 117 |
|
| 118 |
@item ret |
| 119 |
the stride of the image surface in bytes (or 0 if @var{surface} is not |
| 120 |
an image surface). The stride is the distance in bytes from the |
| 121 |
beginning of one row of the image data to the beginning of the next row. |
| 122 |
|
| 123 |
@end table |
| 124 |
|
| 125 |
Since 1.2 |
| 126 |
|
| 127 |
@end deffn |
| 128 |
|
| 129 |
|
| 130 |
@c %end of fragment |