Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
f695b4b1
Commit
f695b4b1
authored
Sep 24, 1998
by
Geoff Voelker
Browse files
(w32_color_map_lookup): New function.
(x_to_w32_color): Approximate colors ending in numbers if necessary.
parent
c316b3a5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
13 deletions
+48
-13
src/w32fns.c
src/w32fns.c
+48
-13
No files found.
src/w32fns.c
View file @
f695b4b1
...
...
@@ -1266,6 +1266,38 @@ w32_to_x_color (rgb)
return
Qnil
;
}
COLORREF
w32_color_map_lookup
(
colorname
)
char
*
colorname
;
{
Lisp_Object
tail
,
ret
=
Qnil
;
BLOCK_INPUT
;
for
(
tail
=
Vw32_color_map
;
!
NILP
(
tail
);
tail
=
Fcdr
(
tail
))
{
register
Lisp_Object
elt
,
tem
;
elt
=
Fcar
(
tail
);
if
(
!
CONSP
(
elt
))
continue
;
tem
=
Fcar
(
elt
);
if
(
lstrcmpi
(
XSTRING
(
tem
)
->
data
,
colorname
)
==
0
)
{
ret
=
XUINT
(
Fcdr
(
elt
));
break
;
}
QUIT
;
}
UNBLOCK_INPUT
;
return
ret
;
}
COLORREF
x_to_w32_color
(
colorname
)
char
*
colorname
;
...
...
@@ -1430,27 +1462,30 @@ x_to_w32_color (colorname)
/* I am not going to attempt to handle any of the CIE color schemes
or TekHVC, since I don't know the algorithms for conversion to
RGB. */
for
(
tail
=
Vw32_color_map
;
!
NILP
(
tail
);
tail
=
Fcdr
(
tail
))
/* If we fail to lookup the color name in w32_color_map, then check the
colorname to see if it can be crudely approximated: If the X color
ends in a number (e.g., "darkseagreen2"), strip the number and
return the result of looking up the base color name. */
ret
=
w32_color_map_lookup
(
colorname
);
if
(
NILP
(
ret
))
{
register
Lisp_Object
elt
,
tem
;
int
len
=
strlen
(
colorname
)
;
elt
=
Fcar
(
tail
);
if
(
!
CONSP
(
elt
))
continue
;
if
(
isdigit
(
colorname
[
len
-
1
]))
{
char
*
ptr
,
*
approx
=
alloca
(
len
);
tem
=
Fcar
(
elt
);
strcpy
(
approx
,
colorname
);
ptr
=
&
approx
[
len
-
1
];
while
(
ptr
>
approx
&&
isdigit
(
*
ptr
))
*
ptr
--
=
'\0'
;
if
(
lstrcmpi
(
XSTRING
(
tem
)
->
data
,
colorname
)
==
0
)
{
ret
=
XUINT
(
Fcdr
(
elt
));
break
;
ret
=
w32_color_map_lookup
(
approx
);
}
QUIT
;
}
UNBLOCK_INPUT
;
return
ret
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment