summaryrefslogtreecommitdiff
path: root/src/pixmap.h
diff options
context:
space:
mode:
authorMichael Jennings <mej@kainx.org>1999-09-21 01:16:46 +0000
committerMichael Jennings <mej@kainx.org>1999-09-21 01:16:46 +0000
commite700e69dffe1ba5003eb449731189aab1e2711a5 (patch)
tree070d7e88143f2901ede0ec96c35cc607de282e04 /src/pixmap.h
parente4070d20750f99ce8b68120c5d0c54d59758e890 (diff)
downloadeterm-e700e69dffe1ba5003eb449731189aab1e2711a5.tar.gz
Mon Sep 20 18:32:01 PDT 1999 Michael Jennings <mej@eterm.org>
Lots of changes here. First off, this should fix the background draw bug with transparency that several people pointed out. While I was at it, I also cleaned up a lot of other related stuff. Three-state images should be a lot more robust now. Then again, some stuff may be broken entirely from this, so let me know. :-) For one thing, the various image modes should work as expected now. You can allow and disallow modes for the various widgets. The fallback mode is "solid" now, rather than "image," so you can cause a certain widget to refuse to use an image if you want to. If you specify an image without specifying a "mode" line that allows the "image" mode, your image will not appear. <-- READ THIS TWICE! I had to go back and fix all the theme files because of this, so you will need to remove your current theme directory and allow Eterm's "make install" to put the new ones in place; otherwise, everything will go back to being solid colors. =] Anytime something changes this drastically, there are bound to be problems. Let me know if you find any of them. :) SVN revision: 348
Diffstat (limited to 'src/pixmap.h')
-rw-r--r--src/pixmap.h41
1 files changed, 28 insertions, 13 deletions
diff --git a/src/pixmap.h b/src/pixmap.h
index a403820..b9b9be9 100644
--- a/src/pixmap.h
+++ b/src/pixmap.h
@@ -32,7 +32,8 @@
/************ Macros and Definitions ************/
#ifdef PIXMAP_SUPPORT
# define background_is_image() (images[image_bg].current && images[image_bg].current->iml && images[image_bg].current->iml->im)
-# define background_is_pixmap() (background_is_image() || Options & Opt_pixmapTrans)
+# define background_is_trans() (images[image_bg].mode & MODE_TRANS)
+# define background_is_pixmap() (background_is_image() || background_is_trans())
# define delete_simage(simg) do { \
Imlib_free_pixmap(imlib_id, (simg)->pmap->pixmap); \
Imlib_destroy_image(imlib_id, (simg)->iml->im); \
@@ -43,8 +44,9 @@
# define CONVERT_TINT_GREEN(t) (((t) & 0x00ff00) >> 8)
# define CONVERT_TINT_BLUE(t) ((t) & 0x0000ff)
#else
-# define background_is_pixmap() ((int)0)
# define background_is_image() ((int)0)
+# define background_is_trans() ((int)0)
+# define background_is_pixmap() ((int)0)
# define delete_simage(simg) ((void)0)
#endif
#define PIXMAP_EXT NULL
@@ -77,16 +79,27 @@ enum {
#define OP_SCALE (OP_HSCALE | OP_VSCALE)
/* Image modes */
-#define MODE_IMAGE 0x00
-#define MODE_TRANS 0x01
-#define MODE_VIEWPORT 0x02
-#define MODE_AUTO 0x04
-#define MODE_MASK 0x07
-#define ALLOW_IMAGE 0x00
-#define ALLOW_TRANS 0x10
-#define ALLOW_VIEWPORT 0x20
-#define ALLOW_AUTO 0x40
-#define ALLOW_MASK 0x70
+#define MODE_SOLID 0x00
+#define MODE_IMAGE 0x01
+#define MODE_TRANS 0x02
+#define MODE_VIEWPORT 0x04
+#define MODE_AUTO 0x08
+#define MODE_MASK 0x0f
+#define ALLOW_SOLID 0x00
+#define ALLOW_IMAGE 0x10
+#define ALLOW_TRANS 0x20
+#define ALLOW_VIEWPORT 0x40
+#define ALLOW_AUTO 0x80
+#define ALLOW_MASK 0xf0
+
+/* Helper macros */
+#define FOREACH_IMAGE(x) do {unsigned char idx; for (idx = 0; idx < image_max; idx++) { x } } while (0)
+#define redraw_all_images() do {render_simage(images[image_bg].current, TermWin.vt, TermWin_TotalWidth(), TermWin_TotalHeight(), image_bg, 0); \
+ scr_touch(); scrollbar_show(0);} while (0)
+#define image_set_mode(which, bit) do {images[which].mode &= ~(MODE_MASK); images[which].mode |= (bit);} while (0)
+#define image_allow_mode(which, bit) (images[which].mode |= (bit))
+#define image_disallow_mode(which, bit) (images[which].mode &= ~(bit))
+#define image_mode_is(which, bit) (images[which].mode & (bit))
/* Elements of an simage to be reset */
#define RESET_NONE (0UL)
@@ -143,11 +156,13 @@ extern Window desktop_window;
/************ Function Prototypes ************/
_XFUNCPROTOBEGIN
+extern const char *get_image_type(unsigned short);
extern unsigned short parse_pixmap_ops(char *);
extern unsigned short set_pixmap_scale(const char *, pixmap_t *);
extern void reset_simage(simage_t *, unsigned long);
extern void paste_simage(simage_t *, Window, unsigned short, unsigned short, unsigned short, unsigned short);
-extern void render_simage(simage_t *, Window, unsigned short, unsigned short, int, renderop_t);
+extern void redraw_image(unsigned char);
+extern void render_simage(simage_t *, Window, unsigned short, unsigned short, unsigned char, renderop_t);
#ifdef USE_POSIX_THREADS
extern void init_bg_pixmap_thread(void *);
#endif