|
¡û ¤Ï¤¸¤á¤Ë
¤È¤ê¤¢¤¨¤º¥¦¥£¥ó¥É¥¦¤òɽ¼¨¤¹¤ë¤³¤È¤¬¤Ç¤¤ë¤è¤¦¤Ë¤Ï¤Ê¤ê¤Þ¤·¤¿¡£¤·¤«¤·²¿¤âɽ¼¨¤µ¤ì¤Ê¤¤¥¦¥£¥ó¥É¥¦¤·¤«ºî¤ì¤Ê¤¤¤Î¤Ç¤Ï¡¢³Ú¤·¤¯¤â¤Ê¤ó¤È¤â¤¢¤ê¤Þ¤»¤ó¡£¼¡¤Ï¥¦¥£¥ó¥É¥¦¤Ë¤¤¤í¤¤¤í¤Ê¥°¥é¥Õ¥£¥Ã¥¯¥¹¤òÉÁ¤¤¤Æ¤ß¤¿¤¤¤È»×¤¦¤Î¤¬ÉáÄ̤Ǥ·¤ç¤¦¡ª
¤³¤³¤Ç¤Ïɽ¼¨¤µ¤ì¤¿¥¦¥£¥ó¥É¥¦¤ËÂФ·¤ÆÍÍ¡¹¤Ê¥°¥é¥Õ¥£¥Ã¥¯¥¹¤ÎÉÁ²è¤ò¹Ô¤¦ÊýË¡¤Ë¤Ä¤¤¤ÆÀâÌÀ¤·¤Æ¤¤¤¤Þ¤¹¡£
¡û ¥µ¥ó¥×¥ë¥×¥í¥°¥é¥à
Î理ÇÅɤê¤Ä¤Ö¤·¤¿±ß¤È¡¢ÀÖ¿§¤ÇÅɤê¤Ä¤Ö¤·¤¿Ä¹Êý·Á¤òÉÁ²è¤¹¤ë¥µ¥ó¥×¥ë¥×¥í¥°¥é¥à xgraphics.c ¤Ç¤¹¡£xwin.c ¤ò´ðËܤȤ·¤Æ¡¢É¬Íפʽ¤Àµ¤ò²Ã¤¨¤Æ¤¤¤Þ¤¹¡£¤Ï¤¸¤á¤Ë ¤Î¥Ú¡¼¥¸¤«¤é¡¢Á´¤Æ¤Î¥µ¥ó¥×¥ë¥×¥í¥°¥é¥à¤ò¸Ç¤á¤¿ tar ¥Ü¡¼¥ë¤ò¥À¥¦¥ó¥í¡¼¥É¤¹¤ë¤³¤È¤â¤Ç¤¤Þ¤¹¡£
xwin.c ¤Î»þ¤ÈƱÍͤ˥³¥ó¥Ñ¥¤¥ë¤·¤Æ¼Â¹Ô¤¹¤ë¤È¡¢ÀÖ¿§¤ÎĹÊý·Á¡¢Îп§¤Î±ß¤¬ÉÁ²è¤µ¤ì¤¿¥¦¥£¥ó¥É¥¦¤¬É½¼¨¤µ¤ì¤Þ¤¹¡£²¿¤«¥¡¼¤ò²¡¤¹¤È¥×¥í¥°¥é¥à¤¬½ªÎ»¤·¤Þ¤¹¡£
--- xgraphics.c ---
1 #include <X11/Xlib.h> 2 3 #define WIN_W 400 /* ¥¦¥£¥ó¥É¥¦¤ÎÉý */ 4 #define WIN_H 300 /* ¥¦¥£¥ó¥É¥¦¤Î¹â¤µ */ 5 #define WIN_X 100 /* ¥¦¥£¥ó¥É¥¦É½¼¨°ÌÃÖ(X) */ 6 #define WIN_Y 100 /* ¥¦¥£¥ó¥É¥¦É½¼¨°ÌÃÖ(Y) */ 7 #define BORDER 2 /* ¥Ü¡¼¥À¤ÎÉý */ 8 #define BOX_W 200 /* ÉÁ²è¤¹¤ëĹÊý·Á¤ÎÉý */ 9 #define BOX_H 100 /* ¹â¤µ */ 10 #define BOX_X 50 /* º¸¾å³Ñ¤Î X ºÂɸ */ 11 #define BOX_Y 50 /* º¸¾å³Ñ¤Î Y ºÂɸ */ 12 #define CIRCLE_W 100 /* ±ß¤¬ÆâÀܤ¹¤ëÀµÊý·Á¤ÎÉý */ 13 #define CIRCLE_H 100 /* ±ß¤¬ÆâÀܤ¹¤ëÀµÊý·Á¤Î¹â¤µ */ 14 #define CIRCLE_X 200 /* ±ß¤ÎÃæ¿´¤Î X ºÂɸ */ 15 #define CIRCLE_Y 180 /* ±ß¤ÎÃæ¿´¤Î Y ºÂɸ */ 16 17 18 static void draw( Display* dpy, Window win, GC gc, 19 unsigned long green, unsigned long red ); 20 21 22 int 23 main( void ) 24 { 25 Display* dpy; /* ¥Ç¥£¥¹¥×¥ì¥¤ */ 26 Window root; /* ¥ë¡¼¥È¥¦¥£¥ó¥É¥¦ */ 27 Window win; /* ɽ¼¨¤¹¤ë¥¦¥£¥ó¥É¥¦ */ 28 int screen; /* ¥¹¥¯¥ê¡¼¥ó */ 29 unsigned long black,white; /* ¹õ¤ÈÇò¤Î¥Ô¥¯¥»¥ëÃÍ */ 30 GC gc; /* ¥°¥é¥Õ¥£¥Ã¥¯¥¹¥³¥ó¥Æ¥¥¹¥È */ 31 XEvent evt; /* ¥¤¥Ù¥ó¥È¹½Â¤ÂÎ */ 32 33 Colormap cmap; /* ¥«¥é¡¼¥Þ¥Ã¥× */ 34 XColor color, exact; 35 unsigned long green, red; /* ÎФÈÀ֤Υԥ¯¥»¥ëÃÍ */ 36 37 38 /* X¥µ¡¼¥Ð¤ÈÀܳ¤¹¤ë */ 39 dpy = XOpenDisplay( "" ); 40 41 42 /* ¥Ç¥£¥¹¥×¥ì¥¤ÊÑ¿ô¤Î¼èÆÀ */ 43 root = DefaultRootWindow( dpy ); 44 screen = DefaultScreen( dpy ); 45 46 47 /* XAllocNamedColor() ¤Î¤¿¤á¤Ë¥«¥é¡¼¥Þ¥Ã¥×¤ò¼èÆÀ */ 48 cmap = DefaultColormap( dpy, screen ); 49 50 51 /* Çò¡¢¹õ¤Î¥Ô¥¯¥»¥ëÃͤò¼èÆÀ */ 52 white = WhitePixel( dpy, screen ); 53 black = BlackPixel( dpy, screen ); 54 55 56 /* ÎФÈÀ֤Υԥ¯¥»¥ëÃͤò¼èÆÀ */ 57 XAllocNamedColor( dpy, cmap, "green", &color, &exact ); 58 green = color.pixel; 59 60 XAllocNamedColor( dpy, cmap, "red", &color, &exact ); 61 red = color.pixel; 62 63 64 /* ¥¦¥£¥ó¥É¥¦¤òºîÀ®¤¹¤ë¡£¤³¤Î»þÅÀ¤Ç¤Ï¤Þ¤À²èÌ̤Ëɽ¼¨¤µ¤ì¤Ê¤¤¡£*/ 65 win = XCreateSimpleWindow( dpy, root, 66 WIN_X, WIN_Y, WIN_W, WIN_H, BORDER, black, white); 67 68 69 /* ¥°¥é¥Õ¥£¥Ã¥¯¥¹¥³¥ó¥Æ¥¥¹¥È¤òºî¤ë */ 70 gc = XCreateGC( dpy, win, 0, NULL ); 71 72 73 /* X¥µ¡¼¥Ð¤«¤éÄÌÃΤ·¤Æ¤â¤é¤¦¥¤¥Ù¥ó¥È¤ò»ØÄê 74 ¤³¤³¤Ç¤Ï¥¡¼²¡²¼¥¤¥Ù¥ó¥È¤Î¾¤Ë Expose ¥¤¥Ù¥ó¥È¤òÁªÂò¤·¤Æ¤¤¤ë */ 75 XSelectInput( dpy, win, KeyPressMask | ExposureMask ); 76 77 78 /* ¥¦¥£¥ó¥É¥¦¤ò²èÌ̤Ëɽ¼¨¤¹¤ë(¥Þ¥Ã¥×¤¹¤ë)¡£ */ 79 XMapWindow( dpy, win ); 80 81 82 /* X¥µ¡¼¥Ð¤«¤é¥¤¥Ù¥ó¥È¤òÆɤ߹þ¤ó¤Ç¿ï»þ½èÍý¤·¤Æ¤¤¤¯¥¤¥Ù¥ó¥È¥ë¡¼¥× */ 83 while( 1 ) { 84 XNextEvent( dpy, &evt ); 85 86 switch( evt.type ) { 87 case Expose: 88 if ( evt.xexpose.count == 0 ) { 89 draw( dpy, win, gc, green, red ); 90 } 91 break; 92 93 case KeyPress: 94 /* ¥ê¥½¡¼¥¹¤Î²òÊü */ 95 XFreeGC( dpy, gc ); 96 XDestroyWindow( dpy, win ); 97 XCloseDisplay( dpy ); 98 return 0; 99 } 100 } 101 } 102 103 104 static void 105 draw( Display* dpy, Window win, GC gc, 106 unsigned long green, unsigned long red ) 107 { 108 /* ÉÁ²è¿§¤ËÀÖ¤òÀßÄê */ 109 XSetForeground( dpy, gc, red ); 110 111 /* »Í³Ñ·Á¤ÎÉÁ²è */ 112 XFillRectangle( dpy, win, gc, BOX_X, BOX_Y, BOX_W, BOX_H ); 113 114 /* ÉÁ²è¿§¤ËÎФòÀßÄê */ 115 XSetForeground( dpy, gc, green ); 116 117 /* ±ß¤ÎÉÁ²è */ 118 XFillArc( dpy, win, gc, 119 CIRCLE_X, CIRCLE_Y, CIRCLE_W, CIRCLE_H, 120 0, 360 * 64 ); 121 } 122 123 124 /* End of xgraphics.c */
¡û ¥µ¥ó¥×¥ë¥×¥í¥°¥é¥à¤ÎÀâÌÀ
¤Ç¤Ï¡¢¥µ¥ó¥×¥ë¥×¥í¥°¥é¥à¤Ë¤Ä¤¤¤ÆÀâÌÀ¤·¤Æ¤¤¤¤Þ¤¹¡£¤³¤ì¤Þ¤Ç¤ËÀâÌÀ¤·¤¿ÆâÍƤˤĤ¤¤Æ¤ÏÀâÌÀ¤ò¾Êά¤·¤Þ¤¹¡£
- 8 ¡Á 15 ¹ÔÌÜ
¥¦¥£¥ó¥É¥¦¤ËÉÁ²è¤¹¤ëĹÊý·Á¤ª¤è¤Ó±ß¤Ë¤Ä¤¤¤Æ¤ÎÄê¿ô¤òÄêµÁ¤·¤Æ¤¤¤Þ¤¹¡£¤³¤ì¤é¤ÎÄê¿ô¤Ï¡¢ÉÁ²è ´Ø¿ôÆâ¤Ç»ÈÍѤ·¤Þ¤¹¡£
- 57 ¡Á 61 ¹ÔÌÜ
ÎФÈÀÖ¿§¤Î¥Ô¥¯¥»¥ëÃͤò¼èÆÀ¤·¤Æ¤¤¤Þ¤¹¡£xcolor.c ¤Î»þ¤ÈƱÍÍ¤Ë XAllocNamedColor() ¤ò»È¤Ã¤Æ ¥Ô¥¯¥»¥ëÃͤò¼èÆÀ¤·¤Æ¤¤¤Þ¤¹¡£
- 69 ¡Á 70 ¹ÔÌÜ
¥°¥é¥Õ¥£¥Ã¥¯¥¹¥³¥ó¥Æ¥¥¹¥È( GC )¤òÀ¸À®¤·¤Æ¤¤¤Þ¤¹¡£GC ¤È¤Ï¡¢ÉÁ²è¤ËɬÍפÊ°À¾ðÊó(ÉÁ²è¤Ë »È¤¦¿§¡¢¥Õ¥©¥ó¥È¡¢Àþ¤ÎÂÀ¤µ¡¢etc.)¤ò³ÊǼ¤¹¤ë¤¿¤á¤ËɬÍפʤâ¤Î¤Ç¤¹¡£¤³¤ì¤Ë¤Ä¤¤¤Æ¤Ï LECTURE 6¤Ç¾Ü¤·¤¯ÀâÌÀ¤·¤Þ¤¹¡£
- 73 ¡Á 75 ¹ÔÌÜ
¥¤¥Ù¥ó¥È¤òÁªÂò¤·¤Æ¤¤¤Þ¤¹¤¬¡¢¤³¤ì¤Þ¤Ç¤Î KeyPressMask (¥¡¼²¡²¼¥¤¥Ù¥ó¥ÈÍÑ¥¤¥Ù¥ó¥È¥Þ¥¹¥¯) ¤Î¾¤Ë¡¢ExposureMask ( Expose ¥¤¥Ù¥ó¥ÈÍÑ¥¤¥Ù¥ó¥È¥Þ¥¹¥¯ )¤¬»ØÄꤵ¤ì¤Æ¤¤¤Þ¤¹¡£Expose ¥¤ ¥Ù¥ó¥È¤Ë¤Ä¤¤¤Æ¤ÏLECTURE 7¤Ç¾Ü¤·¤¯ÀâÌÀ¤·¤Þ¤¹¡£¤³¤³¤Ç¤Ï¡¢ ¥°¥é¥Õ¥£¥Ã¥¯¥¹¤ÎÉÁ²è¤ËɬÍפÀ¤È¹Í¤¨¤Æ¤ª¤±¤ÐÎɤ¤¤Ç¤¹¡£
- 87 ¡Á 91 ¹ÔÌÜ
¥¤¥Ù¥ó¥È¥ë¡¼¥×Æâ¤Ç¡¢Expose ¥¤¥Ù¥ó¥È¤ËÂФ¹¤ë½èÍý¤ò¹Ô¤Ã¤Æ¤¤¤Þ¤¹¡£ºÇ½é¤Ë
if ( evt.xexpose.count == 0 )
¤È¤¤¤¦¾ò·ïȽÃÇʸ¤¬¤¢¤ê¤Þ¤¹¤¬¡¢¤³¤ì¤ÏÊ£¿ôϢ³¤Ç Expose ¥¤¥Ù¥ó¥È¤¬Á÷¤é¤ì¤ÆÍ褿¾ì¹ç¤Ë¡¢ºÇ ¸å¤Î°ì¤Ä¤ò¼õ¤±¼è¤Ã¤¿»þ¤ËÉÁ²è¤ò¹Ô¤¦¤¿¤á¤Î if ʸ¤Ç¤¹¡£²¿¸Î¤³¤Î¤è¤¦¤Ê¤³¤È¤ò¤¹¤ë¤Î¤«¤Ë¤Ä¤¤ ¤Æ¤Ï¡¢LECTURE 7¤Ë¤ª¤¤¤Æ Expose ¥¤¥Ù¥ó¥È¤ÎÀâÌÀ¤ò¤¹¤ë»þ¤Ë ½Ò¤Ù¤Þ¤¹¡£
¼ÂºÝ¤ÎÉÁ²è¤Ï¡¢¸å½Ò¤Î draw() ´Ø¿ô¤Ç¹Ô¤Ã¤Æ¤¤¤Þ¤¹¡£
- 95 ¹ÔÌÜ
¥ê¥½¡¼¥¹²òÊü¤ÎÉôʬ¤Ë¡¢¿·¤¿¤Ë GC ²òÊüÍѤνèÍý XFreeGC() ¤¬Äɲ䵤ì¤Æ¤¤¤Þ¤¹¡£¤³¤ì¤Ë¤Ä¤¤ ¤Æ¤â¡¢GC ¤ÎÀâÌÀ¤ÎºÝ¤ËÀâÌÀ¤·¤Þ¤¹¡£
- 104 ¡Á 121 ¹ÔÌÜ
Expose ¥¤¥Ù¥ó¥È¼õ¿®»þ¤ÎÉÁ²è½èÍý¤Ç¤¹¡£
XFillRectangle() ¤ÇĹÊý·Á¤ò¡¢XFillArc() ¤Ç±ß¤òÉÁ²è¤·¤Æ¤¤¤Þ¤¹¤¬¡¢¤½¤ì¤¾¤ì¤Î´Ø¿ô¤ò¼Â¹Ô ¤¹¤ëÁ°¤Ë XSetForeground() ¤ò»È¤Ã¤Æ GC ¤ËÉÁ²è¤¹¤ë¿§¤òÀßÄꤷ¤Æ¤¤¤Þ¤¹¡£¥°¥é¥Õ¥£¥Ã¥¯¥¹¤ò ÉÁ²è¤¹¤ë¾ì¹ç¤Ï¡¢É¬ÍפÊÉÁ²è°À¤ò GC ¤Ë¤¢¤é¤«¤¸¤áÀßÄꤷ¤Æ¤ª¤¤¤Æ¡¢¤½¤Î GC ¤ò»È¤Ã¤ÆÉÁ²è´Ø ¿ô¤ò¼Â¹Ô¤¹¤ë¤È¤¤¤¦¼ê½ç¤Ë¤Ê¤ê¤Þ¤¹¡£XFillRectangle() ¤ä XFillArc() ¤Ë¤Ä¤¤¤Æ¤Ï¡¢¸åÄø X ¤Î ÉÁ²è´Ø¿ô¤ò¤Þ¤È¤á¤Æ¾Ò²ð¤¹¤ëºÝ¤ËÀâÌÀ¤·¤Þ¤¹¡£XSetForeground() ¤Ë¤Ä¤¤¤Æ¤Ï¡¢ LECTURE 6¤Ç GC ¤ÎÀâÌÀ¤ò¤¹¤ë»þ¤ËÀâÌÀ¤·¤Þ¤¹¡£
X ¤ÎÉÁ²è´Ø¿ô¤È GC ¤ÎÀâÌÀ¤ò¤Þ¤È¤á¤Æ¹Ô¤¦¤ÈʬÎ̤¬Â礤¯¤Ê¤Ã¤Æ¤·¤Þ¤¦¤Î¤Ç¡¢¤³¤³¤Ç¤Ï ÉÁ²è´Ø¿ô¤Ë´Ø¤¹¤ëÀâÌÀ¤ò¹Ô¤¤¡¢GC ¤Ë¤Ä¤¤¤Æ¤ÏLECTURE 6¤Ç¹Ô¤¤¤Þ¤¹¡£¥°¥é¥Õ¥£¥Ã¥¯¥¹¤ÎÉÁ²è¤Ë¤Ï GC ¤¬É¬Íפʤó¤À¤È¤¤¤¦¤³¤È¤ò¤³¤³¤Ç¤Ï³Ð¤¨¤Æ¤ª¤¤¤Æ²¼¤µ¤¤¡£
¡û Drawable
¤È¤³¤í¤Ç¡¢ÍÍ¡¹¤Ê¥°¥é¥Õ¥£¥Ã¥¯¥¹¤òÉÁ²è¤¹¤ëºÝ¤Ë¤Ï¤½¤ì¤é¤òÉÁ²è¤¹¤ëÂоݤ¬ÅöÁ³É¬ÍפȤʤê¤Þ¤¹¡£X¥¦¥£¥ó¥É¥¦¥·¥¹¥Æ¥à¤Ç¤Ï¡¢ÉÁ²è¤ÎÂоݤȤʤë¤â¤Î¤È¤·¤Æº£¤Þ¤Ç¤Ë¤â½Ð¤ÆÍ褿 "¥¦¥£¥ó¥É¥¦" °Ê³°¤Ë¡¢"¥Ô¥¯¥¹¥Þ¥Ã¥×" ¤È¸Æ¤Ð¤ì¤ë¤â¤Î¤òÍÑ°Õ¤·¤Æ¤¤¤Þ¤¹¡£
¥¦¥£¥ó¥É¥¦¤È¤Ï¡¢²èÌ̾å¤ÎĹÊý·ÁÎΰè¤Î¤³¤È¤òɽ¤·¤Æ¤¤¤Þ¤¹¡£¤³¤ì¤ËÂФ·¤Æ¡¢¥Ô¥¯¥¹¥Þ¥Ã¥×¤Ï²èÌ̾å¤Ë¤Ê¤¤(¥á¥â¥ê¾å¡¢¤Þ¤¿¤Ï¥ª¥Õ¥¹¥¯¥ê¡¼¥ó¾å¤È¤¤¤¦)ĹÊý·ÁÎΰè¤Î¤³¤È¤òɽ¤·¤Æ¤¤¤Þ¤¹¡£¤³¤Î 2 ¤Ä¤ÎÉÁ²èÂоݤòÁí¾Î¤·¤Æ Drawable ¤È¸Æ¤Ó¤Þ¤¹¡£¤Û¤È¤ó¤É¤ÎÉÁ²è´Ø¿ô¤Ï¡¢¥¦¥£¥ó¥É¥¦¤È¥Ô¥¯¥¹¥Þ¥Ã¥×¤ÎÁÐÊý¤ËÂФ·¤ÆÉÁ²è¤ò¹Ô¤¦¤³¤È¤¬¤Ç¤¤Þ¤¹¡£
¥Ô¥¯¥¹¥Þ¥Ã¥×¤Î»È¤¤Êý¤Î°ìÎã¤Ç¤¹¤¬¡¢¥¢¥Ë¥á¡¼¥·¥ç¥ó¤Ê¤É¤ò¹Ô¤¦¾ì¹ç¤Ë³Æ¥Õ¥ì¡¼¥à¤ò¥¦¥£¥ó¥É¥¦¤ËľÀÜÉÁ²è¤·¤Æ¤¤¤Æ¤Ï¤Á¤é¤Ä¤¤¬À¸¤¸¤ë¤Î¤Ç¡¢¥Õ¥ì¡¼¥à¤ò¥Ô¥¯¥¹¥Þ¥Ã¥×¤Ë´°Á´¤ËÉÁ²è¤·¤Æ¤«¤é¥¦¥£¥ó¥É¥¦¤Ë°ìµ¤¤Ë¥³¥Ô¡¼¤¹¤ë¤³¤È¤Ç¤Á¤é¤Ä¤¤òÍÞ¤¨¤ë(¥À¥Ö¥ë¥Ð¥Ã¥Õ¥¡¥ê¥ó¥°)¤¿¤á¤Ë»È¤Ã¤¿¤ê¤·¤Þ¤¹¡£
¡û X ¤ÎÉÁ²è´Ø¿ô¤ÎÀâÌÀ
xgraphics.c ¤Ç¤ÏĹÊý·Á¤ª¤è¤Ó±ß¤òÉÁ¤¤Þ¤·¤¿¤¬¡¢Àþ¤ò°ú¤¤¤¿¤ê¡¢Â¿³Ñ·Á(¥Ý¥ê¥´¥ó)¤òÉÁ¤¤¤¿¤ê¡¢¤¢¤ë¥¦¥£¥ó¥É¥¦(¥Ô¥¯¥¹¥Þ¥Ã¥×¡Ë¤ÎÆâÍƤò°ìµ¤¤ËÊ̤Υ¦¥£¥ó¥É¥¦(¥Ô¥¯¥¹¥Þ¥Ã¥×)¤Ë¥³¥Ô¡¼¤·¤¿¤ê¤È¤¤¤í¤¤¤í¤Ê¥°¥é¥Õ¥£¥Ã¥¯¥¹¤ÎÉÁ²èÊýË¡¤¬¤¢¤ê¤Þ¤¹¡£°Ê¹ß¤ÏÉÁ²èÍѤΠXlib ´Ø¿ô¤Ë¤Ä¤¤¤Æ
- ÅÀ¤ÎÉÁ²è
- Àþ¤ÎÉÁ²è
- ĹÊý·Á¡¢±ß¸Ì¤ÎÉÁ²è
- ¥Ý¥ê¥´¥ó¤ÎÅɤê¤Ä¤Ö¤·
- ʸ»úÎó¤ÎÉÁ²è
- ¥Ô¥¯¥¹¥Þ¥Ã¥×¤ÎÀ¸À®¡¢²òÊü
- Îΰè¤Î¥¯¥ê¥¢
- Îΰè¤Î¥³¥Ô¡¼
¤Î½ç¤ËÀâÌÀ¤·¤Æ¤¤¤¤Þ¤¹¡£¤Ê¤ª¡¢°Ê¹ß¤ÎÉÁ²è´Ø¿ô¤Ç¤Ï¥¦¥£¥ó¥É¥¦¾å¤Ç¤Î°ÌÃÖºÂɸ¤¬É¬ÍפȤʤê¤Þ¤¹¤¬¡¢¥¦¥£¥ó¥É¥¦¤Ë¤ª¤±¤ëºÂɸ·Ï¤Ï¡¢º¸¾å¤Î³Ñ¤ò¸¶ÅÀ¤È¤·¤Æ±¦Êý¸þ¤òÀµ¤Ë X ¼´¡¢²¼Êý¸þ¤òÀµ¤Ë Y ¼´¤È¤Ê¤ê¤Þ¤¹¡£
¡ü ÅÀ¤ÎÉÁ²è
- XDrawPoint();
»ØÄꤷ¤¿ºÂɸ(x, y)¤Ë1¥Ô¥¯¥»¥ë¤ÎÅÀ¤ò gc ¤Î¥Õ¥©¥¢¥°¥é¥¦¥ó¥É¥«¥é¡¼¤ÇÉÁ²è¤·¤Þ¤¹¡£
XDrawPoint( Display* display, /* ¥Ç¥£¥¹¥×¥ì¥¤ÊÑ¿ô */ Drawable d, /* ÉÁ²èÂÐ¾Ý */ GC gc, /* ¥°¥é¥Õ¥£¥Ã¥¯¥¹¥³¥ó¥Æ¥¥¹¥È */ int x, /* xºÂɸ */ int y /* yºÂɸ */ );
- XDrawPoints();
°ìÅÙ¤ËÊ£¿ô¸Ä¤ÎÅÀ¤òÉÁ²è¤¹¤ë¾ì¹ç¤Ë¤Ï¡¢XDrawPoints() ¤òÍѤ¤¤Þ¤¹¡£
XDrawPoints( Display* display, /* ¥Ç¥£¥¹¥×¥ì¥¤ÊÑ¿ô */ Drawable d, /* ÉÁ²èÂÐ¾Ý */ GC gc, /* ¥°¥é¥Õ¥£¥Ã¥¯¥¹¥³¥ó¥Æ¥¥¹¥È */ XPoint* points, /* ÅÀ¤ÎºÂɸ¤ÎÇÛÎó */ int npoints, /* ÅÀ¤Î¸Ä¿ô */ int mode /* ÉÁ²è¥â¡¼¥É */ );
¤³¤Î´Ø¿ô¤Ï¡¢npoints ¸Ä¤ÎÅÀ¤ò points ¤Ç»ØÄꤷ¤¿ºÂɸ¤ËÉÁ²è¤·¤Þ¤¹¡£¤³¤³¤Ç½Ð¤ÆÍè¤ë Xpoint ¹½Â¤ÂΤϼ¡¤Î¤è¤¦¤ËÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤¹¡£
typedef struct { short x, y; } XPoint;
mode ¤Ë CoordModeOrigin ¤ò»ØÄꤹ¤ë¤È¡¢points ¤Ç»ØÄꤷ¤¿ºÂɸ¤ÏÁ´¤Æ¥¦¥£¥ó¥É¥¦¤Î¸¶ÅÀ ¤«¤é¤ÎÀäÂкÂɸ¤Ç¤¢¤ë¤È²ò¼á¤µ¤ì¤Þ¤¹¡£CoordModePrevious ¤ò»ØÄꤹ¤ë¤È³ÆÅÀ¤Ï¤½¤ÎÁ°¤ÎÅÀ ¤«¤é¤ÎÁêÂкÂɸ¤Çɽ¤µ¤ì¤Æ¤¤¤ë¤È²ò¼á¤µ¤ì¤Þ¤¹¡£
¡ü Àþ¤ÎÉÁ²è
- XDrawLine();
gc ¤Î¥Õ¥©¥¢¥°¥é¥¦¥ó¥É¥«¥é¡¼¤ò»È¤Ã¤Æ¡¢ÅÀ 1 ¤«¤éÅÀ 2 ¤ËÀþ¤ò°ú¤¤Þ¤¹¡£
XDrawLine( Display* display, /* ¥Ç¥£¥¹¥×¥ì¥¤ÊÑ¿ô */ Drawable d, /* ÉÁ²èÂÐ¾Ý */ GC gc, /* ¥°¥é¥Õ¥£¥Ã¥¯¥¹¥³¥ó¥Æ¥¥¹¥È */ int x1, /* ÅÀ1¤ÎxºÂɸ */ int y1, /* ÅÀ1¤ÎyºÂɸ */ int x2, /* ÅÀ2¤ÎxºÂɸ */ int y2 /* ÅÀ2¤ÎyºÂɸ */ );
- XDrawLines();
npoints ¸Ä¤ÎÅÀ¤ò·ë¤ÖÀÞ¤ìÀþ¤ò°ú¤¤Þ¤¹¡£
XDrawLines( Display* display, /* ¥Ç¥£¥¹¥×¥ì¥¤ÊÑ¿ô */ Drawable d, /* ÉÁ²èÂÐ¾Ý */ GC gc, /* ¥°¥é¥Õ¥£¥Ã¥¯¥¹¥³¥ó¥Æ¥¥¹¥È */ XPoint* points, /* »ÏÅÀ¡¢½ªÅÀ¤ÎÇÛÎó */ int npoints, /* »ÏÅÀ¡¢½ªÅÀ¤Î¸Ä¿ô */ int mode /* ÉÁ²è¥â¡¼¥É */ );
points, npoints, mode ¤Î°ÕÌ£¤Ï XDrawPoints() ¤Î¤½¤ì¤ÈƱ¤¸¤Ç¤¹¡£
- XDrawSegments();
segments ¤ÇÍ¿¤¨¤é¤ì¤¿ 2 ÅÀ¤ÎÁȤËÂФ·¤Æ¡¢2 ÅÀ´Ö¤òÀþ¤È¤·¤ÆÉÁ²è¤·¤Þ¤¹¡£
XDrawSegments( Display* display, /* ¥Ç¥£¥¹¥×¥ì¥¤ÊÑ¿ô */ Drawable d, /* ÉÁ²èÂÐ¾Ý */ GC gc, /* ¥°¥é¥Õ¥£¥Ã¥¯¥¹¥³¥ó¥Æ¥¥¹¥È */ XSegment* segments, /* ¥»¥°¥á¥ó¥È¤ÎÇÛÎó */ int nsegments /* ¥»¥°¥á¥ó¥È¤Î¸Ä¿ô */ );
³Æ¥»¥°¥á¥ó¥È´Ö¤ÏÀþ¤¬ÉÁ²è¤µ¤ì¤Þ¤»¤ó¡£nsegments ¤Ë¤Ï segments ¤ËÀßÄꤵ¤ì¤Æ¤¤¤ë¥»¥°¥á ¥ó¥È¤Î¸Ä¿ô¤ò»ØÄꤷ¤Þ¤¹¡£
¤³¤³¤Ç½Ð¤ÆÍè¤ë XSegment ¹½Â¤ÂΤϼ¡¤Î¤è¤¦¤ËÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤¹¡£
typedef struct { short x1, y1, x2, y2; /* »ÏÅÀ¡¢½ªÅÀ */ } XSegment;
¡ü ĹÊý·Á¡¢±ß¸Ì¤ÎÉÁ²è
- XDrawRectangle(), XFillRectangle()
ĹÊý·Á¤òÉÁ²è¤·¤Þ¤¹¡£
XDrawRectangle( Display* display, /* ¥Ç¥£¥¹¥×¥ì¥¤ÊÑ¿ô */ Drawable d, /* ÉÁ²èÂÐ¾Ý */ GC gc, /* ¥°¥é¥Õ¥£¥Ã¥¯¥¹¥³¥ó¥Æ¥¥¹¥È */ int x, /* ĹÊý·Á¤Îº¸¾å¤ÎxºÂɸ */ int y, /* ĹÊý·Á¤Îº¸¾å¤ÎyºÂɸ */ unsigned int width, /* ĹÊý·Á¤ÎÉý */ unsigned int height /* ĹÊý·Á¤Î¹â¤µ */ ); XFillRectangle( display, d, gc, x, y, width, height );
»ØÄꤷ¤¿(x, y)ºÂɸ¤òº¸¾å¤ÎĺÅÀ¤È¤·¤ÆÉý width¡¢¹â¤µ height ¤ÎĹÊý·Á¤òÉÁ²è¤·¤Þ¤¹¡£ XFillRectangle() ¤ÏÅɤê¤Ä¤Ö¤·¤¿Ä¹Êý·Á¤òÉÁ²è¤·¤Þ¤¹¡£
- XDrawRectangles(), XFillRectangles()
ĹÊý·Á¤òÊ£¿ôÉÁ²è¤¹¤ë¤¿¤á¤Ë¤Ï XDrawRectangles()¡¢XFillRectangles() ¤ò»È¤¤¤Þ¤¹¡£ XFillRectangles() ¤ÏÅɤê¤Ä¤Ö¤·¤¿Ä¹Êý·Á¤òÉÁ²è¤·¤Þ¤¹¡£
XDrawRectangles( Display* display, /* ¥Ç¥£¥¹¥×¥ì¥¤ÊÑ¿ô */ Drawable d, /* ÉÁ²èÂÐ¾Ý */ GC gc, /* ¥°¥é¥Õ¥£¥Ã¥¯¥¹¥³¥ó¥Æ¥¥¹¥È */ XRectangle* rects, /* ĹÊý·Á¤ÎÇÛÎó */ int nrects /* ĹÊý·Á¤Î¸Ä¿ô */ ); XFillRectangles( display, d, gc, rects, nrects );
rects ¤ÏĹÊý·Á¤ÎÇÛÎó¤Ç¤¢¤ê¡¢nrects ¤Ë¤Ï¤½¤Î¸Ä¿ô¤ò»ØÄꤷ¤Þ¤¹¡£¤³¤³¤Ç½Ð¤ÆÍè¤ë XRectangle ¹½Â¤ÂΤϼ¡¤Î¤è¤¦¤ËÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤¹¡£
typedef struct { short x, y; /* º¸¾å¤ÎºÂɸ */ unsigned short width, height; /* Éý¤È¹â¤µ */ } XRectangle;
- XDrawArc(), XFillArc()
±ß¸Ì¤òÉÁ²è¤·¤Þ¤¹¡£±ß¸Ì¤ÏĹÊý·Á¤ÎÆâÀܱߤȤ·¤ÆºÂɸ¤ò»ØÄꤷ¤Þ¤¹¡£
XDrawArc( Display* display,/* ¥Ç¥£¥¹¥×¥ì¥¤ÊÑ¿ô */ Drawable d, /* ÉÁ²èÂÐ¾Ý */ GC gc, /* ¥°¥é¥Õ¥£¥Ã¥¯¥¹¥³¥ó¥Æ¥¥¹¥È */ int x, /* ³°Àܤ¹¤ëĹÊý·Á¤Îº¸¾å¤ÎºÂɸ */ int y, /* Ʊ¾å */ unsigned int width, /* ĹÊý·Á¤ÎÉý */ unsigned int height, /* ĹÊý·Á¤Î¹â¤µ */ int angle1, /* »Ï³Ñ */ int angle2 /* ½ª³Ñ */ ); XFillArc( display, d, gc, x, y, width, height, angle1, angle2 );
XFillArc() ¤Ï±ß¸Ì¤òÅɤê¤Ä¤Ö¤·¤Þ¤¹¡£»ØÄꤹ¤ë³ÑÅÙ¤Îñ°Ì¤Ï 1/64 Å٤Ǥ¹¡£Î㤨¤Ð 360 ÅÙ ¤Ï 360 x 64 ¤È¤Ê¤ê¤Þ¤¹¡£
- XDrawArcs(), XFillArcs()
Ê£¿ô¤Î±ß¸Ì¤òÉÁ²è¤¹¤ë¾ì¹ç¤Ë¤Ï XDrawArcs()¡¢XFillArcs() ¤ò»ÈÍѤ·¤Þ¤¹¡£XFillArcs() ¤Ï±ß¸Ì¤òÅɤê¤Ä¤Ö¤·¤Þ¤¹¡£
XDrawArcs( Display* display, /* ¥Ç¥£¥¹¥×¥ì¥¤ÊÑ¿ô */ Drawable d, /* ÉÁ²èÂÐ¾Ý */ GC gc, /* ¥°¥é¥Õ¥£¥Ã¥¯¥¹¥³¥ó¥Æ¥¥¹¥È */ XArc* arcs, /* ¹½Â¤ÂΤÎÇÛÎó */ int narcs /* ÇÛÎó¤Î¸Ä¿ô */ ); XFillArcs( dpy, d, gc, arcs, narcs );
¤³¤³¤Ç½Ð¤ÆÍè¤ë XArc ¹½Â¤ÂΤϼ¡¤Î¤è¤¦¤ËÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤¹¡£
typedef struct { short x, y; unsigned short width, height; short angle1, angle2; } XArc;
¡ü ¥Ý¥ê¥´¥ó¤ÎÅɤê¤Ä¤Ö¤·
- XFillPolygon();
¥Ý¥ê¥´¥ó(¿³Ñ·Á)¤òÅɤê¤Ä¤Ö¤¹¾ì¹ç¤Ë¤Ï¡¢XFillPolygon() ¤ò»È¤¤¤Þ¤¹¡£
XFillPolygon( Display* display, /* ¥Ç¥£¥¹¥×¥ì¥¤ÊÑ¿ô */ Drawable d, /* ÉÁ²èÂÐ¾Ý */ GC gc, /* ¥°¥é¥Õ¥£¥Ã¥¯¥¹¥³¥ó¥Æ¥¥¹¥È */ XPoint* points, /* ĺÅÀÇÛÎó */ int npoints, /* ĺÅÀ¤Î¸Ä¿ô */ int shape, /* ¥Ý¥ê¥´¥ó¤Î·Á */ int mode /* ÉÁ²è¥â¡¼¥É */ );
points¡¢npoints¡¢mode ¤Î°ÕÌ£¤Ï XDrawPoints() ¤Î°ú¿ô¤ÈƱ¤¸¤Ç¤¹¡£points ¤ÎºÇ½é¤ÎÅÀ ¤ÈºÇ¸å¤ÎÅÀ¤¬°ìÃפ·¤Æ¤¤¤Ê¤¤¾ì¹ç¤Ë¤Ï¡¢¼«Æ°Åª¤ËºÇ½é¤ÎÅÀ¤ÈºÇ¸å¤ÎÅÀ¤ò·ë¤ó¤ÇÅɤê¤Ä¤Ö¤·¤Æ ¤¯¤ì¤Þ¤¹¡£
shape ¤Ë¤Ï¥Ý¥ê¥´¥ó¤Î·Á¤ò»ØÄꤷ¤Þ¤¹¡£ÆÌ·¿¤Î¾ì¹ç¤Ï Convex¡¢ÆÌ·¿¤Ç¤Ï¤Ê¤¯ÊÕ¤¬¸òº¹¤·¤Æ ¤Ê¤¤¾ì¹ç¤Ï Nonconvex¡¢ÊÕ¤¬¸òº¹¤·¤Æ¤¤¤ë¾ì¹ç¤Ï Complex ¤ò»ØÄꤷ¤Þ¤¹¡£
¡ü ʸ»úÎó¤ÎÉÁ²è
¤³¤³¤ÇÀâÌÀ¤¹¤ë´Ø¿ô¤ÏȾ³Ñ±Ñ¿ô»ú¤Î¤è¤¦¤Ê 1 ¥Ð¥¤¥Èʸ»ú¤ÎÉÁ²è¤ËÍѤ¤¤ë´Ø¿ô¤Ç¤¹¡£ÆüËܸì¤Î¤è¤¦¤Ê¥Þ¥ë¥Á¥Ð¥¤¥Èʸ»úÎó¤òÉÁ²è¤¹¤ëÊýË¡¤Ë¤Ä¤¤¤Æ¤Ï°Ê¹ß¤Î LECTURE ¤ÇÀâÌÀ¤·¤Þ¤¹¡£
- XDrawString();
ʸ»úÎó¤òÉÁ²è¤·¤Þ¤¹¡£
XDrawString( Display* display,/* ¥Ç¥£¥¹¥×¥ì¥¤ÊÑ¿ô */ Drawable d, /* ÉÁ²èÂÐ¾Ý */ GC gc, /* ¥°¥é¥Õ¥£¥Ã¥¯¥¹¥³¥ó¥Æ¥¥¹¥È */ int x, /* xºÂɸ */ int y, /* yºÂɸ */ char* string, /* ÉÁ²è¤¹¤ëʸ»úÎó */ int length /* ÉÁ²è¤¹¤ëʸ»ú¿ô */ );
¤³¤Î´Ø¿ô¤Ï¡¢»ØÄꤷ¤¿ºÂɸ(x, y)¤ò¸¶ÅÀ¤È¤·¤Æ string ¤Ç»ØÄꤷ¤¿Ê¸»úÎó¤ò gc ¤Î¥Õ¥©¥¢¥° ¥é¥¦¥ó¥É¥«¥é¡¼¤ÇÉÁ²è¤·¤Þ¤¹¡£length ¤Ë¤Ï string ¤Îʸ»ú¿ô¤ò»ØÄꤷ¤Þ¤¹¡£
- XDrawImageString();
°ú¿ô¤Î°ÕÌ£¤Ï XDrawString() ¤ÈƱ¤¸¤Ç¤¹¡£ÉÁ²è¤¹¤ëʸ»úÎó¤Î¥Ð¥¦¥ó¥Ç¥£¥ó¥°¥Ü¥Ã¥¯¥¹(¤½¤Î ʸ»úÎó¤ò°Ï¤àĹÊý·Á)¤¬ gc ¤Î¥Ð¥Ã¥¯¥°¥é¥¦¥ó¥É¥«¥é¡¼¤ÇÅɤê¤Ä¤Ö¤µ¤ì¤¿¾å¤Ë¡¢gc ¤Î¥Õ¥©¥¢¥° ¥é¥¦¥ó¥É¥«¥é¡¼¤Çʸ»úÎó¤¬ÉÁ²è¤µ¤ì¤ëÅÀ¤¬°Û¤Ê¤ê¤Þ¤¹¡£
XDrawImageString( Display* display,/* ¥Ç¥£¥¹¥×¥ì¥¤ÊÑ¿ô */ Drawable d, /* ÉÁ²èÂÐ¾Ý */ GC gc, /* ¥°¥é¥Õ¥£¥Ã¥¯¥¹¥³¥ó¥Æ¥¥¹¥È */ int x, /* xºÂɸ */ int y, /* yºÂɸ */ char* string, /* ÉÁ²è¤¹¤ëʸ»úÎó */ int length /* ÉÁ²è¤¹¤ëʸ»ú¿ô */ );
¡ü ¥Ô¥¯¥¹¥Þ¥Ã¥×¤ÎÀ¸À®¡¢²òÊü
- XCreatePixmap();
¥Ô¥¯¥¹¥Þ¥Ã¥×¤òÀ¸À®¤·¤Þ¤¹¡£
Pixmap XCreatePixmap( Display* display, /* ¥Ç¥£¥¹¥×¥ì¥¤ÊÑ¿ô */ Drawable d, /* ¥Ô¥¯¥¹¥Þ¥Ã¥×¤òÀ¸À®¤¹¤ëÂоݤȤʤë Drawable */ unsigned int width, /* ¥Ô¥¯¥¹¥Þ¥Ã¥×¤ÎÉý */ unsigned int height, /* ¥Ô¥¯¥¹¥Þ¥Ã¥×¤Î¹â¤µ */ unsigned int depth /* ¥Ô¥¯¥¹¥Þ¥Ã¥×¤Î¿¼¤µ */ );
depth¤Ë¤Ï¡¢Ä̾ï DefaultDepth() ¥Þ¥¯¥í¤òÍѤ¤¤Æ¥Ç¥£¥¹¥×¥ì¥¤¤ÈƱ¤¸¿¼¤µ¤ò»ØÄꤷ¤Þ¤¹¡£ ÊÖµÑÃͤϥ¦¥£¥ó¥É¥¦¤ÎÀ¸À®¤ÈƱ¤¸¤è¤¦¤Ë¥Ô¥¯¥¹¥Þ¥Ã¥×¤Î¼±ÊÌ»Ò( ID )¤Ç¤¹¡£¤Ê¤ª¿¼¤µ 1 ¤Î ¥Ô¥¯¥¹¥Þ¥Ã¥×¤Î¤³¤È¤òÆÃÊ̤˥ӥåȥޥåפȸƤӤޤ¹¡£
- XFreePixmap();
ɬÍפΤʤ¯¤Ê¤Ã¤¿¥Ô¥¯¥¹¥Þ¥Ã¥×¤ò²òÊü¤¹¤ë¤Ë¤Ï XFreePixmap()¤òÍѤ¤¤Þ¤¹¡£
XFreePixmap( display, pixmap );
pixmap ¤Ë¤Ï XCreatePixmap() ¤Ê¤É¤ÇÀ¸À®¤·¤¿¥Ô¥¯¥¹¥Þ¥Ã¥×¤ÎID¤ò»ØÄꤷ¤Þ¤¹¡£
¡ü Îΰè¤Î¥¯¥ê¥¢
Îΰè¤Î¥¯¥ê¥¢ÊýË¡¤Ï¡¢¥¯¥ê¥¢¤¹¤ëÂоÝ(¥¦¥£¥ó¥É¥¦¤Î°ìÉô¡¢¥¦¥£¥ó¥É¥¦¤ÎÁ´Éô¡¢¥Ô¥¯¥¹¥Þ¥Ã¥×)¤Ë¤è¤Ã¤Æ°Û¤Ê¤ê¤Þ¤¹¡£
- XClearArea()
¥¦¥£¥ó¥É¥¦Æâ¤ÎĹÊý·ÁÎΰè¤ò¥¯¥ê¥¢¤·¤Þ¤¹¡£
XClearArea( Display* display, /* ¥Ç¥£¥¹¥×¥ì¥¤ÊÑ¿ô */ Window w, /* ¥¦¥£¥ó¥É¥¦ */ int x, /* ĹÊý·Á¤Îº¸¾å¤ÎxºÂɸ */ int y, /* ĹÊý·Á¤Îº¸¾å¤ÎyºÂɸ */ unsigned int width, /* ĹÊý·Á¤ÎÉý */ unsigned int height, /* ĹÊý·Á¤Î¹â¤µ */ Book exposures /* Expose¥¤¥Ù¥ó¥È¤òÁ÷¤ë¤«Á÷¤é¤Ê¤¤¤« */ );
(x,y)¤òº¸¾å¤ÎĺÅÀ¤È¤·¡¢width¡¢height ¤ÎÂ礤µ¤ò»ý¤ÄĹÊý·ÁÎΰè¤ò¥¯¥ê¥¢(¥¦¥£¥ó¥É¥¦¤Î ¥Ð¥Ã¥¯¥°¥é¥¦¥ó¥É¥«¥é¡¼¤ÇÅɤê¤Ä¤Ö¤¹)¤·¤Þ¤¹¡£exposures ¤Ë¤Ï True ¤« False ¤ò»ØÄꤷ¤Þ¤¹¡£ True ¤Î¾ì¹ç¤Ë¤ÏÎΰ襯¥ê¥¢¸å X ¥µ¡¼¥Ð¤¬¥¯¥é¥¤¥¢¥ó¥È¤Ë Expose ¥¤¥Ù¥ó¥È¤òÁ÷¤ê¤Þ¤¹¡£
- XClearWindow();
¥¦¥£¥ó¥É¥¦Á´ÂΤò¥¯¥ê¥¢¤·¤Þ¤¹( XClearArea() ¤Î¤è¤¦¤ËÎΰè¤ò»ØÄꤹ¤ëɬÍפϤ¢¤ê¤Þ¤»¤ó)¡£
XClearWindow( Display* display, /* ¥Ç¥£¥¹¥×¥ì¥¤ÊÑ¿ô */ Window w /* ¥¦¥£¥ó¥É¥¦ */ );
- XFillRectangle( display, d, x, y, width, height );
¥Ô¥¯¥¹¥Þ¥Ã¥×¤ò¥¯¥ê¥¢¤¹¤ë¤¿¤á¤Î´Ø¿ô¤ÏÄ󶡤µ¤ì¤Æ¤¤¤Ê¤¤¤Î¤Ç¡¢Ä¹Êý·Á¤ÎÅɤê¤Ä¤Ö¤·¤ò»È¤Ã ¤Æ¥¯¥ê¥¢¤·¤Þ¤¹¡£
¡ü Îΰè¤Î¥³¥Ô¡¼
- XCopyArea();
¤¢¤ë drawable ¤ÎÆâÍƤòÊ̤Πdrawable ¤Ë¤½¤Î¤Þ¤Þ¥³¥Ô¡¼¤¹¤ë¾ì¹ç¤Ï¡¢XCopyArea() ¤ò»È¤¤ ¤Þ¤¹¡£
XCopyArea( Display* display, /* ¥Ç¥£¥¹¥×¥ì¥¤ÊÑ¿ô */ Drawable src, /* ¥³¥Ô¡¼¸µ¤Îdrawable */ Drawable dest, /* ¥³¥Ô¡¼Àè¤Îdrawable */ GC gc, /* ¥°¥é¥Õ¥£¥Ã¥¯¥¹¥³¥ó¥Æ¥¥¹¥È */ int src_x, /* ¥³¥Ô¡¼Îΰè¤Îº¸¾å¤ÎxºÂɸ */ int src_y, /* ¥³¥Ô¡¼Îΰè¤Îº¸¾å¤ÎyºÂɸ */ unsigned int width, /* ¥³¥Ô¡¼Îΰè¤ÎÉý */ unsigned int height, /* ¥³¥Ô¡¼Îΰè¤Î¹â¤µ */ int dest_x, /* ¥³¥Ô¡¼Àè¤Îµ¯ÅÀ¤ÎxºÂɸ */ int dest_y /* ¥³¥Ô¡¼Àè¤Îµ¯ÅÀ¤ÎyºÂɸ */ );
src ¤«¤é dest ¤ËÂФ·¤Æ¡¢(src_x, src_y)¤òº¸¾å¤ÎĺÅÀ¤È¤·¤Æ¡¢Éý¤¬ width ¤Ç¹â¤µ¤¬ height ¤ÎĹÊý·ÁÎΰè¤ò¥³¥Ô¡¼¤·¤Þ¤¹¡£¥³¥Ô¡¼Àè¤Ï(dest_x, dest_y)¤òº¸¾å¤ÎĺÅÀ¤È¤¹¤ëĹÊý·ÁÎΰè¤È¤¤ ¤¦¤³¤È¤Ë¤Ê¤ê¤Þ¤¹¡£src ¤È dest ¤ÏƱ¤¸¿¼¤µ¤Ç¤Ê¤¯¤Æ¤Ï¤¤¤±¤Þ¤»¤ó¡£
- XCopyPlane();
¿¼¤µ¤Î°Û¤Ê¤ë drawable ´Ö¤Ç¥³¥Ô¡¼¤¹¤ë¾ì¹ç¤Ë¤Ï¡¢XCopyPlane()¤ò»È¤¤¤Þ¤¹¡£¤³¤Î¤È¤¡¢¥³ ¥Ô¡¼¤µ¤ì¤ë¥×¥ì¡¼¥ó¤Ï1¥×¥ì¡¼¥ó¤À¤±¤Ç¤¹¡£
XCopyPlane( Display* display, /* ¥Ç¥£¥¹¥×¥ì¥¤ÊÑ¿ô */ Drawable src, /* ¥³¥Ô¡¼¸µ¤Îdrawable */ Drawable dest, /* ¥³¥Ô¡¼Àè¤Îdrawable */ GC gc, /* ¥°¥é¥Õ¥£¥Ã¥¯¥¹¥³¥ó¥Æ¥¥¹¥È */ int src_x, /* ¥³¥Ô¡¼Îΰè¤Îº¸¾å¤ÎxºÂɸ */ int src_y, /* ¥³¥Ô¡¼Îΰè¤Îº¸¾å¤ÎyºÂɸ */ unsigned int width, /* ¥³¥Ô¡¼Îΰè¤ÎÉý */ unsigned int height, /* ¥³¥Ô¡¼Îΰè¤Î¹â¤µ */ int dest_x, /* ¥³¥Ô¡¼Àè¤Îµ¯ÅÀ¤ÎxºÂɸ */ int dest_y, /* ¥³¥Ô¡¼Àè¤Îµ¯ÅÀ¤ÎyºÂɸ */ unsigned long plane /* ¥³¥Ô¡¼¤¹¤ë¥×¥ì¡¼¥ó */ );
¥×¥ì¡¼¥ó¥Þ¥¹¥¯( plane )¤Ï¥Ó¥Ã¥È¥Ñ¥¿¡¼¥ó¤Ç¤¢¤ê¡¢1¤¬ÀßÄꤵ¤ì¤Æ¤¤¤ë¥Ó¥Ã¥È¤ËÂбþ¤¹¤ë¥× ¥ì¡¼¥ó¤ò1¥×¥ì¡¼¥ó¤À¤±¥³¥Ô¡¼¤·¤Þ¤¹¡£¤è¤Ã¤Æ 1 ¤òÀßÄꤹ¤ë¥Ó¥Ã¥È¤Ï°ì¤Ä¤À¤±¤Ç¤Ê¤±¤ì¤Ð¤¤¤± ¤Þ¤»¤ó¡£¤³¤ì°Ê³°¤Î°ú¿ô¤Î°ÕÌ£¤Ï XCopyArea() ¤ÈƱ¤¸¤Ç¤¹¡£¥³¥Ô¡¼¤µ¤ì¤ë¥×¥ì¡¼¥ó¤Î¥Ó¥Ã¥È ¤¬ 1 ¤Ç¤¢¤ëÉôʬ¤¬ gc ¤Î¥Õ¥©¥¢¥°¥é¥¦¥ó¥É¥«¥é¡¼¤Ç¡¢0¤ÎÉôʬ¤¬¥Ð¥Ã¥¯¥°¥é¥¦¥ó¥É¥«¥é¡¼¤Ç dest ¤Ë¥³¥Ô¡¼¤µ¤ì¤Þ¤¹¡£