scx/c/xlib/pixel.c

29 lines
804 B
C

#include "xlib.h"
#include "scheme48.h"
s48_value scx_Black_Pixel(s48_value Xdisplay) {
Display* dpy = SCX_EXTRACT_DISPLAY(Xdisplay);
return SCX_ENTER_PIXEL( BlackPixel(dpy, DefaultScreen(dpy)) );
}
s48_value scx_White_Pixel(s48_value Xdisplay) {
Display* dpy = SCX_EXTRACT_DISPLAY(Xdisplay);
return SCX_ENTER_PIXEL( WhitePixel(dpy, DefaultScreen(dpy)) );
}
s48_value scx_Free_Pixel(s48_value Xpixel, s48_value Xdisplay, s48_value Xcolormap) {
unsigned long pixels[1];
pixels[0] = SCX_EXTRACT_PIXEL(Xpixel);
XFreeColors(SCX_EXTRACT_DISPLAY(Xdisplay), SCX_EXTRACT_COLORMAP(Xcolormap),
pixels, 1, 0);
return S48_UNSPECIFIC;
}
void scx_init_pixel(void) {
S48_EXPORT_FUNCTION(scx_Black_Pixel);
S48_EXPORT_FUNCTION(scx_White_Pixel);
S48_EXPORT_FUNCTION(scx_Free_Pixel);
}