[560:14] static extends: object
Generated metadata helpers for Image class surfaces.
properties ()
Returns property metadata for
Image.
A list.[33:7] extends: object
Displays an image.
GdkTexture from a file, using the
convenience function [ctor@Gtk.Image.new_from_file], for instance: c GtkWidget *image = gtk_image_new_from_file ("myfile.png"); If the file
isn’t loaded successfully, the image 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 an image loading framework such as libglycin, then create
the GtkImage with [ctor@Gtk.Image.new_from_paintable]. Sometimes an
application will want to avoid depending on external data files, such as
image files. See the documentation of GResource inside GIO, for details. In
this case, [property@Gtk.Image:resource], [ctor@Gtk.Image.new_from_resource],
and [method@Gtk.Image.set_from_resource] should be used. GtkImage displays
its image as an icon, with a size that is determined by the application. See
[class@Gtk.Picture] if you want to show an image at is actual size. ## CSS
nodes GtkImage has a single CSS node with the name image. The style
classes .normal-icons or .large-icons may appear, depending on the
[property@Gtk.Image:icon-size] property. ## Accessibility GtkImage uses the
[enum@Gtk.AccessibleRole.img] role.
Image ()
Creates a new empty
GtkImagewidget.
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.
setFile (string Value)
A path to the file to display.
Value is the new property value.None.setGicon (object Value)
The
GIcondisplayed in the GtkImage. For themed icons, If the icon theme is changed, the image will be updated automatically.
Value is the new property value.None.setIconname (string Value)
The name of the icon in the icon theme. If the icon theme is changed, the image will be updated automatically.
Value is the new property value.None.setIconsize (string Value)
The symbolic size to display icons at.
Value is the new property value.None.setPaintable (object Value)
The
GdkPaintableto display.
Value is the new property value.None.setPixelsize (int Value)
The size in pixels to display icons at. If set to a value != -1, this property overrides the [property@Gtk.Image:icon-size] property for images of type
GTK_IMAGE_ICON_NAME.
Value is the new property value.None.setResource (string Value)
A path to a resource file to display.
Value is the new property value.None.setUsefallback (bool Value)
Whether the icon displayed in the
GtkImagewill use standard icon names fallback. The value of this property is only relevant for images of type %GTK_IMAGE_ICON_NAME and %GTK_IMAGE_GICON.
Value is the new property value.None.clear ()
Resets the image to be empty.
None.get_gicon ()
Gets the
GIconbeing displayed by theGtkImage. The storage type of the image must be %GTK_IMAGE_EMPTY or %GTK_IMAGE_GICON (see [method@Gtk.Image.get_storage_type]). The caller of this function does not own a reference to the returnedGIcon.
get_icon_name ()
Gets the icon name and size being displayed by the
GtkImage. The storage type of the image must be %GTK_IMAGE_EMPTY or %GTK_IMAGE_ICON_NAME (see [method@Gtk.Image.get_storage_type]). The returned string is owned by theGtkImageand should not be freed.
get_icon_size ()
Gets the icon size used by the @image when rendering icons.
get_paintable ()
Gets the image
GdkPaintablebeing displayed by theGtkImage. The storage type of the image must be %GTK_IMAGE_EMPTY or %GTK_IMAGE_PAINTABLE (see [method@Gtk.Image.get_storage_type]). The caller of this function does not own a reference to the returned paintable.
get_pixel_size ()
Gets the pixel size used for named icons.
get_storage_type ()
Gets the type of representation being used by the
GtkImageto store image data. If theGtkImagehas no image data, the return value will be %GTK_IMAGE_EMPTY.
set_from_file (string filename)
Sets a
GtkImageto show a file. See [ctor@Gtk.Image.new_from_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 aGdkTexture, and then use [method@Gtk.Image.set_from_paintable].
filename is a filename.None.set_from_gicon (object icon)
Sets a
GtkImageto show aGIcon. See [ctor@Gtk.Image.new_from_gicon] for details.
icon is an icon.None.set_from_icon_name (string icon_name)
Sets a
GtkImageto show a named icon. See [ctor@Gtk.Image.new_from_icon_name] for details.
icon_name is an icon name.None.set_from_paintable (object paintable)
Sets a
GtkImageto show aGdkPaintable. See [ctor@Gtk.Image.new_from_paintable] for details.
paintable is a GdkPaintable.None.set_from_pixbuf (object pixbuf)
Sets a
GtkImageto show aGdkPixbuf. See [ctor@Gtk.Image.new_from_pixbuf] for details. Note: This is a helper for [method@Gtk.Image.set_from_paintable], and you can't get back the exact pixbuf once this is called, only a paintable.
pixbuf is a GdkPixbuf or NULL.None.set_from_resource (string resource_path)
Sets a
GtkImageto show a resource. See [ctor@Gtk.Image.new_from_resource] for details.
resource_path is a resource path.None.set_icon_size (string icon_size)
Suggests an icon size to the theme for named icons.
icon_size is the new icon size.None.set_pixel_size (int pixel_size)
Sets the pixel size to use for named icons. If the pixel size is set to a value != -1, it is used instead of the icon size set by [method@Gtk.Image.set_icon_size].
pixel_size is the new pixel size.None.[446:14] static extends: object
Alternate constructors for Image. Usage:
ImageCtors.<name>(...). The primary constructor lives
directly on Image.
newFromFile (string filename)
Creates a new
GtkImagedisplaying the file @filename. If the file isn’t found or can’t be loaded, the resultingGtkImagewill display a “broken image” icon. This function never returns %NULL, it always returns a validGtkImagewidget. 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 theGtkImagefrom the texture. The storage type (see [method@Gtk.Image.get_storage_type]) of the returned image is not defined, it will be whatever is appropriate for displaying the file.
filename is a filename.A new Image.newFromGicon (object icon)
Creates a
GtkImagedisplaying an icon from the current icon theme. If the icon name isn’t known, a “broken image” icon will be displayed instead. If the current icon theme is changed, the icon will be updated appropriately.
icon is an icon.A new Image.newFromIconName (string icon_name)
Creates a
GtkImagedisplaying an icon from the current icon theme. If the icon name isn’t known, a “broken image” icon will be displayed instead. If the current icon theme is changed, the icon will be updated appropriately.
icon_name is an icon name.A new Image.newFromPaintable (object paintable)
Creates a new
GtkImagedisplaying @paintable. TheGtkImagedoes not assume a reference to the paintable; you still need to unref it if you own references.GtkImagewill add its own reference rather than adopting yours. TheGtkImagewill track changes to the @paintable and update its size and contents in response to it. Note that paintables are still subject to the icon size that is set on the image. If you want to display a paintable at its intrinsic size, use [class@Gtk.Picture] instead. If @paintable is a [iface@Gtk.SymbolicPaintable], then it will be recolored with the symbolic palette from the theme.
paintable is a GdkPaintable.A new Image.newFromPixbuf (object pixbuf)
Creates a new
GtkImagedisplaying @pixbuf. TheGtkImagedoes not assume a reference to the pixbuf; you still need to unref it if you own references.GtkImagewill add its own reference rather than adopting yours. This is a helper for [ctor@Gtk.Image.new_from_paintable], and you can't get back the exact pixbuf once this is called, only a texture. Note that this function just creates anGtkImagefrom the pixbuf. TheGtkImagecreated will not react to state changes. Should you want that, you should use [ctor@Gtk.Image.new_from_icon_name].
pixbuf is a GdkPixbuf.A new Image.newFromResource (string resource_path)
Creates a new
GtkImagedisplaying the resource file @resource_path. If the file isn’t found or can’t be loaded, the resultingGtkImagewill display a “broken image” icon. This function never returns %NULL, it always returns a validGtkImagewidget. 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 theGtkImagefrom the texture. The storage type (see [method@Gtk.Image.get_storage_type]) of the returned image is not defined, it will be whatever is appropriate for displaying the file.
resource_path is a resource path.A new Image.