Object Hierarchy:

Object hierarchy for Paintable


[ CCode ( type_cname = "GdkPaintableInterface" , type_id = "gdk_paintable_get_type ()" ) ]
public interface Paintable : Object

Paintable 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 Paintable can be snapshot at any time and size using snapshot. 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 Paintable and don't know what to do, it is suggested that you scale your paintable ignoring any potential aspect ratio.

The contents that a Paintable produces may depend on the Snapshot passed to it. For example, paintables may decide to use more detailed images on higher resolution screens or when OpenGL is available. A Paintable will however always produce the same output for the same snapshot.

A Paintable may change its contents, meaning that it will now produce a different output with the same snapshot. Once that happens, it will call gdk_paintable_invalidate_contents which will emit the invalidate_contents signal. If a paintable is known to never change its contents, it will set the gdk_paintable_static_contents flag. If a consumer cannot deal with changing contents, it may call get_current_image 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 doesn't 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 gdk_paintable_invalidate_size 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 gdk_paintable_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, new_empty.

Namespace: Gdk
Package: gtk4


Static methods:



Inherited Members: