[39:7] extends: object
Displays a GdkPaintable.
c GtkWidget *widget = gtk_picture_new_for_filename ("myfile.png"); If the
file isn’t loaded successfully, the picture will contain a “broken image”
icon similar to that used in many web browsers. If you want to handle errors
in loading the file yourself, for example by displaying an error message,
then load the image with and image loading framework such as libglycin, then
create the GtkPicture with [ctor@Gtk.Picture.new_for_paintable]. Sometimes
an application will want to avoid depending on external data files, such as
image files. See the documentation of GResource for details. In this case,
[ctor@Gtk.Picture.new_for_resource] and [method@Gtk.Picture.set_resource]
should be used. GtkPicture displays an image at its natural size. See
[class@Gtk.Image] if you want to display a fixed-size image, such as an icon.
inside the GtkPicture by changing [property@Gtk.Picture:content-fit]. See
[enum@Gtk.ContentFit] for details. [property@Gtk.Picture:can-shrink] can be
unset to make sure that paintables are never made smaller than their ideal
size - but be careful if you do not know the size of the paintable in use
(like when displaying user-loaded images). This can easily cause the picture
to grow larger than the screen. And [property@Gtk.Widget:halign] and
[property@Gtk.Widget:valign] can be used to make sure the paintable doesn't
fill all available space but is instead displayed at its original size. ##
CSS nodes GtkPicture has a single CSS node with the name picture. ##
Accessibility GtkPicture uses the [enum@Gtk.AccessibleRole.img] role.
Picture ()
Creates a new empty
GtkPicturewidget.
toNativeHandle (Source)
Normalizes a constructor argument into a raw pointer carrier. Accepts a raw NativeHandle, a raw NativeBuffer returned from
fn.call(...), another generated wrapper exposinghandle(), or null. Returns null when the argument carries no pointer.
Source is the raw handle, raw buffer, wrapper, or null.A raw pointer carrier or null when no pointer is present.getLib ()
Returns the opened native library for this generated wrapper.
The opened native library.handle ()
Returns the wrapped NativeHandle.
The wrapped NativeHandle.isNull ()
Returns true when the wrapped handle is null.
A bool.describe ()
Returns a small string for debugging generated wrappers.
A string.asWidget ()
Wraps this handle as
Widget.
A Widget object.asAccessible ()
Wraps this handle as
Accessible.
A Accessible object.asBuildable ()
Wraps this handle as
Buildable.
A Buildable object.asConstraintTarget ()
Wraps this handle as
ConstraintTarget.
A ConstraintTarget object.getProperty (string Name)
Reads one generated property by name.
setProperty (string Name, Value)
Writes one generated property by name.
setAlternativetext (string Value)
The alternative textual description for the picture.
Value is the new property value.None.setCanshrink (bool Value)
If the
GtkPicturecan be made smaller than the natural size of its contents.
Value is the new property value.None.setContentfit (string Value)
How the content should be resized to fit inside the
GtkPicture.
Value is the new property value.None.setFile (object Value)
The
GFilethat is displayed or %NULL if none.
Value is the new property value.None.setIsolatecontents (bool Value)
If the rendering of the contents is isolated from the rest of the widget tree.
Value is the new property value.None.setKeepaspectratio (bool Value)
Whether the GtkPicture will render its contents trying to preserve the aspect ratio.
Value is the new property value.None.setPaintable (object Value)
The
GdkPaintableto be displayed by thisGtkPicture.
Value is the new property value.None.get_alternative_text ()
Gets the alternative textual description of the picture. The returned string will be %NULL if the picture cannot be described textually.
get_can_shrink ()
Returns whether the
GtkPicturerespects its contents size.
get_content_fit ()
Returns the fit mode for the content of the
GtkPicture. See [enum@Gtk.ContentFit] for details.
get_file ()
Gets the
GFilecurrently displayed if @self is displaying a file. If
is not displaying a file, for example when [method@Gtk.Picture.set_paintable] was used, then %NULL is returned.get_isolate_contents ()
Returns whether the contents are isolated.
get_keep_aspect_ratio ()
Returns whether the
GtkPicturepreserves its contents aspect ratio.
get_paintable ()
Gets the
GdkPaintablebeing displayed by theGtkPicture.
set_alternative_text (string alternative_text)
Sets an alternative textual description for the picture contents. It is equivalent to the "alt" attribute for images on websites. This text will be made available to accessibility tools. If the picture cannot be described textually, set this property to %NULL.
alternative_text is a textual description of the contents.None.set_can_shrink (bool can_shrink)
If set to %TRUE, then @self can be made smaller than its contents. The contents will then be scaled down when rendering. If you want to still force a minimum size manually, consider using [method@Gtk.Widget.set_size_request]. Also of note is that a similar function for growing does not exist because the grow behavior can be controlled via [method@Gtk.Widget.set_halign] and [method@Gtk.Widget.set_valign].
can_shrink is if @self can be made smaller than its contents.None.set_content_fit (string content_fit)
Sets how the content should be resized to fit the
GtkPicture. See [enum@Gtk.ContentFit] for details.
content_fit is the content fit mode.None.set_file (object file)
Makes @self load and display @file. See [ctor@Gtk.Picture.new_for_file] for details. ::: warning Note that this function should not be used with untrusted data. Use a proper image loading framework such as libglycin, which can load many image formats into a
GdkTexture, and then use [method@Gtk.Image.set_from_paintable].
file is a GFile.None.set_filename (string filename)
Makes @self load and display the given @filename. This is a utility function that calls [method@Gtk.Picture.set_file]. ::: warning Note that this function should not be used with untrusted data. Use a proper image loading framework such as libglycin, which can load many image formats into a
GdkTexture, and then use [method@Gtk.Image.set_from_paintable].
filename is the filename to play.None.set_isolate_contents (bool isolate_contents)
If set to true, then the contents will be rendered individually. If set to false they will be able to erase or otherwise mix with the background. GTK supports finer grained isolation, in rare cases where you need this, you can use [method@Gtk.Snapshot.push_isolation] yourself to achieve this. By default contents are isolated.
isolate_contents is if contents are rendered separately.None.set_keep_aspect_ratio (bool keep_aspect_ratio)
If set to %TRUE, the @self will render its contents according to their aspect ratio. That means that empty space may show up at the top/bottom or left/right of @self. If set to %FALSE or if the contents provide no aspect ratio, the contents will be stretched over the picture's whole area.
keep_aspect_ratio is whether to keep aspect ratio.None.set_paintable (object paintable)
Makes @self display the given @paintable. If @paintable is
NULL, nothing will be displayed. See [ctor@Gtk.Picture.new_for_paintable] for details.
paintable is a GdkPaintable.None.set_pixbuf (object pixbuf)
Sets a
GtkPictureto show aGdkPixbuf. See [ctor@Gtk.Picture.new_for_pixbuf] for details. This is a utility function that calls [method@Gtk.Picture.set_paintable].
pixbuf is a GdkPixbuf.None.set_resource (string resource_path)
Makes @self load and display the resource at the given @resource_path. This is a utility function that calls [method@Gtk.Picture.set_file].
resource_path is the resource to set.None.[550:14] static extends: object
Generated metadata helpers for Picture class surfaces.
properties ()
Returns property metadata for
Picture.
A list.[472:14] static extends: object
Alternate constructors for Picture. Usage:
PictureCtors.<name>(...). The primary constructor lives
directly on Picture.
newForFile (object file)
Creates a new
GtkPicturedisplaying the given @file. If the file isn’t found or can’t be loaded, the resultingGtkPictureis empty. If you need to detect failures to load the file, use an image loading framework such as libglycin to load the file yourself, then create theGtkPicturefrom the texture.
file is a GFile.A new Picture.newForFilename (string filename)
Creates a new
GtkPicturedisplaying the file @filename. This is a utility function that calls [ctor@Gtk.Picture.new_for_file]. See that function for details.
filename is a filename.A new Picture.newForPaintable (object paintable)
Creates a new
GtkPicturedisplaying @paintable. TheGtkPicturewill track changes to the @paintable and update its size and contents in response to it.
paintable is a GdkPaintable.A new Picture.newForPixbuf (object pixbuf)
Creates a new
GtkPicturedisplaying @pixbuf. This is a utility function that calls [ctor@Gtk.Picture.new_for_paintable], See that function for details. The pixbuf must not be modified after passing it to this function.
pixbuf is a GdkPixbuf.A new Picture.newForResource (string resource_path)
Creates a new
GtkPicturedisplaying the resource at @resource_path. This is a utility function that calls [ctor@Gtk.Picture.new_for_file]. See that function for details.
resource_path is resource path to play back.A new Picture.