@@ -1271,6 +1271,61 @@ destroyed until a matching call to ScaledFont drop trait is made.
12711271
12721272The number of references to a cairo_scaled_font_t can be get using
12731273ScaledFont::get_reference_count().
1274+ <!-- file src/image_surface.rs -->
1275+ <!-- impl ImageSurface::fn from_raw_full -->
1276+ Wraps a raw pointer for a ` *mut ffi::cairo_surface_t ` with an ` ImageSurface ` .
1277+
1278+ Returns a ` Result<ImageSurface, Status> ` . The ` Ok() ` case is when the surface
1279+ passed to this function is in a success state, i.e. ` surface.status() == Success ` .
1280+ The ` Err() ` case is when the surface is in an error state.
1281+
1282+ # Errors
1283+
1284+ When Cairo encounters an error when creating a surface, for
1285+ example, if it runs out of memory or if an invalid size gets
1286+ passed to a surface-creation function, it will still return a
1287+ valid pointer to a surface. However, that surface is an
1288+ "error surface" whose ` surface.status() ` is different from
1289+ ` Success ` . Operations on a surface with a non-success status
1290+ are an error; Cairo will print a warning about them and do
1291+ nothing.
1292+ <!-- impl ImageSurface::fn create -->
1293+ Creates a new ` ImageSurface ` .
1294+
1295+ # Errors
1296+
1297+ This function may return an ` Err() ` with a [ Cairo status
1298+ code] [ cairo-status ] if the surface cannot be created. For
1299+ example, it will return ` Err(Status::NoMemory) ` if there is
1300+ insufficient memory for the requested surface, or
1301+ ` Err(Status::InvalidSize) ` if Cairo's backend for image
1302+ surfaces cannot handle the specified size.
1303+
1304+ [ cairo-status ] : enum.Status.html
1305+ <!-- impl ImageSurface::fn create_for_data -->
1306+ Creates a new ` ImageSurface ` from a buffer supplied by the program.
1307+
1308+ The ` data ` is assumed to come in the ` format ` specified. The ` stride `
1309+ parameter specifies the distance in bytes between rows, and it must match
1310+ Cairo's requirements for rowstrides:
1311+
1312+ 1 . The ` stride ` must be aligned to 32 bits.
1313+
1314+ 2 . The absolute value of ` stride ` must be greater than or equal to
1315+ ` cairo_format_stride_for_width() ` .
1316+
1317+ The ` free ` function will get called with the ` data ` as argument when
1318+ the surface is dropped.
1319+
1320+ # Errors
1321+
1322+ This function may return an ` Err() ` with a [ Cairo status
1323+ code] [ cairo-status ] if the surface cannot be created. For
1324+ example, it will return ` Err(Status::InvalidStride) ` if the
1325+ ` stride ` parameter does not match the rowstride that Cairo
1326+ expects.
1327+
1328+ [ cairo-status ] : enum.Status.html
12741329<!-- file lib.rs -->
12751330<!-- file_comment -->
12761331
0 commit comments