Package: gdk

Method gdk:paintable-get-current-image-impl

Lambda List

gdk:paintable-get-current-image-impl (paintable)

Details

Method called from the gdk:paintable-current-image function.

Default method

(defmethod paintable-get-current-image-impl ((paintable paintable))
  (if (not (set-difference '(:static-size :static-contents)
                           (paintable-get-flags-impl paintable)))
      ;; Paintable is immutable, return it
      paintable
      ;; Create a new paintable object
      (let ((width (paintable-get-intrinsic-width-impl paintable))
            (height (paintable-get-intrinsic-height-impl paintable)))
        (if (or (<= width 0) (<= height 0))
          (paintable-new-empty width height)
          (let ((snapshot (g:object-new "GtkSnapshot")))
            (paintable-snapshot paintable snapshot width height)
            ;; The GTK package is not availabe at this point. We call the
            ;; C function directly.
            (cffi:foreign-funcall "gtk_snapshot_free_to_paintable"
                                  (g:object snapshot) snapshot
                                  :pointer (cffi:null-pointer)))))))    
The implementation of this method is not mandatory. The default implementation returns the paintable itself, when it is a static paintable. Otherwise, the default method returns an empty paintable or creates a paintable for the intrinsic width and height.
 

See also

2023-12-2