+/* Returns the background color of IMG, calculating one heuristically if
+ necessary. If non-zero, XIMG is an existing XImage object to use for
+ the heuristic. */
+
+#define IMAGE_BACKGROUND(img, f, ximg) \
+ ((img)->background_valid \
+ ? (img)->background \
+ : image_background (img, f, ximg))
+
+/* Returns true if IMG has a `transparent' background, using heuristics
+ to decide if necessary. If non-zero, MASK is an existing XImage
+ object to use for the heuristic. */
+
+#define IMAGE_BACKGROUND_TRANSPARENT(img, f, mask) \
+ ((img)->background_transparent_valid \
+ ? (img)->background_transparent \
+ : image_background_transparent (img, f, mask))
+