diff src/w32term.c @ 100845:58017ff34d94

* w32term.c (x_query_colors, x_query_color): New functions. * image.c (x_to_xcolors, png_load): Eliminate W32 specific code. (svg_load_image): Cast returned pointers from dynamically loaded functions. Eliminate W32 specific code.
author Jason Rumney <jasonr@gnu.org>
date Sat, 03 Jan 2009 11:16:32 +0000
parents 20169cf90421
children e038c1a8307c
line wrap: on
line diff
--- a/src/w32term.c	Sat Jan 03 04:00:53 2009 +0000
+++ b/src/w32term.c	Sat Jan 03 11:16:32 2009 +0000
@@ -1526,6 +1526,35 @@
   return 1;
 }
 
+/* On frame F, translate pixel colors to RGB values for the NCOLORS
+   colors in COLORS.  On W32, we no longer try to map colors to
+   a palette.  */
+void
+x_query_colors (f, colors, ncolors)
+     struct frame *f;
+     XColor *colors;
+     int ncolors;
+{
+  int i;
+
+  for (i = 0; i < ncolors; i++)
+    {
+      DWORD pixel = colors[i].pixel;
+      /* Convert to a 16 bit value in range 0 - 0xffff. */
+      colors[i].red = GetRValue (pixel) * 257;
+      colors[i].green = GetGValue (pixel) * 257;
+      colors[i].blue = GetBValue (pixel) * 257;
+    }
+}
+
+void
+x_query_color (f, color)
+     struct frame *f;
+     XColor *color;
+{
+  x_query_colors (f, color, 1);
+}
+
 
 /* Set up the foreground color for drawing relief lines of glyph
    string S.  RELIEF is a pointer to a struct relief containing the GC