Ktam3874/pitx software guide – Kontron KTAM3874-pITX User Manual

Page 142

Advertising
background image

KTD-S0057-I

Page 138 Linux® Programming Examples (DebianTM)


KTAM3874/pITX Software Guide


XMapWindow (disp, win);

index = 0;

while (! quit)

{

if (XPending (disp))

{

XNextEvent (disp, &e);

if ((e.type == ClientMessage && (Atom) (e.xclient.data.l[0]) == close) || (e.type == ButtonPress))

quit = TRUE;

}

else

{

XClearWindow

(disp,

win);

XAllocNamedColor (disp, cmap, colors[index].name, &col, &col);

XSetForeground (disp, gc, col.pixel);

XFillRectangle (disp, win, gc, RC_X, RC_Y, RC_SIZE, RC_SIZE);

XSetForeground (disp, gc, BlackPixel (disp, screen));

XTextExtents (font, colors[index].name, strlen (colors[index].name), &tmp, &tmp, &tmp, &tsize);

xp = (RC_SIZE / 2) - (tsize.width / 2) + RC_X;

XDrawImageString (disp, win, gc, xp, RC_Y+RC_SPC, colors[index].name, strlen (colors[index].name));

index++;

XAllocNamedColor (disp, cmap, colors[index].name, &col, &col);

XSetForeground (disp, gc, col.pixel);

XFillRectangle (disp, win, gc, RC_X+RC_SIZE+RC_SPC, RC_Y, RC_SIZE, RC_SIZE);

XSetForeground (disp, gc, BlackPixel (disp, screen));

XTextExtents (font, colors[index].name, strlen (colors[index].name), &tmp, &tmp, &tmp, &tsize);

xp = (RC_SIZE / 2) - (tsize.width / 2) + RC_X+RC_SIZE+RC_SPC;

XDrawImageString (disp, win, gc, xp, RC_Y+RC_SPC, colors[index].name, strlen (colors[index].name));

index++;

XAllocNamedColor (disp, cmap, colors[index].name, &col, &col);

XSetForeground (disp, gc, col.pixel);

XFillRectangle (disp, win, gc, RC_X, RC_Y+RC_SIZE+RC_SPC, RC_SIZE, RC_SIZE);

XSetForeground (disp, gc, BlackPixel (disp, screen));

XTextExtents (font, colors[index].name, strlen (colors[index].name), &tmp, &tmp, &tmp, &tsize);

xp = (RC_SIZE / 2) - (tsize.width / 2) + RC_X;

XDrawImageString (disp, win, gc, xp, RC_Y+(2*RC_SPC)+RC_SIZE, colors[index].name, strlen

(colors[index].name));

index++;

XAllocNamedColor (disp, cmap, colors[index].name, &col, &col);

XSetForeground (disp, gc, col.pixel);

XFillRectangle (disp, win, gc, RC_X+RC_SIZE+RC_SPC, RC_Y+RC_SIZE+RC_SPC, RC_SIZE, RC_SIZE);

XSetForeground (disp, gc, BlackPixel (disp, screen));

XTextExtents (font, colors[index].name, strlen (colors[index].name), &tmp, &tmp, &tmp, &tsize);

xp = (RC_SIZE / 2) - (tsize.width / 2) + RC_X+RC_SIZE+RC_SPC;

XDrawImageString (disp, win, gc, xp, RC_Y+(2*RC_SPC)+RC_SIZE, colors[index].name, strlen

(colors[index].name));

index++;

XFlush

(disp);

sleep

(WAIT);

Advertising
This manual is related to the following products: