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 public class Image : Misc
124 {
125 	/** the main Gtk struct */
126 	protected GtkImage* gtkImage;
127 
128 	/** Get the main Gtk struct */
129 	public GtkImage* getImageStruct()
130 	{
131 		return gtkImage;
132 	}
133 
134 	/** the main Gtk struct as a void* */
135 	protected override void* getStruct()
136 	{
137 		return cast(void*)gtkImage;
138 	}
139 
140 	protected override void setStruct(GObject* obj)
141 	{
142 		gtkImage = cast(GtkImage*)obj;
143 		super.setStruct(obj);
144 	}
145 
146 	/**
147 	 * Sets our main struct and passes it to the parent class.
148 	 */
149 	public this (GtkImage* gtkImage, bool ownedRef = false)
150 	{
151 		this.gtkImage = gtkImage;
152 		super(cast(GtkMisc*)gtkImage, ownedRef);
153 	}
154 
155 	/**
156 	 * Creates a Image displaying a stock icon. Sample stock icon
157 	 * names are StockID.OPEN, StockID.EXIT. Sample stock sizes
158 	 * are IconSize.MENU, IconSize.SMALL_TOOLBAR. If the stock
159 	 * icon name isn't known, the image will be empty.
160 	 * You can register your own stock icon names, see
161 	 * gtk.IconFactory.IconFactory.addDefault() and gtk.IconFactory.IconFactory.add().
162 	 * Params:
163 	 *  StockID = a stock icon name
164 	 *  size = a stock icon size
165 	 * Returns:
166 	 *  a new GtkImage displaying the stock icon
167 	 * Throws: ConstructionException GTK+ fails to create the object.
168 	 */
169 	public this (StockID stockID, GtkIconSize size)
170 	{
171 		auto p = gtk_image_new_from_stock(Str.toStringz(stockID), size);
172 		if(p is null)
173 		{
174 			throw new ConstructionException("null returned by gtk_image_new_from_stock(Str.toStringz(StockDesc[stockID]), size)");
175 		}
176 		this(cast(GtkImage*)p);
177 	}
178 
179 	/**
180 	 */
181 
182 	public static GType getType()
183 	{
184 		return gtk_image_get_type();
185 	}
186 
187 	/**
188 	 * Creates a new empty #GtkImage widget.
189 	 *
190 	 * Return: a newly created #GtkImage widget.
191 	 *
192 	 * Throws: ConstructionException GTK+ fails to create the object.
193 	 */
194 	public this()
195 	{
196 		auto p = gtk_image_new();
197 		
198 		if(p is null)
199 		{
200 			throw new ConstructionException("null returned by new");
201 		}
202 		
203 		this(cast(GtkImage*) p);
204 	}
205 
206 	/**
207 	 * Creates a #GtkImage displaying the given animation.
208 	 * The #GtkImage does not assume a reference to the
209 	 * animation; you still need to unref it if you own references.
210 	 * #GtkImage will add its own reference rather than adopting yours.
211 	 *
212 	 * Note that the animation frames are shown using a timeout with
213 	 * #G_PRIORITY_DEFAULT. When using animations to indicate busyness,
214 	 * keep in mind that the animation will only be shown if the main loop
215 	 * is not busy with something that has a higher priority.
216 	 *
217 	 * Params:
218 	 *     animation = an animation
219 	 *
220 	 * Return: a new #GtkImage widget
221 	 *
222 	 * Throws: ConstructionException GTK+ fails to create the object.
223 	 */
224 	public this(PixbufAnimation animation)
225 	{
226 		auto p = gtk_image_new_from_animation((animation is null) ? null : animation.getPixbufAnimationStruct());
227 		
228 		if(p is null)
229 		{
230 			throw new ConstructionException("null returned by new_from_animation");
231 		}
232 		
233 		this(cast(GtkImage*) p);
234 	}
235 
236 	/**
237 	 * Creates a new #GtkImage displaying the file @filename. If the file
238 	 * isn’t found or can’t be loaded, the resulting #GtkImage will
239 	 * display a “broken image” icon. This function never returns %NULL,
240 	 * it always returns a valid #GtkImage widget.
241 	 *
242 	 * If the file contains an animation, the image will contain an
243 	 * animation.
244 	 *
245 	 * If you need to detect failures to load the file, use
246 	 * gdk_pixbuf_new_from_file() to load the file yourself, then create
247 	 * the #GtkImage from the pixbuf. (Or for animations, use
248 	 * gdk_pixbuf_animation_new_from_file()).
249 	 *
250 	 * The storage type (gtk_image_get_storage_type()) of the returned
251 	 * image is not defined, it will be whatever is appropriate for
252 	 * displaying the file.
253 	 *
254 	 * Params:
255 	 *     filename = a filename
256 	 *
257 	 * Return: a new #GtkImage
258 	 *
259 	 * Throws: ConstructionException GTK+ fails to create the object.
260 	 */
261 	public this(string filename)
262 	{
263 		auto p = gtk_image_new_from_file(Str.toStringz(filename));
264 		
265 		if(p is null)
266 		{
267 			throw new ConstructionException("null returned by new_from_file");
268 		}
269 		
270 		this(cast(GtkImage*) p);
271 	}
272 
273 	/**
274 	 * Creates a #GtkImage displaying an icon from the current icon theme.
275 	 * If the icon name isn’t known, a “broken image” icon will be
276 	 * displayed instead.  If the current icon theme is changed, the icon
277 	 * will be updated appropriately.
278 	 *
279 	 * Params:
280 	 *     icon = an icon
281 	 *     size = a stock icon size
282 	 *
283 	 * Return: a new #GtkImage displaying the themed icon
284 	 *
285 	 * Since: 2.14
286 	 *
287 	 * Throws: ConstructionException GTK+ fails to create the object.
288 	 */
289 	public this(IconIF icon, GtkIconSize size)
290 	{
291 		auto p = gtk_image_new_from_gicon((icon is null) ? null : icon.getIconStruct(), size);
292 		
293 		if(p is null)
294 		{
295 			throw new ConstructionException("null returned by new_from_gicon");
296 		}
297 		
298 		this(cast(GtkImage*) p);
299 	}
300 
301 	/**
302 	 * Creates a #GtkImage displaying an icon from the current icon theme.
303 	 * If the icon name isn’t known, a “broken image” icon will be
304 	 * displayed instead.  If the current icon theme is changed, the icon
305 	 * will be updated appropriately.
306 	 *
307 	 * Params:
308 	 *     iconName = an icon name
309 	 *     size = a stock icon size
310 	 *
311 	 * Return: a new #GtkImage displaying the themed icon
312 	 *
313 	 * Since: 2.6
314 	 *
315 	 * Throws: ConstructionException GTK+ fails to create the object.
316 	 */
317 	public this(string iconName, GtkIconSize size)
318 	{
319 		auto p = gtk_image_new_from_icon_name(Str.toStringz(iconName), size);
320 		
321 		if(p is null)
322 		{
323 			throw new ConstructionException("null returned by new_from_icon_name");
324 		}
325 		
326 		this(cast(GtkImage*) p);
327 	}
328 
329 	/**
330 	 * Creates a #GtkImage displaying an icon set. Sample stock sizes are
331 	 * #GTK_ICON_SIZE_MENU, #GTK_ICON_SIZE_SMALL_TOOLBAR. Instead of using
332 	 * this function, usually it’s better to create a #GtkIconFactory, put
333 	 * your icon sets in the icon factory, add the icon factory to the
334 	 * list of default factories with gtk_icon_factory_add_default(), and
335 	 * then use gtk_image_new_from_stock(). This will allow themes to
336 	 * override the icon you ship with your application.
337 	 *
338 	 * The #GtkImage does not assume a reference to the
339 	 * icon set; you still need to unref it if you own references.
340 	 * #GtkImage will add its own reference rather than adopting yours.
341 	 *
342 	 * Deprecated: Use gtk_image_new_from_icon_name() instead.
343 	 *
344 	 * Params:
345 	 *     iconSet = a #GtkIconSet
346 	 *     size = a stock icon size
347 	 *
348 	 * Return: a new #GtkImage
349 	 *
350 	 * Throws: ConstructionException GTK+ fails to create the object.
351 	 */
352 	public this(IconSet iconSet, GtkIconSize size)
353 	{
354 		auto p = gtk_image_new_from_icon_set((iconSet is null) ? null : iconSet.getIconSetStruct(), size);
355 		
356 		if(p is null)
357 		{
358 			throw new ConstructionException("null returned by new_from_icon_set");
359 		}
360 		
361 		this(cast(GtkImage*) p);
362 	}
363 
364 	/**
365 	 * Creates a new #GtkImage displaying @pixbuf.
366 	 * The #GtkImage does not assume a reference to the
367 	 * pixbuf; you still need to unref it if you own references.
368 	 * #GtkImage will add its own reference rather than adopting yours.
369 	 *
370 	 * Note that this function just creates an #GtkImage from the pixbuf. The
371 	 * #GtkImage created will not react to state changes. Should you want that,
372 	 * you should use gtk_image_new_from_icon_name().
373 	 *
374 	 * Params:
375 	 *     pixbuf = a #GdkPixbuf, or %NULL
376 	 *
377 	 * Return: a new #GtkImage
378 	 *
379 	 * Throws: ConstructionException GTK+ fails to create the object.
380 	 */
381 	public this(Pixbuf pixbuf)
382 	{
383 		auto p = gtk_image_new_from_pixbuf((pixbuf is null) ? null : pixbuf.getPixbufStruct());
384 		
385 		if(p is null)
386 		{
387 			throw new ConstructionException("null returned by new_from_pixbuf");
388 		}
389 		
390 		this(cast(GtkImage*) p);
391 	}
392 
393 	/**
394 	 * Creates a new #GtkImage displaying @surface.
395 	 * The #GtkImage does not assume a reference to the
396 	 * surface; you still need to unref it if you own references.
397 	 * #GtkImage will add its own reference rather than adopting yours.
398 	 *
399 	 * Params:
400 	 *     surface = a #cairo_surface_t, or %NULL
401 	 *
402 	 * Return: a new #GtkImage
403 	 *
404 	 * Since: 3.10
405 	 *
406 	 * Throws: ConstructionException GTK+ fails to create the object.
407 	 */
408 	public this(Surface surface)
409 	{
410 		auto p = gtk_image_new_from_surface((surface is null) ? null : surface.getSurfaceStruct());
411 		
412 		if(p is null)
413 		{
414 			throw new ConstructionException("null returned by new_from_surface");
415 		}
416 		
417 		this(cast(GtkImage*) p);
418 	}
419 
420 	/**
421 	 * Resets the image to be empty.
422 	 *
423 	 * Since: 2.8
424 	 */
425 	public void clear()
426 	{
427 		gtk_image_clear(gtkImage);
428 	}
429 
430 	/**
431 	 * Gets the #GdkPixbufAnimation being displayed by the #GtkImage.
432 	 * The storage type of the image must be %GTK_IMAGE_EMPTY or
433 	 * %GTK_IMAGE_ANIMATION (see gtk_image_get_storage_type()).
434 	 * The caller of this function does not own a reference to the
435 	 * returned animation.
436 	 *
437 	 * Return: the displayed animation, or %NULL if
438 	 *     the image is empty
439 	 */
440 	public PixbufAnimation getAnimation()
441 	{
442 		auto p = gtk_image_get_animation(gtkImage);
443 		
444 		if(p is null)
445 		{
446 			return null;
447 		}
448 		
449 		return ObjectG.getDObject!(PixbufAnimation)(cast(GdkPixbufAnimation*) p);
450 	}
451 
452 	/**
453 	 * Gets the #GIcon and size being displayed by the #GtkImage.
454 	 * The storage type of the image must be %GTK_IMAGE_EMPTY or
455 	 * %GTK_IMAGE_GICON (see gtk_image_get_storage_type()).
456 	 * The caller of this function does not own a reference to the
457 	 * returned #GIcon.
458 	 *
459 	 * Params:
460 	 *     gicon = place to store a
461 	 *         #GIcon, or %NULL
462 	 *     size = place to store an icon size,
463 	 *         or %NULL
464 	 *
465 	 * Since: 2.14
466 	 */
467 	public void getGicon(out IconIF gicon, out GtkIconSize size)
468 	{
469 		GIcon* outgicon = null;
470 		
471 		gtk_image_get_gicon(gtkImage, &outgicon, &size);
472 		
473 		gicon = ObjectG.getDObject!(Icon, IconIF)(outgicon);
474 	}
475 
476 	/**
477 	 * Gets the icon name and size being displayed by the #GtkImage.
478 	 * The storage type of the image must be %GTK_IMAGE_EMPTY or
479 	 * %GTK_IMAGE_ICON_NAME (see gtk_image_get_storage_type()).
480 	 * The returned string is owned by the #GtkImage and should not
481 	 * be freed.
482 	 *
483 	 * Params:
484 	 *     iconName = place to store an
485 	 *         icon name, or %NULL
486 	 *     size = place to store an icon size,
487 	 *         or %NULL
488 	 *
489 	 * Since: 2.6
490 	 */
491 	public void getIconName(out string iconName, out GtkIconSize size)
492 	{
493 		char* outiconName = null;
494 		
495 		gtk_image_get_icon_name(gtkImage, &outiconName, &size);
496 		
497 		iconName = Str.toString(outiconName);
498 	}
499 
500 	/**
501 	 * Gets the icon set and size being displayed by the #GtkImage.
502 	 * The storage type of the image must be %GTK_IMAGE_EMPTY or
503 	 * %GTK_IMAGE_ICON_SET (see gtk_image_get_storage_type()).
504 	 *
505 	 * Deprecated: Use gtk_image_get_icon_name() instead.
506 	 *
507 	 * Params:
508 	 *     iconSet = location to store a
509 	 *         #GtkIconSet, or %NULL
510 	 *     size = location to store a stock
511 	 *         icon size, or %NULL
512 	 */
513 	public void getIconSet(out IconSet iconSet, out GtkIconSize size)
514 	{
515 		GtkIconSet* outiconSet = null;
516 		
517 		gtk_image_get_icon_set(gtkImage, &outiconSet, &size);
518 		
519 		iconSet = ObjectG.getDObject!(IconSet)(outiconSet);
520 	}
521 
522 	/**
523 	 * Gets the #GdkPixbuf being displayed by the #GtkImage.
524 	 * The storage type of the image must be %GTK_IMAGE_EMPTY or
525 	 * %GTK_IMAGE_PIXBUF (see gtk_image_get_storage_type()).
526 	 * The caller of this function does not own a reference to the
527 	 * returned pixbuf.
528 	 *
529 	 * Return: the displayed pixbuf, or %NULL if
530 	 *     the image is empty
531 	 */
532 	public Pixbuf getPixbuf()
533 	{
534 		auto p = gtk_image_get_pixbuf(gtkImage);
535 		
536 		if(p is null)
537 		{
538 			return null;
539 		}
540 		
541 		return ObjectG.getDObject!(Pixbuf)(cast(GdkPixbuf*) p);
542 	}
543 
544 	/**
545 	 * Gets the pixel size used for named icons.
546 	 *
547 	 * Return: the pixel size used for named icons.
548 	 *
549 	 * Since: 2.6
550 	 */
551 	public int getPixelSize()
552 	{
553 		return gtk_image_get_pixel_size(gtkImage);
554 	}
555 
556 	/**
557 	 * Gets the stock icon name and size being displayed by the #GtkImage.
558 	 * The storage type of the image must be %GTK_IMAGE_EMPTY or
559 	 * %GTK_IMAGE_STOCK (see gtk_image_get_storage_type()).
560 	 * The returned string is owned by the #GtkImage and should not
561 	 * be freed.
562 	 *
563 	 * Deprecated: Use gtk_image_get_icon_name() instead.
564 	 *
565 	 * Params:
566 	 *     stockId = place to store a
567 	 *         stock icon name, or %NULL
568 	 *     size = place to store a stock icon
569 	 *         size, or %NULL
570 	 */
571 	public void getStock(out string stockId, out GtkIconSize size)
572 	{
573 		char* outstockId = null;
574 		
575 		gtk_image_get_stock(gtkImage, &outstockId, &size);
576 		
577 		stockId = Str.toString(outstockId);
578 	}
579 
580 	/**
581 	 * Gets the type of representation being used by the #GtkImage
582 	 * to store image data. If the #GtkImage has no image data,
583 	 * the return value will be %GTK_IMAGE_EMPTY.
584 	 *
585 	 * Return: image representation being used
586 	 */
587 	public GtkImageType getStorageType()
588 	{
589 		return gtk_image_get_storage_type(gtkImage);
590 	}
591 
592 	/**
593 	 * Causes the #GtkImage to display the given animation (or display
594 	 * nothing, if you set the animation to %NULL).
595 	 *
596 	 * Params:
597 	 *     animation = the #GdkPixbufAnimation
598 	 */
599 	public void setFromAnimation(PixbufAnimation animation)
600 	{
601 		gtk_image_set_from_animation(gtkImage, (animation is null) ? null : animation.getPixbufAnimationStruct());
602 	}
603 
604 	/**
605 	 * See gtk_image_new_from_file() for details.
606 	 *
607 	 * Params:
608 	 *     filename = a filename or %NULL
609 	 */
610 	public void setFromFile(string filename)
611 	{
612 		gtk_image_set_from_file(gtkImage, Str.toStringz(filename));
613 	}
614 
615 	/**
616 	 * See gtk_image_new_from_gicon() for details.
617 	 *
618 	 * Params:
619 	 *     icon = an icon
620 	 *     size = an icon size
621 	 *
622 	 * Since: 2.14
623 	 */
624 	public void setFromGicon(IconIF icon, GtkIconSize size)
625 	{
626 		gtk_image_set_from_gicon(gtkImage, (icon is null) ? null : icon.getIconStruct(), size);
627 	}
628 
629 	/**
630 	 * See gtk_image_new_from_icon_name() for details.
631 	 *
632 	 * Params:
633 	 *     iconName = an icon name
634 	 *     size = an icon size
635 	 *
636 	 * Since: 2.6
637 	 */
638 	public void setFromIconName(string iconName, GtkIconSize size)
639 	{
640 		gtk_image_set_from_icon_name(gtkImage, Str.toStringz(iconName), size);
641 	}
642 
643 	/**
644 	 * See gtk_image_new_from_icon_set() for details.
645 	 *
646 	 * Deprecated: Use gtk_image_set_from_icon_name() instead.
647 	 *
648 	 * Params:
649 	 *     iconSet = a #GtkIconSet
650 	 *     size = a stock icon size
651 	 */
652 	public void setFromIconSet(IconSet iconSet, GtkIconSize size)
653 	{
654 		gtk_image_set_from_icon_set(gtkImage, (iconSet is null) ? null : iconSet.getIconSetStruct(), size);
655 	}
656 
657 	/**
658 	 * See gtk_image_new_from_pixbuf() for details.
659 	 *
660 	 * Params:
661 	 *     pixbuf = a #GdkPixbuf or %NULL
662 	 */
663 	public void setFromPixbuf(Pixbuf pixbuf)
664 	{
665 		gtk_image_set_from_pixbuf(gtkImage, (pixbuf is null) ? null : pixbuf.getPixbufStruct());
666 	}
667 
668 	/**
669 	 * See gtk_image_new_from_resource() for details.
670 	 *
671 	 * Params:
672 	 *     resourcePath = a resource path or %NULL
673 	 */
674 	public void setFromResource(string resourcePath)
675 	{
676 		gtk_image_set_from_resource(gtkImage, Str.toStringz(resourcePath));
677 	}
678 
679 	/**
680 	 * See gtk_image_new_from_stock() for details.
681 	 *
682 	 * Deprecated: Use gtk_image_set_from_icon_name() instead.
683 	 *
684 	 * Params:
685 	 *     stockId = a stock icon name
686 	 *     size = a stock icon size
687 	 */
688 	public void setFromStock(string stockId, GtkIconSize size)
689 	{
690 		gtk_image_set_from_stock(gtkImage, Str.toStringz(stockId), size);
691 	}
692 
693 	/**
694 	 * See gtk_image_new_from_surface() for details.
695 	 *
696 	 * Params:
697 	 *     surface = a cairo_surface_t
698 	 *
699 	 * Since: 3.10
700 	 */
701 	public void setFromSurface(Surface surface)
702 	{
703 		gtk_image_set_from_surface(gtkImage, (surface is null) ? null : surface.getSurfaceStruct());
704 	}
705 
706 	/**
707 	 * Sets the pixel size to use for named icons. If the pixel size is set
708 	 * to a value != -1, it is used instead of the icon size set by
709 	 * gtk_image_set_from_icon_name().
710 	 *
711 	 * Params:
712 	 *     pixelSize = the new pixel size
713 	 *
714 	 * Since: 2.6
715 	 */
716 	public void setPixelSize(int pixelSize)
717 	{
718 		gtk_image_set_pixel_size(gtkImage, pixelSize);
719 	}
720 }