changeset 40263:3657a6c97b2f

(struct image): Add `background', `background_valid', and `background_transparent' fields. (image_background, image_background_transparent): New declarations. (IMAGE_BACKGROUND, IMAGE_BACKGROUND_TRANSPARENT): New macros.
author Miles Bader <miles@gnu.org>
date Wed, 24 Oct 2001 17:16:52 +0000
parents 64974d531aba
children 04766dd416bb
files src/dispextern.h
diffstat 1 files changed, 38 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/dispextern.h	Wed Oct 24 16:13:22 2001 +0000
+++ b/src/dispextern.h	Wed Oct 24 17:16:52 2001 +0000
@@ -1985,6 +1985,22 @@
   unsigned long *colors;
   int ncolors;
 
+  /* A single `background color' for this image, for the use of anyone that
+     cares about such a thing.  Only valid if the `background_valid' field
+     is true.  This should generally be accessed by calling the accessor
+     macro `IMAGE_BACKGROUND', which will heuristically calculate a value
+     if necessary.  */
+  unsigned long background;
+
+  /* True if this image has a `transparent' background -- that is, is
+     uses an image mask.  The accessor macro for this is
+     `IMAGE_BACKGROUND_TRANSPARENT'.  */
+  unsigned background_transparent : 1;
+
+  /* True if the `background' and `background_transparent' fields are
+     valid, respectively. */
+  unsigned background_valid : 1, background_transparent_valid : 1;
+
   /* Width and height of the image.  */
   int width, height;
 
@@ -2268,6 +2284,10 @@
 int valid_image_p P_ ((Lisp_Object));
 void prepare_image_for_display P_ ((struct frame *, struct image *));
 int lookup_image P_ ((struct frame *, Lisp_Object));
+unsigned long image_background P_ ((struct image *, struct frame *,
+				    XImage *ximg));
+int image_background_transparent P_ ((struct image *, struct frame *,
+				      XImage *mask));
 extern Lisp_Object tip_frame;
 extern Window tip_window;
 EXFUN (Fx_show_tip, 6);
@@ -2276,6 +2296,24 @@
 extern void cancel_hourglass P_ ((void));
 extern int display_hourglass_p;
 
+/* 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))
+
 #endif /* HAVE_WINDOW_SYSTEM */