It derives from <GtkWidget>.
Displays an image.
Various kinds of object can be displayed as an image; most typically,
you would load a <GdkTexture> from a file,
using the convenience function image:new-from-file, for instance:
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 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, image:resource,
image:new-from-resource, and
image:set-from-resource should be
used.
<GtkImage> displays its image as an icon, with a
size that is determined by the application. See
<GtkPicture> if you want to show an image at is
actual size.
<GtkImage> has a single CSS node with the name
image. The style classes .normal-icons or
.large-icons may appear, depending on the image:icon-size property.
<GtkImage> uses the Gtk.AccessibleRole.img
role.
A path to the file to display.
Its value is a string, or #f.
Set it with (set! (image:file self) value).
The <GIcon> displayed in the GtkImage.
For themed icons, If the icon theme is changed, the image will be updated automatically.
Its value is a <GIcon>, or #f.
Set it with (set! (image:gicon self) value).
The name of the icon in the icon theme.
If the icon theme is changed, the image will be updated automatically.
Its value is a string, or #f.
Set it with (set! (image:icon-name self) value).
The symbolic size to display icons at.
Its value is a <GtkIconSize> (or, to set it, one
of its symbols).
Set it with (set! (image:icon-size self) value).
The <GdkPaintable> to display.
Its value is a <GdkPaintable>, or #f.
Set it with (set! (image:paintable self) value).
The size in pixels to display icons at.
If set to a value != -1, this property overrides the image:icon-size property for images of type
icon-name.
Its value is a 32-bit integer.
Set it with (set! (image:pixel-size self) value).
A path to a resource file to display.
Its value is a string, or #f.
Set it with (set! (image:resource self) value).
The representation being used for image data.
Its value is a <GtkImageType>.
It is read only.
Whether the icon displayed in the <GtkImage> will
use standard icon names fallback.
The value of this property is only relevant for images of type
icon-name and gicon.
Its value is a boolean.
Set it with (set! (image:use-fallback self) value).
Resets the image to be empty.
Passed: a <GtkImage>.
Gets the <GIcon> being displayed by the
<GtkImage>.
The storage type of the image must be empty or
gicon (see image:get-storage-type). The caller of this
function does not own a reference to the returned
<GIcon>.
Passed: a <GtkImage>.
Returned: a <GIcon>, or #f.
a <GIcon>
Gets the icon name and size being displayed by the
<GtkImage>.
The storage type of the image must be empty or
icon-name (see image:get-storage-type). The returned string is
owned by the <GtkImage> and should not be freed.
Passed: a <GtkImage>.
Returned: a string, or #f.
the icon name
Gets the icon size used by the self when rendering icons.
Passed: a <GtkImage>.
Returned: a <GtkIconSize>.
the image size used by icons
Gets the image <GdkPaintable> being
displayed by the <GtkImage>.
The storage type of the image must be empty or
paintable (see image:get-storage-type). The caller of this
function does not own a reference to the returned paintable.
Passed: a <GtkImage>.
Returned: a <GdkPaintable>, or #f.
the displayed paintable
Gets the pixel size used for named icons.
Passed: a <GtkImage>.
Returned: a 32-bit integer.
the pixel size used for named icons.
Gets the type of representation being used by the
<GtkImage> to store image data.
If the <GtkImage> has no image data, the return
value will be empty.
Passed: a <GtkImage>.
Returned: a <GtkImageType>.
image representation being used
Creates a new empty <GtkImage> widget.
Returned: a <GtkWidget>.
a newly created <GtkImage> widget.
Creates a new <GtkImage> displaying the file
filename.
If the file isn’t found or can’t be loaded, the resulting
<GtkImage> will display a “broken image” icon. This
function never returns #f, it always returns a valid
<GtkImage> widget.
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 the
<GtkImage> from the texture.
The storage type (see image:get-storage-type) of the returned image is not
defined, it will be whatever is appropriate for displaying the file.
Passed: a file name, as a string.
a filename
Returned: a <GtkWidget>.
a new <GtkImage>
Creates a <GtkImage> displaying 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.
Passed: a <GIcon>.
an icon
Returned: a <GtkWidget>.
a new <GtkImage> displaying the themed icon
Creates a <GtkImage> displaying 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.
Passed, or left out: a string, or #f.
an icon name
Returned: a <GtkWidget>.
a new <GtkImage> displaying the themed icon
Creates a new <GtkImage> displaying paintable.
The <GtkImage> does not assume a reference to the
paintable; you still need to unref it if you own references.
<GtkImage> will add its own reference rather than
adopting yours.
The <GtkImage> will 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 <GtkPicture> instead.
If paintable is a
<GtkSymbolicPaintable>, then it will be
recolored with the symbolic palette from the theme.
Passed, or left out: a <GdkPaintable>, or
#f.
Returned: a <GtkWidget>.
a new <GtkImage>
Creates a new <GtkImage> displaying pixbuf.
The <GtkImage> does not assume a reference to the
pixbuf; you still need to unref it if you own references.
<GtkImage> will add its own reference rather than
adopting yours.
This is a helper for 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 an <GtkImage>
from the pixbuf. The <GtkImage> created will not
react to state changes. Should you want that, you should use
image:new-from-icon-name.
Passed, or left out: a <GdkPixbuf>, or
#f.
Returned: a <GtkWidget>.
a new <GtkImage>
Creates a new <GtkImage> displaying the resource
file resource-path.
If the file isn’t found or can’t be loaded, the resulting
<GtkImage> will display a “broken image” icon. This
function never returns #f, it always returns a valid
<GtkImage> widget.
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 the
<GtkImage> from the texture.
The storage type (see image:get-storage-type) of the returned image is not
defined, it will be whatever is appropriate for displaying the file.
Passed: a string.
a resource path
Returned: a <GtkWidget>.
a new <GtkImage>
Sets a <GtkImage> to show a file.
See 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 a <GdkTexture>,
and then use image:set-from-paintable.
Passed: a <GtkImage>.
Passed, or left out: a file name, as a string, or #f.
a filename
Sets a <GtkImage> to show a
<GIcon>.
See image:new-from-gicon for details.
Passed: a <GtkImage>.
Passed: a <GIcon>.
an icon
Sets a <GtkImage> to show a named icon.
See image:new-from-icon-name for
details.
Passed: a <GtkImage>.
Passed, or left out: a string, or #f.
an icon name
Sets a <GtkImage> to show a
<GdkPaintable>.
See image:new-from-paintable for
details.
Passed: a <GtkImage>.
Passed, or left out: a <GdkPaintable>, or
#f.
Sets a <GtkImage> to show a
<GdkPixbuf>.
See image:new-from-pixbuf for
details.
Note: This is a helper for image:set-from-paintable, and you can’t get back
the exact pixbuf once this is called, only a paintable.
Passed: a <GtkImage>.
Passed, or left out: a <GdkPixbuf>, or
#f.
a <GdkPixbuf> or NULL
Sets a <GtkImage> to show a resource.
See image:new-from-resource for
details.
Passed: a <GtkImage>.
Passed, or left out: a string, or #f.
a resource path
Suggests an icon size to the theme for named icons.
Passed: a <GtkImage>.
Passed: a <GtkIconSize>, or one of its symbols.
the new icon 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 image:set-icon-size.
Passed: a <GtkImage>.
Passed: a 32-bit integer.
the new pixel size