1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19 
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 
25 module gtk.Image;
26 
27 private import cairo.Surface;
28 private import gdkpixbuf.Pixbuf;
29 private import gdkpixbuf.PixbufAnimation;
30 private import gio.Icon;
31 private import gio.IconIF;
32 private import glib.ConstructionException;
33 private import glib.Str;
34 private import gobject.ObjectG;
35 private import gtk.IconSet;
36 private import gtk.Misc;
37 private import gtk.Widget;
38 private import gtkc.gtk;
39 public  import gtkc.gtktypes;
40 
41 
42 /**
43  * The #GtkImage widget displays an image. Various kinds of object
44  * can be displayed as an image; most typically, you would load a
45  * #GdkPixbuf ("pixel buffer") from a file, and then display that.
46  * There’s a convenience function to do this, gtk_image_new_from_file(),
47  * used as follows:
48  * |[<!-- language="C" -->
49  * GtkWidget *image;
50  * image = gtk_image_new_from_file ("myfile.png");
51  * ]|
52  * If the file isn’t loaded successfully, the image will contain a
53  * “broken image” icon similar to that used in many web browsers.
54  * If you want to handle errors in loading the file yourself,
55  * for example by displaying an error message, then load the image with
56  * gdk_pixbuf_new_from_file(), then create the #GtkImage with
57  * gtk_image_new_from_pixbuf().
58  * 
59  * The image file may contain an animation, if so the #GtkImage will
60  * display an animation (#GdkPixbufAnimation) instead of a static image.
61  * 
62  * #GtkImage is a subclass of #GtkMisc, which implies that you can
63  * align it (center, left, right) and add padding to it, using
64  * #GtkMisc methods.
65  * 
66  * #GtkImage is a “no window” widget (has no #GdkWindow of its own),
67  * so by default does not receive events. If you want to receive events
68  * on the image, such as button clicks, place the image inside a
69  * #GtkEventBox, then connect to the event signals on the event box.
70  * 
71  * ## Handling button press events on a #GtkImage.
72  * 
73  * |[<!-- language="C" -->
74  * static gboolean
75  * button_press_callback (GtkWidget      *event_box,
76  * GdkEventButton *event,
77  * gpointer        data)
78  * {
79  * g_print ("Event box clicked at coordinates %f,%f\n",
80  * event->x, event->y);
81  * 
82  * // Returning TRUE means we handled the event, so the signal
83  * // emission should be stopped (don’t call any further callbacks
84  * // that may be connected). Return FALSE to continue invoking callbacks.
85  * return TRUE;
86  * }
87  * 
88  * static GtkWidget*
89  * create_image (void)
90  * {
91  * GtkWidget *image;
92  * GtkWidget *event_box;
93  * 
94  * image = gtk_image_new_from_file ("myfile.png");
95  * 
96  * event_box = gtk_event_box_new ();
97  * 
98  * gtk_container_add (GTK_CONTAINER (event_box), image);
99  * 
100  * g_signal_connect (G_OBJECT (event_box),
101  * "button_press_event",
102  * G_CALLBACK (button_press_callback),
103  * image);
104  * 
105  * return image;
106  * }
107  * ]|
108  * 
109  * When handling events on the event box, keep in mind that coordinates
110  * in the image may be different from event box coordinates due to
111  * the alignment and padding settings on the image (see #GtkMisc).
112  * The simplest way to solve this is to set the alignment to 0.0
113  * (left/top), and set the padding to zero. Then the origin of
114  * the image will be the same as the origin of the event box.
115  * 
116  * Sometimes an application will want to avoid depending on external data
117  * files, such as image files. GTK+ comes with a program to avoid this,
118  * called “gdk-pixbuf-csource”. This library
119  * allows you to convert an image into a C variable declaration, which
120  * can then be loaded into a #GdkPixbuf using
121  * gdk_pixbuf_new_from_inline().
122  * 
123  * # CSS nodes
124  * 
125  * GtkImage has a single CSS node with the name image.
126  */
127 public class Image : Misc
128 {
129 	/** the main Gtk struct */
130 	protected GtkImage* gtkImage;
131 
132 	/** Get the main Gtk struct */
133 	public GtkImage* getImageStruct()
134 	{
135 		return gtkImage;
136 	}
137 
138 	/** the main Gtk struct as a void* */
139 	protected override void* getStruct()
140 	{
141 		return cast(void*)gtkImage;
142 	}
143 
144 	protected override void setStruct(GObject* obj)
145 	{
146 		gtkImage = cast(GtkImage*)obj;
147 		super.setStruct(obj);
148 	}
149 
150 	/**
151 	 * Sets our main struct and passes it to the parent class.
152 	 */
153 	public this (GtkImage* gtkImage, bool ownedRef = false)
154 	{
155 		this.gtkImage = gtkImage;
156 		super(cast(GtkMisc*)gtkImage, ownedRef);
157 	}
158 
159 	/**
160 	 * Creates a Image displaying a stock icon. Sample stock icon
161 	 * names are StockID.OPEN, StockID.EXIT. Sample stock sizes
162 	 * are IconSize.MENU, IconSize.SMALL_TOOLBAR. If the stock
163 	 * icon name isn't known, the image will be empty.
164 	 * You can register your own stock icon names, see
165 	 * gtk.IconFactory.IconFactory.addDefault() and gtk.IconFactory.IconFactory.add().
166 	 * Params:
167 	 *  StockID = a stock icon name
168 	 *  size = a stock icon size
169 	 * Returns:
170 	 *  a new GtkImage displaying the stock icon
171 	 * Throws: ConstructionException GTK+ fails to create the object.
172 	 */
173 	public this (StockID stockID, GtkIconSize size)
174 	{
175 		auto p = gtk_image_new_from_stock(Str.toStringz(stockID), size);
176 		if(p is null)
177 		{
178 			throw new ConstructionException("null returned by gtk_image_new_from_stock(Str.toStringz(StockDesc[stockID]), size)");
179 		}
180 		this(cast(GtkImage*)p);
181 	}
182 
183 	/**
184 	 */
185 
186 	/** */
187 	public static GType getType()
188 	{
189 		return gtk_image_get_type();
190 	}
191 
192 	/**
193 	 * Creates a new empty #GtkImage widget.
194 	 *
195 	 * Return: a newly created #GtkImage widget.
196 	 *
197 	 * Throws: ConstructionException GTK+ fails to create the object.
198 	 */
199 	public this()
200 	{
201 		auto p = gtk_image_new();
202 		
203 		if(p is null)
204 		{
205 			throw new ConstructionException("null returned by new");
206 		}
207 		
208 		this(cast(GtkImage*) p);
209 	}
210 
211 	/**
212 	 * Creates a #GtkImage displaying the given animation.
213 	 * The #GtkImage does not assume a reference to the
214 	 * animation; you still need to unref it if you own references.
215 	 * #GtkImage will add its own reference rather than adopting yours.
216 	 *
217 	 * Note that the animation frames are shown using a timeout with
218 	 * #G_PRIORITY_DEFAULT. When using animations to indicate busyness,
219 	 * keep in mind that the animation will only be shown if the main loop
220 	 * is not busy with something that has a higher priority.
221 	 *
222 	 * Params:
223 	 *     animation = an animation
224 	 *
225 	 * Return: a new #GtkImage widget
226 	 *
227 	 * Throws: ConstructionException GTK+ fails to create the object.
228 	 */
229 	public this(PixbufAnimation animation)
230 	{
231 		auto p = gtk_image_new_from_animation((animation is null) ? null : animation.getPixbufAnimationStruct());
232 		
233 		if(p is null)
234 		{
235 			throw new ConstructionException("null returned by new_from_animation");
236 		}
237 		
238 		this(cast(GtkImage*) p);
239 	}
240 
241 	/**
242 	 * Creates a new #GtkImage displaying the file @filename. If the file
243 	 * isn’t found or can’t be loaded, the resulting #GtkImage will
244 	 * display a “broken image” icon. This function never returns %NULL,
245 	 * it always returns a valid #GtkImage widget.
246 	 *
247 	 * If the file contains an animation, the image will contain an
248 	 * animation.
249 	 *
250 	 * If you need to detect failures to load the file, use
251 	 * gdk_pixbuf_new_from_file() to load the file yourself, then create
252 	 * the #GtkImage from the pixbuf. (Or for animations, use
253 	 * gdk_pixbuf_animation_new_from_file()).
254 	 *
255 	 * The storage type (gtk_image_get_storage_type()) of the returned
256 	 * image is not defined, it will be whatever is appropriate for
257 	 * displaying the file.
258 	 *
259 	 * Params:
260 	 *     filename = a filename
261 	 *
262 	 * Return: a new #GtkImage
263 	 *
264 	 * Throws: ConstructionException GTK+ fails to create the object.
265 	 */
266 	public this(string filename)
267 	{
268 		auto p = gtk_image_new_from_file(Str.toStringz(filename));
269 		
270 		if(p is null)
271 		{
272 			throw new ConstructionException("null returned by new_from_file");
273 		}
274 		
275 		this(cast(GtkImage*) p);
276 	}
277 
278 	/**
279 	 * Creates a #GtkImage displaying an icon from the current icon theme.
280 	 * If the icon name isn’t known, a “broken image” icon will be
281 	 * displayed instead.  If the current icon theme is changed, the icon
282 	 * will be updated appropriately.
283 	 *
284 	 * Params:
285 	 *     icon = an icon
286 	 *     size = a stock icon size (#GtkIconSize)
287 	 *
288 	 * Return: a new #GtkImage displaying the themed icon
289 	 *
290 	 * Since: 2.14
291 	 *
292 	 * Throws: ConstructionException GTK+ fails to create the object.
293 	 */
294 	public this(IconIF icon, GtkIconSize size)
295 	{
296 		auto p = gtk_image_new_from_gicon((icon is null) ? null : icon.getIconStruct(), size);
297 		
298 		if(p is null)
299 		{
300 			throw new ConstructionException("null returned by new_from_gicon");
301 		}
302 		
303 		this(cast(GtkImage*) p);
304 	}
305 
306 	/**
307 	 * Creates a #GtkImage displaying an icon from the current icon theme.
308 	 * If the icon name isn’t known, a “broken image” icon will be
309 	 * displayed instead.  If the current icon theme is changed, the icon
310 	 * will be updated appropriately.
311 	 *
312 	 * Params:
313 	 *     iconName = an icon name
314 	 *     size = a stock icon size (#GtkIconSize)
315 	 *
316 	 * Return: a new #GtkImage displaying the themed icon
317 	 *
318 	 * Since: 2.6
319 	 *
320 	 * Throws: ConstructionException GTK+ fails to create the object.
321 	 */
322 	public this(string iconName, GtkIconSize size)
323 	{
324 		auto p = gtk_image_new_from_icon_name(Str.toStringz(iconName), size);
325 		
326 		if(p is null)
327 		{
328 			throw new ConstructionException("null returned by new_from_icon_name");
329 		}
330 		
331 		this(cast(GtkImage*) p);
332 	}
333 
334 	/**
335 	 * Creates a #GtkImage displaying an icon set. Sample stock sizes are
336 	 * #GTK_ICON_SIZE_MENU, #GTK_ICON_SIZE_SMALL_TOOLBAR. Instead of using
337 	 * this function, usually it’s better to create a #GtkIconFactory, put
338 	 * your icon sets in the icon factory, add the icon factory to the
339 	 * list of default factories with gtk_icon_factory_add_default(), and
340 	 * then use gtk_image_new_from_stock(). This will allow themes to
341 	 * override the icon you ship with your application.
342 	 *
343 	 * The #GtkImage does not assume a reference to the
344 	 * icon set; you still need to unref it if you own references.
345 	 * #GtkImage will add its own reference rather than adopting yours.
346 	 *
347 	 * Deprecated: Use gtk_image_new_from_icon_name() instead.
348 	 *
349 	 * Params:
350 	 *     iconSet = a #GtkIconSet
351 	 *     size = a stock icon size (#GtkIconSize)
352 	 *
353 	 * Return: a new #GtkImage
354 	 *
355 	 * Throws: ConstructionException GTK+ fails to create the object.
356 	 */
357 	public this(IconSet iconSet, GtkIconSize size)
358 	{
359 		auto p = gtk_image_new_from_icon_set((iconSet is null) ? null : iconSet.getIconSetStruct(), size);
360 		
361 		if(p is null)
362 		{
363 			throw new ConstructionException("null returned by new_from_icon_set");
364 		}
365 		
366 		this(cast(GtkImage*) p);
367 	}
368 
369 	/**
370 	 * Creates a new #GtkImage displaying @pixbuf.
371 	 * The #GtkImage does not assume a reference to the
372 	 * pixbuf; you still need to unref it if you own references.
373 	 * #GtkImage will add its own reference rather than adopting yours.
374 	 *
375 	 * Note that this function just creates an #GtkImage from the pixbuf. The
376 	 * #GtkImage created will not react to state changes. Should you want that,
377 	 * you should use gtk_image_new_from_icon_name().
378 	 *
379 	 * Params:
380 	 *     pixbuf = a #GdkPixbuf, or %NULL
381 	 *
382 	 * Return: a new #GtkImage
383 	 *
384 	 * Throws: ConstructionException GTK+ fails to create the object.
385 	 */
386 	public this(Pixbuf pixbuf)
387 	{
388 		auto p = gtk_image_new_from_pixbuf((pixbuf is null) ? null : pixbuf.getPixbufStruct());
389 		
390 		if(p is null)
391 		{
392 			throw new ConstructionException("null returned by new_from_pixbuf");
393 		}
394 		
395 		this(cast(GtkImage*) p);
396 	}
397 
398 	/**
399 	 * Creates a new #GtkImage displaying @surface.
400 	 * The #GtkImage does not assume a reference to the
401 	 * surface; you still need to unref it if you own references.
402 	 * #GtkImage will add its own reference rather than adopting yours.
403 	 *
404 	 * Params:
405 	 *     surface = a #cairo_surface_t, or %NULL
406 	 *
407 	 * Return: a new #GtkImage
408 	 *
409 	 * Since: 3.10
410 	 *
411 	 * Throws: ConstructionException GTK+ fails to create the object.
412 	 */
413 	public this(Surface surface)
414 	{
415 		auto p = gtk_image_new_from_surface((surface is null) ? null : surface.getSurfaceStruct());
416 		
417 		if(p is null)
418 		{
419 			throw new ConstructionException("null returned by new_from_surface");
420 		}
421 		
422 		this(cast(GtkImage*) p);
423 	}
424 
425 	/**
426 	 * Resets the image to be empty.
427 	 *
428 	 * Since: 2.8
429 	 */
430 	public void clear()
431 	{
432 		gtk_image_clear(gtkImage);
433 	}
434 
435 	/**
436 	 * Gets the #GdkPixbufAnimation being displayed by the #GtkImage.
437 	 * The storage type of the image must be %GTK_IMAGE_EMPTY or
438 	 * %GTK_IMAGE_ANIMATION (see gtk_image_get_storage_type()).
439 	 * The caller of this function does not own a reference to the
440 	 * returned animation.
441 	 *
442 	 * Return: the displayed animation, or %NULL if
443 	 *     the image is empty
444 	 */
445 	public PixbufAnimation getAnimation()
446 	{
447 		auto p = gtk_image_get_animation(gtkImage);
448 		
449 		if(p is null)
450 		{
451 			return null;
452 		}
453 		
454 		return ObjectG.getDObject!(PixbufAnimation)(cast(GdkPixbufAnimation*) p);
455 	}
456 
457 	/**
458 	 * Gets the #GIcon and size being displayed by the #GtkImage.
459 	 * The storage type of the image must be %GTK_IMAGE_EMPTY or
460 	 * %GTK_IMAGE_GICON (see gtk_image_get_storage_type()).
461 	 * The caller of this function does not own a reference to the
462 	 * returned #GIcon.
463 	 *
464 	 * Params:
465 	 *     gicon = place to store a
466 	 *         #GIcon, or %NULL
467 	 *     size = place to store an icon size
468 	 *         (#GtkIconSize), or %NULL
469 	 *
470 	 * Since: 2.14
471 	 */
472 	public void getGicon(out IconIF gicon, out GtkIconSize size)
473 	{
474 		GIcon* outgicon = null;
475 		
476 		gtk_image_get_gicon(gtkImage, &outgicon, &size);
477 		
478 		gicon = ObjectG.getDObject!(Icon, IconIF)(outgicon);
479 	}
480 
481 	/**
482 	 * Gets the icon name and size being displayed by the #GtkImage.
483 	 * The storage type of the image must be %GTK_IMAGE_EMPTY or
484 	 * %GTK_IMAGE_ICON_NAME (see gtk_image_get_storage_type()).
485 	 * The returned string is owned by the #GtkImage and should not
486 	 * be freed.
487 	 *
488 	 * Params:
489 	 *     iconName = place to store an
490 	 *         icon name, or %NULL
491 	 *     size = place to store an icon size
492 	 *         (#GtkIconSize), or %NULL
493 	 *
494 	 * Since: 2.6
495 	 */
496 	public void getIconName(out string iconName, out GtkIconSize size)
497 	{
498 		char* outiconName = null;
499 		
500 		gtk_image_get_icon_name(gtkImage, &outiconName, &size);
501 		
502 		iconName = Str.toString(outiconName);
503 	}
504 
505 	/**
506 	 * Gets the icon set and size being displayed by the #GtkImage.
507 	 * The storage type of the image must be %GTK_IMAGE_EMPTY or
508 	 * %GTK_IMAGE_ICON_SET (see gtk_image_get_storage_type()).
509 	 *
510 	 * Deprecated: Use gtk_image_get_icon_name() instead.
511 	 *
512 	 * Params:
513 	 *     iconSet = location to store a
514 	 *         #GtkIconSet, or %NULL
515 	 *     size = location to store a stock
516 	 *         icon size (#GtkIconSize), or %NULL
517 	 */
518 	public void getIconSet(out IconSet iconSet, out GtkIconSize size)
519 	{
520 		GtkIconSet* outiconSet = null;
521 		
522 		gtk_image_get_icon_set(gtkImage, &outiconSet, &size);
523 		
524 		iconSet = ObjectG.getDObject!(IconSet)(outiconSet);
525 	}
526 
527 	/**
528 	 * Gets the #GdkPixbuf being displayed by the #GtkImage.
529 	 * The storage type of the image must be %GTK_IMAGE_EMPTY or
530 	 * %GTK_IMAGE_PIXBUF (see gtk_image_get_storage_type()).
531 	 * The caller of this function does not own a reference to the
532 	 * returned pixbuf.
533 	 *
534 	 * Return: the displayed pixbuf, or %NULL if
535 	 *     the image is empty
536 	 */
537 	public Pixbuf getPixbuf()
538 	{
539 		auto p = gtk_image_get_pixbuf(gtkImage);
540 		
541 		if(p is null)
542 		{
543 			return null;
544 		}
545 		
546 		return ObjectG.getDObject!(Pixbuf)(cast(GdkPixbuf*) p);
547 	}
548 
549 	/**
550 	 * Gets the pixel size used for named icons.
551 	 *
552 	 * Return: the pixel size used for named icons.
553 	 *
554 	 * Since: 2.6
555 	 */
556 	public int getPixelSize()
557 	{
558 		return gtk_image_get_pixel_size(gtkImage);
559 	}
560 
561 	/**
562 	 * Gets the stock icon name and size being displayed by the #GtkImage.
563 	 * The storage type of the image must be %GTK_IMAGE_EMPTY or
564 	 * %GTK_IMAGE_STOCK (see gtk_image_get_storage_type()).
565 	 * The returned string is owned by the #GtkImage and should not
566 	 * be freed.
567 	 *
568 	 * Deprecated: Use gtk_image_get_icon_name() instead.
569 	 *
570 	 * Params:
571 	 *     stockId = place to store a
572 	 *         stock icon name, or %NULL
573 	 *     size = place to store a stock icon
574 	 *         size (#GtkIconSize), or %NULL
575 	 */
576 	public void getStock(out string stockId, out GtkIconSize size)
577 	{
578 		char* outstockId = null;
579 		
580 		gtk_image_get_stock(gtkImage, &outstockId, &size);
581 		
582 		stockId = Str.toString(outstockId);
583 	}
584 
585 	/**
586 	 * Gets the type of representation being used by the #GtkImage
587 	 * to store image data. If the #GtkImage has no image data,
588 	 * the return value will be %GTK_IMAGE_EMPTY.
589 	 *
590 	 * Return: image representation being used
591 	 */
592 	public GtkImageType getStorageType()
593 	{
594 		return gtk_image_get_storage_type(gtkImage);
595 	}
596 
597 	/**
598 	 * Causes the #GtkImage to display the given animation (or display
599 	 * nothing, if you set the animation to %NULL).
600 	 *
601 	 * Params:
602 	 *     animation = the #GdkPixbufAnimation
603 	 */
604 	public void setFromAnimation(PixbufAnimation animation)
605 	{
606 		gtk_image_set_from_animation(gtkImage, (animation is null) ? null : animation.getPixbufAnimationStruct());
607 	}
608 
609 	/**
610 	 * See gtk_image_new_from_file() for details.
611 	 *
612 	 * Params:
613 	 *     filename = a filename or %NULL
614 	 */
615 	public void setFromFile(string filename)
616 	{
617 		gtk_image_set_from_file(gtkImage, Str.toStringz(filename));
618 	}
619 
620 	/**
621 	 * See gtk_image_new_from_gicon() for details.
622 	 *
623 	 * Params:
624 	 *     icon = an icon
625 	 *     size = an icon size (#GtkIconSize)
626 	 *
627 	 * Since: 2.14
628 	 */
629 	public void setFromGicon(IconIF icon, GtkIconSize size)
630 	{
631 		gtk_image_set_from_gicon(gtkImage, (icon is null) ? null : icon.getIconStruct(), size);
632 	}
633 
634 	/**
635 	 * See gtk_image_new_from_icon_name() for details.
636 	 *
637 	 * Params:
638 	 *     iconName = an icon name
639 	 *     size = an icon size (#GtkIconSize)
640 	 *
641 	 * Since: 2.6
642 	 */
643 	public void setFromIconName(string iconName, GtkIconSize size)
644 	{
645 		gtk_image_set_from_icon_name(gtkImage, Str.toStringz(iconName), size);
646 	}
647 
648 	/**
649 	 * See gtk_image_new_from_icon_set() for details.
650 	 *
651 	 * Deprecated: Use gtk_image_set_from_icon_name() instead.
652 	 *
653 	 * Params:
654 	 *     iconSet = a #GtkIconSet
655 	 *     size = a stock icon size (#GtkIconSize)
656 	 */
657 	public void setFromIconSet(IconSet iconSet, GtkIconSize size)
658 	{
659 		gtk_image_set_from_icon_set(gtkImage, (iconSet is null) ? null : iconSet.getIconSetStruct(), size);
660 	}
661 
662 	/**
663 	 * See gtk_image_new_from_pixbuf() for details.
664 	 *
665 	 * Params:
666 	 *     pixbuf = a #GdkPixbuf or %NULL
667 	 */
668 	public void setFromPixbuf(Pixbuf pixbuf)
669 	{
670 		gtk_image_set_from_pixbuf(gtkImage, (pixbuf is null) ? null : pixbuf.getPixbufStruct());
671 	}
672 
673 	/**
674 	 * See gtk_image_new_from_resource() for details.
675 	 *
676 	 * Params:
677 	 *     resourcePath = a resource path or %NULL
678 	 */
679 	public void setFromResource(string resourcePath)
680 	{
681 		gtk_image_set_from_resource(gtkImage, Str.toStringz(resourcePath));
682 	}
683 
684 	/**
685 	 * See gtk_image_new_from_stock() for details.
686 	 *
687 	 * Deprecated: Use gtk_image_set_from_icon_name() instead.
688 	 *
689 	 * Params:
690 	 *     stockId = a stock icon name
691 	 *     size = a stock icon size (#GtkIconSize)
692 	 */
693 	public void setFromStock(string stockId, GtkIconSize size)
694 	{
695 		gtk_image_set_from_stock(gtkImage, Str.toStringz(stockId), size);
696 	}
697 
698 	/**
699 	 * See gtk_image_new_from_surface() for details.
700 	 *
701 	 * Params:
702 	 *     surface = a cairo_surface_t
703 	 *
704 	 * Since: 3.10
705 	 */
706 	public void setFromSurface(Surface surface)
707 	{
708 		gtk_image_set_from_surface(gtkImage, (surface is null) ? null : surface.getSurfaceStruct());
709 	}
710 
711 	/**
712 	 * Sets the pixel size to use for named icons. If the pixel size is set
713 	 * to a value != -1, it is used instead of the icon size set by
714 	 * gtk_image_set_from_icon_name().
715 	 *
716 	 * Params:
717 	 *     pixelSize = the new pixel size
718 	 *
719 	 * Since: 2.6
720 	 */
721 	public void setPixelSize(int pixelSize)
722 	{
723 		gtk_image_set_pixel_size(gtkImage, pixelSize);
724 	}
725 }