- /* Copy the contents of the old pixmap */
- if(oldmap != NULL)
- gdk_draw_drawable( GDK_DRAWABLE(newmap), widget->style->white_gc, GDK_DRAWABLE(oldmap), 0, 0, 0, 0, oldwidth, oldheight);
-
- /* Use the new pixmap */
- gtk_image_set_from_pixmap( GTK_IMAGE(widget), newmap, NULL );
- g_object_unref(newmap);
+ gdk_threads_leave();
+
+ return match;
+}
+
+/**
+ * glk_image_get_info:
+ * @image: An image resource number.
+ * @width: Pointer to a location at which to store the image's width.
+ * @height: Pointer to a location at which to store the image's height.
+ *
+ * This gets information about the image resource with the given identifier. It
+ * returns %TRUE if there is such an image, and %FALSE if not. You can also pass
+ * pointers to width and height variables; if the image exists, the variables
+ * will be filled in with the width and height of the image, in pixels. (You can
+ * pass %NULL for either width or height if you don't care about that
+ * information.)
+ *
+ * <note><para>
+ * You should always use this function to measure the size of images when you
+ * are creating your display. Do this even if you created the images, and you
+ * know how big they <quote>should</quote> be. This is because images may be
+ * scaled in translating from one platform to another, or even from one
+ * machine to another. A Glk library might display all images larger than
+ * their original size, because of screen resolution or player preference.
+ * Images will be scaled proportionally, but you still need to call
+ * glk_image_get_info() to determine their absolute size.
+ * </para></note>
+ *
+ * Returns: %TRUE if @image is a valid identifier, %FALSE if not.
+ */
+glui32
+glk_image_get_info(glui32 image, glui32 *width, glui32 *height)
+{
+ struct image_info *to_find = g_new0(struct image_info, 1);
+ struct image_info *found;
+ to_find->resource_number = image;
+ to_find->scaled = FALSE; /* we want the original image size */
+
+ if( !(found = image_cache_find(to_find)) ) {
+ found = load_image_in_cache(image, 0, 0);
+ if(found == NULL)
+ return FALSE;