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 for the desired width of an image surface to be created.

Return Value

The integer with 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 Cairo alignment requirements of the accelerated image-rendering code within Cairo.

Examples

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

2025-1-29