Package: cairo

Function cairo-format-stride-for-width

Lambda List

cairo-format-stride-for-width (format width)

Arguments

format -- a cairo-format-t value
width -- An integer with the desired width of an image surface to be created.

Return Value

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

Details

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

Example

Typical usage will be of the form:
(let* ((height 150)
       (width 200)
       (stride (cairo-format-stride-for-width :argb32 width))
       (data (g-malloc (* height stride)))
       (surface (cairo-image-surface-create-for-data data
                                                     :argb32
                                                     width height stride)))
  ... )    
 

See also

2020-12-21