+ return draw_image_common(win, info->pixbuf, val1, val2);
+}
+
+/**
+ * glk_image_draw_scaled:
+ * @win: A graphics or text buffer window.
+ * @image: An image resource number.
+ * @val1: The x coordinate at which to draw the image (if @win is a graphics
+ * window); or, an <link linkend="chimara-imagealign-InlineUp">image
+ * alignment</link> constant (if @win is a text window).
+ * @val2: The y coordinate at which to draw the image (if @win is a graphics
+ * window); this parameter is ignored if @win is a text buffer window.
+ * @width: The width of the image.
+ * @height: The height of the image.
+ *
+ * This is similar to glk_image_draw(), but it scales the image to the given
+ * @width and @height, instead of using the image's standard size. (You can
+ * measure the standard size with glk_image_get_info().)
+ *
+ * If @width or @height is zero, nothing is drawn. Since those arguments are
+ * unsigned integers, they cannot be negative. If you pass in a negative number,
+ * it will be interpreted as a very large positive number, which is almost
+ * certain to end badly.
+ *
+ * Returns: %TRUE if the operation succeeded, %FALSE otherwise.
+ */
+glui32
+glk_image_draw_scaled(winid_t win, glui32 image, glsi32 val1, glsi32 val2, glui32 width, glui32 height)
+{
+ VALID_WINDOW(win, return FALSE);
+ g_return_val_if_fail(win->type == wintype_Graphics || win->type == wintype_TextBuffer, FALSE);
+
+ ChimaraGlkPrivate *glk_data = g_private_get(glk_data_key);
+ struct image_info *to_find = g_new0(struct image_info, 1);
+ struct image_info *info;
+ struct image_info *scaled_info;
+
+ /* Lookup the proper resource */
+ to_find->resource_number = image;
+ to_find->scaled = TRUE; /* any image size equal or larger than requested will do */
+
+ if( !(info = image_cache_find(to_find)) ) {
+ info = load_image_in_cache(image, width, height);
+ if(info == NULL)
+ return FALSE;