Mon Jun 11 22:04:08 PDT 2001 Michael Jennings <mej@eterm.org>
Fixed the --shade and --tint options. This issue was pointed out by Laurence J. Lane <ljlane@debian.org>. SVN revision: 4807
This commit is contained in:
parent
c3f775c1b5
commit
379d83a852
|
@ -4194,3 +4194,9 @@ Mon Jun 11 17:49:55 PDT 2001 Michael Jennings <mej@eterm.org>
|
|||
And finally, the config file parser was moved to libast.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Mon Jun 11 22:04:08 PDT 2001 Michael Jennings <mej@eterm.org>
|
||||
|
||||
Fixed the --shade and --tint options. This issue was pointed out by
|
||||
Laurence J. Lane <ljlane@debian.org>.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
|
|
@ -3033,6 +3033,7 @@ post_parse(void)
|
|||
|
||||
sprintf(buff, "0x%03x", ((100 - rs_shade) << 8) / 100);
|
||||
rs_cmod_image = STRDUP(buff);
|
||||
D_PIXMAP(("--shade value of %d converted to cmod value of %s\n", rs_shade, rs_cmod_image));
|
||||
}
|
||||
if (rs_tint) {
|
||||
char buff[10];
|
||||
|
@ -3078,6 +3079,8 @@ post_parse(void)
|
|||
if (n > 2) {
|
||||
iml->mod->gamma = (int) strtol(get_pword(3, rs_cmod_image), (char **) NULL, 0);
|
||||
}
|
||||
D_PIXMAP(("From image cmod string %s to brightness %d, contrast %d, and gamma %d\n", rs_cmod_image,
|
||||
iml->mod->brightness, iml->mod->contrast, iml->mod->gamma));
|
||||
FREE(rs_cmod_image);
|
||||
}
|
||||
if (rs_cmod_red) {
|
||||
|
@ -3095,7 +3098,10 @@ post_parse(void)
|
|||
if (n > 2) {
|
||||
iml->rmod->gamma = (int) strtol(get_pword(3, rs_cmod_red), (char **) NULL, 0);
|
||||
}
|
||||
D_PIXMAP(("From red cmod string %s to brightness %d, contrast %d, and gamma %d\n", rs_cmod_red,
|
||||
iml->rmod->brightness, iml->rmod->contrast, iml->rmod->gamma));
|
||||
FREE(rs_cmod_red);
|
||||
update_cmod(iml->rmod);
|
||||
}
|
||||
if (rs_cmod_green) {
|
||||
unsigned char n = num_words(rs_cmod_green);
|
||||
|
@ -3112,7 +3118,10 @@ post_parse(void)
|
|||
if (n > 2) {
|
||||
iml->gmod->gamma = (int) strtol(get_pword(3, rs_cmod_green), (char **) NULL, 0);
|
||||
}
|
||||
D_PIXMAP(("From green cmod string %s to brightness %d, contrast %d, and gamma %d\n", rs_cmod_green,
|
||||
iml->gmod->brightness, iml->gmod->contrast, iml->gmod->gamma));
|
||||
FREE(rs_cmod_green);
|
||||
update_cmod(iml->gmod);
|
||||
}
|
||||
if (rs_cmod_blue) {
|
||||
unsigned char n = num_words(rs_cmod_blue);
|
||||
|
@ -3129,7 +3138,14 @@ post_parse(void)
|
|||
if (n > 2) {
|
||||
iml->bmod->gamma = (int) strtol(get_pword(3, rs_cmod_blue), (char **) NULL, 0);
|
||||
}
|
||||
D_PIXMAP(("From blue cmod string %s to brightness %d, contrast %d, and gamma %d\n", rs_cmod_blue,
|
||||
iml->bmod->brightness, iml->bmod->contrast, iml->bmod->gamma));
|
||||
FREE(rs_cmod_blue);
|
||||
update_cmod(iml->bmod);
|
||||
}
|
||||
if (images[image_bg].norm->iml->im) {
|
||||
imlib_context_set_image(images[image_bg].norm->iml->im);
|
||||
update_cmod_tables(images[image_bg].norm->iml);
|
||||
}
|
||||
|
||||
if (rs_cache_size == (unsigned long) -1) {
|
||||
|
|
14
src/pixmap.c
14
src/pixmap.c
|
@ -1309,9 +1309,11 @@ load_image(const char *file, simage_t *simg)
|
|||
void
|
||||
update_cmod(colormod_t *cmod)
|
||||
{
|
||||
|
||||
ASSERT(cmod != NULL);
|
||||
|
||||
/* When a particular R/G/B color modifier is changed, this function must be called
|
||||
to resync the Imlib2 color modifier (imlib_mod) with our new brightness,
|
||||
contrast, and gamma values. */
|
||||
if (cmod->imlib_mod) {
|
||||
imlib_context_set_color_modifier(cmod->imlib_mod);
|
||||
imlib_reset_color_modifier();
|
||||
|
@ -1339,10 +1341,12 @@ update_cmod_tables(imlib_t *iml)
|
|||
|
||||
REQUIRE(mod || rmod || gmod || bmod);
|
||||
|
||||
/* When any changes is made to any individual color modifier for an image,
|
||||
this function must be called to update the overall Imlib2 color modifier. */
|
||||
D_PIXMAP(("Updating color modifier tables for %8p\n", iml));
|
||||
if (!mod) {
|
||||
mod = iml->mod = create_colormod();
|
||||
iml->mod->imlib_mod = imlib_create_color_modifier();
|
||||
iml->mod->brightness = iml->mod->contrast = iml->mod->gamma = 0x100;
|
||||
imlib_context_set_color_modifier(mod->imlib_mod);
|
||||
} else if (!mod->imlib_mod) {
|
||||
mod->imlib_mod = imlib_create_color_modifier();
|
||||
|
@ -1379,14 +1383,15 @@ update_cmod_tables(imlib_t *iml)
|
|||
}
|
||||
}
|
||||
|
||||
# ifdef PIXMAP_OFFSET
|
||||
# define MOD_IS_SET(mod) ((mod) && ((mod)->brightness != 0x100 || (mod)->contrast != 0x100 || (mod)->gamma != 0x100))
|
||||
# define MOD_IS_SET(mod) ((mod) && ((mod)->brightness != 0x100 || (mod)->contrast != 0x100 || (mod)->gamma != 0x100))
|
||||
unsigned char
|
||||
need_colormod(register imlib_t *iml)
|
||||
{
|
||||
if (MOD_IS_SET(iml->mod) || MOD_IS_SET(iml->rmod) || MOD_IS_SET(iml->gmod) || MOD_IS_SET(iml->bmod)) {
|
||||
D_PIXMAP(("Color modifier active.\n"));
|
||||
return 1;
|
||||
} else {
|
||||
D_PIXMAP(("No color modifier active.\n"));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -1605,6 +1610,7 @@ shade_ximage_24(void *data, int bpl, int w, int h, int rm, int gm, int bm)
|
|||
}
|
||||
}
|
||||
|
||||
# ifdef PIXMAP_OFFSET
|
||||
void
|
||||
colormod_trans(Pixmap p, imlib_t *iml, GC gc, unsigned short w, unsigned short h)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue