#define FRAME_X_VISUAL(f) FRAME_X_DISPLAY_INFO (f)->visual
#define x_defined_color w32_defined_color
#define DefaultDepthOfScreen(screen) (one_w32_display_info.n_cbits)
+
+/* Functions from w32term.c that depend on XColor (so can't go in w32term.h
+ without modifying lots of files). */
+extern void x_query_colors (struct frame *f, XColor *colors, int ncolors);
+extern void x_query_color (struct frame *f, XColor *color);
#endif /* HAVE_NTGUI */
#ifdef HAVE_NS
{
XColor *row = p;
-#ifdef HAVE_X_WINDOWS
+#if defined (HAVE_X_WINDOWS) || defined (HAVE_NTGUI)
for (x = 0; x < img->width; ++x, ++p)
- p->pixel = XGetPixel (ximg, x, y);
+ p->pixel = GET_PIXEL (ximg, x, y);
if (rgb_p)
x_query_colors (f, row, img->width);
p->pixel = GET_PIXEL (ximg, x, y);
if (rgb_p)
{
-#if defined (HAVE_NS)
p->red = RED16_FROM_ULONG (p->pixel);
p->green = GREEN16_FROM_ULONG (p->pixel);
p->blue = BLUE16_FROM_ULONG (p->pixel);
-#endif /* HAVE_NS */
-#ifdef HAVE_NTGUI
- p->red = 256 * GetRValue (p->pixel);
- p->green = 256 * GetGValue (p->pixel);
- p->blue = 256 * GetBValue (p->pixel);
-#endif /* HAVE_NTGUI */
}
}
#endif /* HAVE_X_WINDOWS */
if (STRINGP (specified_bg))
/* The user specified `:background', use that. */
{
- /* W32 version incorrectly used COLORREF here!! ++kfs */
XColor color;
if (x_defined_color (f, SDATA (specified_bg), &color, 0))
{
{
/* We use the current frame background, ignoring any default
background color set by the image. */
-#ifdef HAVE_X_WINDOWS
+#if defined (HAVE_X_WINDOWS) || defined (HAVE_NTGUI)
XColor color;
png_color_16 frame_background;
frame_background.blue = color.blue >> shift;
#endif /* HAVE_X_WINDOWS */
-#ifdef HAVE_NTGUI
- COLORREF color;
- png_color_16 frame_background;
- color = FRAME_BACKGROUND_PIXEL (f);
-#if 0 /* W32 TODO : Colormap support. */
- x_query_color (f, &color);
-#endif
- bzero (&frame_background, sizeof frame_background);
- frame_background.red = GetRValue (color);
- frame_background.green = GetGValue (color);
- frame_background.blue = GetBValue (color);
-#endif /* HAVE_NTGUI */
-
fn_png_set_background (png_ptr, &frame_background,
PNG_BACKGROUND_GAMMA_SCREEN, 0, 1.0);
}
gnome type library functions. */
fn_g_type_init ();
/* Make a handle to a new rsvg object. */
- rsvg_handle = fn_rsvg_handle_new ();
+ rsvg_handle = (RsvgHandle *) fn_rsvg_handle_new ();
/* Parse the contents argument and fill in the rsvg_handle. */
fn_rsvg_handle_write (rsvg_handle, contents, size, &error);
/* We can now get a valid pixel buffer from the svg file, if all
went ok. */
- pixbuf = fn_rsvg_handle_get_pixbuf (rsvg_handle);
+ pixbuf = (GdkPixbuf *) fn_rsvg_handle_get_pixbuf (rsvg_handle);
if (!pixbuf) goto rsvg_error;
fn_g_object_unref (rsvg_handle);
/* Extract some meta data from the svg handle. */
width = fn_gdk_pixbuf_get_width (pixbuf);
height = fn_gdk_pixbuf_get_height (pixbuf);
- pixels = fn_gdk_pixbuf_get_pixels (pixbuf);
+ pixels = (const guint8 *) fn_gdk_pixbuf_get_pixels (pixbuf);
rowstride = fn_gdk_pixbuf_get_rowstride (pixbuf);
/* Validate the svg meta data. */
}
else
{
-#ifdef HAVE_X_WINDOWS
background.pixel = FRAME_BACKGROUND_PIXEL (f);
x_query_color (f, &background);
background.red >>= 8;
background.green >>= 8;
background.blue >>= 8;
-#elif defined (HAVE_NTGUI)
- background.pixel = FRAME_BACKGROUND_PIXEL (f);
-#if 0 /* W32 TODO : Colormap support. */
- x_query_color (f, &background);
-#endif
-
- /* SVG pixmaps specify transparency in the last byte, so right
- shift 8 bits to get rid of it, since emacs doesn't support
- transparency. */
- background.red >>= 8;
- background.green >>= 8;
- background.blue >>= 8;
-#else /* not HAVE_X_WINDOWS*/
-#error FIXME
-#endif
}
/* This loop handles opacity values, since Emacs assumes
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