37 int width, height, dpth, dpb;
39 unsigned short int* pnt;
60 for(i=0; i<width*height; i++){
62 if (sl<0) lc =
Min(lc, tmp);
63 if (sh<0) hc =
Max(hc, tmp);
73 image = (
char*)malloc(width*height*dpb);
74 if (image!=NULL) memset(image, 0, width*height*dpb);
76 for(i=0; i<width*height; i++){
80 if (cflg==
MONOC) tmp = (int)((
double)(tmp-lc)*(nc-1)/(double)(hc-lc));
81 else tmp = (int)(nc-(
double)(tmp-lc)*(nc-1)/(double)(hc-lc)-1);
85 for (j=0; j<dpb; j++) image[dpb*i+j] = col;
88 pnt = (
unsigned short int*)&(image[dpb*i]);
93 pmap = XCreatePixmap(xid.
display, xid.
window, width, height, dpth);
94 ximg = XCreateImage(xid.
display,visl,dpth,ZPixmap,0,(
char*)image,width,height,8,0);
95 XPutImage(xid.
display, pmap, xid.
gc, ximg, 0, 0, 0, 0, width, height);
131 XSetWindowAttributes at;
135 unsigned long foreground, background;
136 unsigned short values[] = {0x0, 0x4444, 0x8888, 0xcccc, 0xffff};
142 hint.flags = PPosition|PSize;
144 xid.
display = XOpenDisplay(NULL);
145 root_window = DefaultRootWindow(xid.
display);
151 xid.
window = XCreateSimpleWindow(xid.
display, root_window, hint.x, hint.y,
152 hint.width, hint.height, 5, foreground, background);
153 XSetStandardProperties(xid.
display,xid.
window,
"openX",
"openX",None,NULL,0,&hint);
156 XSetBackground(xid.
display, xid.
gc, background);
157 XSetForeground(xid.
display, xid.
gc, foreground);
159 at.backing_store = WhenMapped;
160 at.bit_gravity = CenterGravity;
161 XChangeWindowAttributes(xid.
display, xid.
window, CWBackingStore, &at);
162 XChangeWindowAttributes(xid.
display, xid.
window, CWBitGravity, &at);
164 XSelectInput(xid.
display, xid.
window, ButtonPressMask|KeyPressMask|ExposureMask);
171 for (ir = 0; ir < 5; ir++) {
172 for (ig = 0; ig < 5; ig++) {
173 for (ib = 0; ib < 5; ib++) {
175 color.red = (int)((ir+5.*ig+ib*25.)/(double)
COLOR_NUM*65532.);
176 color.green = color.blue = color.red;
179 color.red = values[ir];
180 color.green = values[ig];
181 color.blue = values[ib];
183 XAllocColor(xid.
display, cmap, &color);