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