Paintable

interface Paintable

GdkPaintable is a simple interface used by GTK to represent content that can be painted.

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

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

A GdkPaintable may change its contents, meaning that it will now produce a different output with the same snapshot. Once that happens, it will call method@Gdk.Paintable.invalidate_contents which will emit the signal@Gdk.Paintable::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 method@Gdk.Paintable.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 method@Gdk.Paintable.invalidate_size which will emit the signal@Gdk.Paintable::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: method@Gdk.Paintable.invalidate_contents, method@Gdk.Paintable.invalidate_size, func@Gdk.Paintable.new_empty.

Skipped during bindings generation

  • parameter concrete_width: concrete_width: Out parameter is not supported

Inheritors

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
abstract val gdkPaintablePointer: <Error class: unknown class><<Error class: unknown class>>

Functions

Link copied to clipboard
open fun connectInvalidateContents(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: () -> Unit): <Error class: unknown class>

Emitted when the contents of the @paintable change.

Link copied to clipboard
open fun connectInvalidateSize(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: () -> Unit): <Error class: unknown class>

Emitted when the intrinsic size of the @paintable changes.

Link copied to clipboard

Gets an immutable paintable for the current contents displayed by @paintable.

Link copied to clipboard

Get flags for the paintable.

Link copied to clipboard
open fun getIntrinsicAspectRatio(): <Error class: unknown class>

Gets the preferred aspect ratio the @paintable would like to be displayed at.

Link copied to clipboard
open fun getIntrinsicHeight(): <Error class: unknown class>

Gets the preferred height the @paintable would like to be displayed at.

Link copied to clipboard
open fun getIntrinsicWidth(): <Error class: unknown class>

Gets the preferred width the @paintable would like to be displayed at.

Link copied to clipboard

Called by implementations of GdkPaintable to invalidate their contents.

Link copied to clipboard
open fun invalidateSize()

Called by implementations of GdkPaintable to invalidate their size.

Link copied to clipboard
open fun snapshot(snapshot: Snapshot, width: <Error class: unknown class>, height: <Error class: unknown class>)

Snapshots the given paintable with the given @width and @height.