#ifdef HAVE_NTGUI
void gamma_correct (struct frame *, COLORREF *);
#endif
+#ifdef HAVE_HAIKU
+void gamma_correct (struct frame *, Emacs_Color *);
+#endif
#ifdef HAVE_WINDOW_SYSTEM
haiku_change_tab_bar_height (f, nlines * FRAME_LINE_HEIGHT (f));
}
+void
+gamma_correct (struct frame *f, Emacs_Color *color)
+{
+ if (f->gamma)
+ {
+ color->red = (pow (color->red / 65535.0, f->gamma)
+ * 65535.0 + 0.5);
+ color->green = (pow (color->green / 65535.0, f->gamma)
+ * 65535.0 + 0.5);
+ color->blue = (pow (color->blue / 65535.0, f->gamma)
+ * 65535.0 + 0.5);
+ color->pixel = RGB_TO_ULONG (color->red / 256,
+ color->green / 256,
+ color->blue / 256);
+ }
+}
int
haiku_get_color (const char *name, Emacs_Color *color)
haiku_defined_color (struct frame *f, const char *name,
Emacs_Color *color, bool alloc, bool make_index)
{
- return !haiku_get_color (name, color);
+ int rc;
+
+ rc = !haiku_get_color (name, color);
+
+ if (rc && f->gamma && alloc)
+ gamma_correct (f, color);
+
+ return rc;
}
/* Adapted from xterm `x_draw_box_rect'. */