📄 testarc.c
字号:
#include <X11/X.h>#include <X11/Xlib.h>/* * Arc drawing demo for X11 */#define GREEN getcolor("green")#define BLACK BlackPixel(d, 0)Display *d;static unsigned longgetcolor(char *name){ XColor xc, xc2; XAllocNamedColor(d, DefaultColormap(d, 0), name, &xc, &xc2); return xc.pixel;}static voiddraw(XEvent *ep){ Window wid = ((XExposeEvent *)ep)->window; GC gc = XCreateGC(d, wid, 0, NULL); int x = 40; int y = 40; int w, h; w = h = 8; XSetForeground(d, gc, BLACK); XDrawRectangle(d, wid, gc, x, y, w-1, h-1); XSetForeground(d, gc, GREEN); //XDrawArc(d, wid, gc, x, y, w-1, h-1, 0, 360*64); XFillArc(d, wid, gc, x, y, w, h, 0, 360*64); XSetForeground(d, gc, BLACK); XDrawPoint(d, wid, gc, x+w/2, y+h/2); XFreeGC(d, gc);}intmain(int ac, char **av){ XEvent ev; Window wid; if ((d = XOpenDisplay(NULL)) == NULL) exit(1); wid = XCreateSimpleWindow(d, RootWindow(d, 0), 0, 0, 100, 100, 0, BLACK, WhitePixel(d, 0)); XSelectInput(d, wid, ExposureMask); XMapWindow(d, wid); while (1) { XNextEvent(d, &ev); if (ev.type == Expose) draw(&ev); } XCloseDisplay(d); return 0;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -