Package: gdk
Interface gdk:paintable
Superclassesgobject:object, common-lisp:standard-object, common-lisp:t Documented Subclassesgdk:dmabuf-texture, gdk:gl-texture, gdk:memory-texture, gdk:texture, gtk:icon-paintable, gtk:media-file, gtk:media-stream, gtk:widget-paintable Direct Slots
None
Details The gdk:paintable interface is a simple interface used by GDK and
GTK to represent objects that can be painted anywhere at any size without
requiring any sort of layout.
The interface is inspired by similar concepts elsewhere, such as ClutterContent, HTML/CSS Paint Sources, or SVG Paint Servers. A gdk:paintable object can be snapshot at any time and size using the gdk:paintable-snapshot function. How the paintable interprets that size and if it scales or centers itself into the given rectangle is implementation defined, though if you are implementing a gdk:paintable object and do not know what to do, it is suggested that you scale your paintable ignoring any potential aspect ratio. The contents that a gdk:paintable object produces may depend on the gdk:snapshot object passed to it. For example, paintables may decide to use more detailed images on higher resolution screens or when OpenGL is available. A gdk:paintable object will however always produce the same output for the same snapshot. A gdk:paintable object may change its contents, meaning that it will now produce a different output with the same snapshot. Once that happens, it will call the gdk:paintable-invalidate-contents function which will emit the "invalidate-contents" signal. If a paintable is known to never change its contents, it will set the :static-contents flag. If a consumer cannot deal with changing contents, it may call the gdk:paintable-current-image function which will return a static paintable and use that. A paintable can report an intrinsic (or preferred) size or aspect ratio it wishes to be rendered at, though it does not have to. Consumers of the interface can use this information to layout thepaintable appropriately. Just like the contents, the size of a paintable can change. A paintable will indicate this by calling the gdk:paintable-invalidate-size function which will emit the "invalidate-size" signal. And just like for contents, if a paintable is known to never change its size, it will set the :static-size flag. Besides API for applications, there are some functions that are only useful for implementing subclasses and should not be used by applications: gdk:paintable-invalidate-contents, gdk:paintable-invalidate-size, gdk:paintable-new-empty. Interface structure(gobject:define-vtable ("GdkPaintable" paintable) (:skip parent-instance (:struct g:type-interface)) ;; Methods of the GdkPaintable interface (snapshot (:void (paintable (g:object paintable)) (snapshot (g:object snapshot)) (width :double) (height :double))) (get-current-image ((g:object paintable) (paintable (g:object paintable)))) (get-flags (paintable-flags (paintable (g:object paintable)))) (get-intrinsic-width (:int (paintable (g:object paintable)))) (get-intrinsic-height (:int (paintable (g:object paintable)))) (get-intrinsic-aspect-ratio (:double (paintable (g:object paintable)))))The list of functions that can be implemented for the gdk:paintable interface. The following methods are provided and can be specialized for a subclass which derives from the gdk:paintable interface:
Examples;; Implementation of a NUCLEAR-ICON subclass (gobject:define-gobject-subclass "GdkNuclearIcon" nuclear-icon (:superclass g:object :export t :interfaces ("GdkPaintable")) ((rotation nuclear-icon-rotation "rotation" "gdouble" t t))) Signal DetailsThe "invalidate-contents" signallambda (paintable) :run-last
The "invalidate-size" signallambda (paintable) :run-last
| Inherited Slot Access FunctionsSee also |
2024-5-5