Package: gdk
Function gdk:window-create-similar-image-surface
Lambda Listgdk:window-create-similar-image-surface (window format width height scale) ArgumentsReturn Value    A newly allocated cairo:surface-t instance. The caller owns the    surface and should call the cairo:surface-destroy function when done
    with it. This function always returns a valid pointer, but it will return a
    "nil" surface if the surface is in an error state or any other error
    occurs.   Details              
    Create a new image surface that is efficient to draw on the given    window.  
  Initially the surface contents are all 0, transparent if contents have
  transparency, black otherwise. The width and height of the new surface are not affected by the scaling factor of the window, or by the scale argument. They are the size of the surface in device pixels. If you wish to create an image surface capable of holding the contents of the window you can use: 
(let* ((win (gtk:widget-window window))
       (scale (gdk:window-scale-factor win))
       (width (* scale (gdk:window-width win)))
       (height (* scale (gdk:window-height win)))
       (surface nil))
  ;; Create the image surface
  (setf surface
        (gdk:window-create-similar-image-surface win
                                                 :rgb24
                                                 width height
                                                 scale))
  ...
  (cairo:surface-destroy surface))    Note that unlike the cairo:surface-create-similar-image function, the  new device scale of the surface is set to scale, or to the scale factor  of window if the scale argument is 0.           | See also | 
2025-06-03