2001-05-08 10:21:00 -04:00
|
|
|
#include "xlib.h"
|
|
|
|
|
|
|
|
Generic_Predicate (Pixel)
|
|
|
|
|
|
|
|
Generic_Simple_Equal (Pixel, PIXEL, pix)
|
|
|
|
|
|
|
|
Generic_Print (Pixel, "#[pixel 0x%lx]", PIXEL(x)->pix)
|
|
|
|
|
2001-05-14 09:48:37 -04:00
|
|
|
s48_value Make_Pixel (val) unsigned long val; {
|
|
|
|
s48_value pix;
|
2001-05-08 10:21:00 -04:00
|
|
|
|
|
|
|
pix = Find_Object (T_Pixel, (GENERIC)0, Match_X_Obj, val);
|
2001-05-14 09:48:37 -04:00
|
|
|
if (S48_NULL_P (pix)) {
|
2001-05-08 10:21:00 -04:00
|
|
|
pix = Alloc_Object (sizeof (struct S_Pixel), T_Pixel, 0);
|
2001-05-14 09:48:37 -04:00
|
|
|
PIXEL(pix)->tag = S48_NULL;
|
2001-05-08 10:21:00 -04:00
|
|
|
PIXEL(pix)->pix = val;
|
|
|
|
Register_Object (pix, (GENERIC)0, (PFO)0, 0);
|
|
|
|
}
|
|
|
|
return pix;
|
|
|
|
}
|
|
|
|
|
2001-05-14 09:48:37 -04:00
|
|
|
unsigned long Get_Pixel (p) s48_value p; {
|
2001-05-08 10:21:00 -04:00
|
|
|
Check_Type (p, T_Pixel);
|
|
|
|
return PIXEL(p)->pix;
|
|
|
|
}
|
|
|
|
|
2001-05-14 09:48:37 -04:00
|
|
|
static s48_value P_Pixel_Value (p) s48_value p; {
|
|
|
|
return s48_enter_integer (Get_Pixel (p));
|
2001-05-08 10:21:00 -04:00
|
|
|
}
|
|
|
|
|
2001-05-14 09:48:37 -04:00
|
|
|
static s48_value P_Black_Pixel (d) s48_value d; {
|
2001-05-08 10:21:00 -04:00
|
|
|
Check_Type (d, T_Display);
|
|
|
|
return Make_Pixel (BlackPixel (DISPLAY(d)->dpy,
|
|
|
|
DefaultScreen (DISPLAY(d)->dpy)));
|
|
|
|
}
|
|
|
|
|
2001-05-14 09:48:37 -04:00
|
|
|
static s48_value P_White_Pixel (d) s48_value d; {
|
2001-05-08 10:21:00 -04:00
|
|
|
Check_Type (d, T_Display);
|
|
|
|
return Make_Pixel (WhitePixel (DISPLAY(d)->dpy,
|
|
|
|
DefaultScreen (DISPLAY(d)->dpy)));
|
|
|
|
}
|
|
|
|
|
|
|
|
elk_init_xlib_pixel () {
|
|
|
|
Generic_Define (Pixel, "pixel", "pixel?");
|
|
|
|
Define_Primitive (P_Pixel_Value, "pixel-value", 1, 1, EVAL);
|
|
|
|
Define_Primitive (P_Black_Pixel, "black-pixel", 1, 1, EVAL);
|
|
|
|
Define_Primitive (P_White_Pixel, "white-pixel", 1, 1, EVAL);
|
|
|
|
}
|