|
¡û ¤Ï¤¸¤á¤Ë
¥°¥é¥Õ¥£¥Ã¥¯¥¹¤ÎÉÁ²è¤Ë¤ª¤¤¤Æ¡¢¥°¥é¥Õ¥£¥Ã¥¯¥¹¥³¥ó¥Æ¥¥¹¥È( GC )¤ÏÈó¾ï¤Ë½ÅÍפǤ¹¡£GC ¤È¤Ï¡¢¥°¥é¥Õ¥£¥Ã¥¯¥¹¤òÉÁ²è¤¹¤ë¤¿¤á¤Î¾ðÊó(ÉÁ²è°À)¤ò³ÊǼ¤·¤Æ¤ª¤¯¤¿¤á¤Î¤â¤Î¤Ç¤¹( Windows GDI ¤Ç¤Î¥Ú¥ó¤È¥Ö¥é¥·¤ÈƱ¤¸¤Ç¡¢¤³¤ì¤ò»ØÄꤷ¤Ê¤¤¤ÈÉÁ²è¤Ç¤¤Þ¤»¤ó)¡£GC ¤â X ¥µ¡¼¥Ð¤Î¥ê¥½¡¼¥¹¤È¤·¤Æ´ÉÍý¤µ¤ì¤Æ¤¤¤Þ¤¹¡£
Xlib ¤òÍѤ¤¤ÆÉÁ²è¤¹¤ë»þ¤Ï¡¢¤Þ¤º X ¥µ¡¼¥ÐÆâ¤Î¥ê¥½¡¼¥¹¤È¤·¤Æ GC ¤ò³ÎÊݤ·¡¢ÉÁ²è¤ËɬÍפÊÉÁ²è°À¤ò GC ¤ËÀßÄꤷ¤Þ¤¹¡£¤½¤·¤ÆÉÁ²è¤¹¤ë»þ¤Ë¡¢»È¤¤¤¿¤¤ GC ¤Î¥ê¥½¡¼¥¹ ID ¤ò»ØÄꤷ¤ÆÉÁ²è¤·¤Þ¤¹¡£Æ±¤¸ÉÁ²è°À¤òÊ£¿ô²ó»ÈÍѤ¹¤ë¤è¤¦¤Ê¾ì¹ç¤Ï¡¢¤½¤Î°À¤¬ÀßÄꤵ¤ì¤Æ¤¤¤ë GC ¤Î¥ê¥½¡¼¥¹ ID ¤Î¤ß¤ò X ¥µ¡¼¥Ð¤Ë»ØÄꤹ¤ì¤ÐÎɤ¤¤Î¤Ç¥Í¥Ã¥È¥ï¡¼¥¯ÅÁÁ÷¤Î¸úΨ¤¬Îɤ¤¤È¤¤¤¦ÍøÅÀ¤¬¤¢¤ê¤Þ¤¹¡£
¤³¤³¤Ç¤Ï
¤È¤¤¤¦½ç¤ÇÀâÌÀ¤·¤Æ¤¤¤¤Þ¤¹¡£
¡û GC ¤ÎÀ¸À®¤È²òÊü
GC ¤Î¼ÂÂÎ¤Ï XGCValues ¹½Â¤ÂÎ(<X11/Xlib.h>)¤È¤·¤ÆÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤¹¡£
/* XGCValues ¹½Â¤ÂÎ */ typedef struct { int function; /* ɽ¼¨´Ø¿ô */ unsigned long plane_mask; /* ¥×¥ì¡¼¥ó¥Þ¥¹¥¯ */ unsigned long foreground; /* ¥Õ¥©¥¢¥°¥é¥¦¥ó¥É¥«¥é¡¼ */ unsigned long background; /* ¥Ð¥Ã¥¯¥°¥é¥¦¥ó¥É¥«¥é¡¼ */ int line_width; /* ÀþÉý */ int line_style; /* Àþ¤Î·Á¾õ */ int cap_style; /* Àþ¤ÎüÅÀ·Á¾õ */ int join_style; /* Àþ¤Î·ë¹ç·Á¾õ */ int fill_style; /* Åɤê¤Ä¤Ö¤·¥¹¥¿¥¤¥ë */ int fill_rule; /* Åɤê¤Ä¤Ö¤·µ¬Â§ */ int arc_mode; /* ±ß¸Ì¤ÎÅɤê¤Ä¤Ö¤·¥â¡¼¥É */ Pixmap tile; /* ¥¿¥¤¥ëÍѤΥԥ¯¥¹¥Þ¥Ã¥× */ Pixmap stipple; /* ¥¹¥Æ¥£¥Ã¥×¥ëÍÑ¥Ó¥Ã¥È¥Þ¥Ã¥× */ int ts_x_origin; /* ¥¹¥Æ¥£¥Ã¥×¥ë¤ä¥¿¥¤¥ë¤Î¸¶ÅÀ */ int ts_y_origin; Font font; /* ¥Õ¥©¥ó¥È */ int subwindow_mode; /* »Ò¥¦¥£¥ó¥É¥¦¤Ø¤ÎÉÁ²è¥â¡¼¥É */ Bool graphics_exposures; /* GraphicsExpose¥¤¥Ù¥ó¥ÈÍÑ¥¤¥Ù¥ó¥È¥Þ¥¹¥¯ */ int clip_x_origin; /* ¥¯¥ê¥Ã¥Ô¥ó¥°¤Î¸¶ÅÀ */ int clip_y_origin; Pixmap clip_mask; /* ¥¯¥ê¥Ã¥×¥Þ¥¹¥¯ */ int dash_offset; /* ÇËÀþ¤Î³«»Ï¥ª¥Õ¥»¥Ã¥È */ char dashes; /* ÇËÀþ¤Î¥Ñ¥¿¡¼¥ó */ } XGCValues; (*)Bool·¿¤Ï <X11/Xlib.h> ¤Ç¼¡¤Î¤è¤¦¤ËÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤¹¡£ #define Bool int #define True 1 #define False 0
GC ¤òÀ¸À®¤¹¤ë¤Ë¤Ï XCreateGC()¤ò»È¤¤¤Þ¤¹¡£
GC XCreateGC( Display* display, Drawable d, unsigned long valuemask, XGCValues* values ); valuemask : GC ¤Î¥á¥ó¥Ð¤Î¤¦¤Á¡¢ÀßÄê¡¢¥³¥Ô¡¼¡¢Êѹ¹¤µ¤ì¤ë¤â¤Î¡¢ ¤¢¤ë¤¤¤ÏÃͤ¬ÊÖ¤µ¤ì¤ë¤â¤Î¤ò¥Ó¥Ã¥È¥Þ¥¹¥¯¤Ç»ØÄê¡£ values : valuemask¤Ç»ØÄꤷ¤¿¥á¥ó¥Ð¤ÎÃͤò»ØÄê
¤³¤Î´Ø¿ô¤Ï valuemask¡¢values ¤Ç»ØÄꤷ¤¿Â°ÀÃͤò»ý¤Ä GC ¤ò¿·¤·¤¯°ì¤ÄÀ¸À®¤·¤Þ¤¹¡£valuemask ¤Ë0¡¢values ¤Ë NULL ¤ò»ØÄꤹ¤ë¤È¥Ç¥Õ¥©¥ë¥È¤Î°ÀÃͤò»ý¤Ä GC ¤¬À¸À®¤µ¤ì¤Þ¤¹¡£³Æ¥á¥ó¥Ð¤ËÂбþ¤¹¤ë¥Ç¥Õ¥©¥ë¥È¤Î°ÀÃͤª¤è¤Ó¥Þ¥¹¥¯¤Ï²¼É½¤Î¤è¤¦¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡£
¥á¥ó¥Ð | ¥Ç¥Õ¥©¥ë¥ÈÃÍ | ¥Þ¥¹¥¯ |
---|---|---|
function | GXcopy | GCFunction |
plane_mask | Á´¥×¥ì¡¼¥ó(~0) | GCPlaneMask |
foreground | 0 | GCForeground |
background | 1 | GCBackground |
line_width | 0 | GCLineWidth |
line_style | LineSolid | GCLineStyle |
cap_style | CapButt | GCCapStyle |
join_style | JoinMiter | GCJoinStyle |
fill_style | FillSolid | GCFillStyle |
fill_rule | EvenOddRule | GCFillRule |
arc_mode | ArcPieSlice | GCArcMode |
tile | ¥Õ¥©¥¢¥°¥é¥¦¥ó¥É¤Î¥Ô¥¯¥»¥ëÃͤò»ý¤Ä¥Ô¥¯¥¹¥Þ¥Ã¥× | GCTile |
stipple | Á´¥Ó¥Ã¥È¤¬1¤Î¥Ó¥Ã¥È¥Þ¥Ã¥× | GCStipple |
ts_x_origin | 0 | GCTileStipXOrigin |
ts_y_origin | 0 | GCTileStipYOrigin |
font | fixed(¥µ¡¼¥Ð°Í¸) | GCFont |
subwindow_mode | ClipByChildren | GCSubwindowMode |
graphics_exposures | True | GCGraphicsExposures |
clip_x_origin | 0 | GCClipXOrigin |
clip_y_origin | 0 | GCClipYOrigin |
clip_mask | None | GCClipMask |
dash_offset | 0 | GCDashOffset |
dashes | 4(¥ê¥¹¥È[4, 4]) | GCDashList |
ɬÍפʤ¯¤Ê¤Ã¤¿ GC ¤ò²òÊü¤¹¤ë¤¿¤á¤Ë¤Ï XFreeGC() ¤ò»È¤¤¤Þ¤¹¡£
XFreeGC( Display* dpy, GC gc );
¡û GC ¤Î¥³¥Ô¡¼¤È°À¤ÎÊѹ¹
¤¢¤ë GC ¤ÎÆâÍƤòÊ̤ΠGC ¤Ë¥³¥Ô¡¼¤¹¤ë¾ì¹ç¤Ï XCopyGC() ¤ò»È¤¤¤Þ¤¹¡£
XCopyGC( Display* display, GC src, unsigned long valuemask, GC dest ); src, : ¥³¥Ô¡¼¸µ GC valuemask : ¥³¥Ô¡¼¤¹¤ë°À¤ò»ØÄꤹ¤ë¥Þ¥¹¥¯ dest : ¥³¥Ô¡¼Àè GC
¤³¤Î´Ø¿ô¤Ï src ¤«¤é dest ¤Ë°À¤ò¥³¥Ô¡¼¤·¤Þ¤¹¡£¥³¥Ô¡¼¤·¤¿¤¤Â°À¤ËÂбþ¤¹¤ë¥Þ¥¹¥¯¤ò valuemask ¤ËÀßÄꤷ¤Æ¤ª¤¤Þ¤¹¡£¤Þ¤¿¡¢src ¤È dest ¤Ï¤¢¤é¤«¤¸¤áºîÀ®¤·¤Æ¤ª¤«¤Ê¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó(¤µ¤é¤Ë¤Ï¥ë¡¼¥È¥¦¥£¥ó¥É¥¦¤È¿¼¤µ¤¬Æ±¤¸¤Ç¤Ê¤±¤ì¤Ð¤¤¤±¤Þ¤»¤ó)¡£
´û¤Ë GC ¤ËÀßÄꤵ¤ì¤Æ¤¤¤ë°ÀÃͤòÊѹ¹¤¹¤ë¾ì¹ç¤Ë¤Ï XChangeGC() ¤ò»È¤¤¤Þ¤¹¡£
XChangeGC( Display* display, GC gc, unsigned long valuemask, XGCValues* values ); valuemask : Êѹ¹¤¹¤ë°À¤ò»ØÄꤹ¤ë¥Þ¥¹¥¯ values : Êѹ¹¤¹¤ë°À¤ÎÃͤò»ØÄê
valuemask ¤Ç»ØÄꤷ¤¿ GC ¤Î°ÀÃͤ¬ values ¤ÎÃͤËÀßÄꤵ¤ì¡¢¤½¤ì°Ê³°¤ÏÊѹ¹¤µ¤ì¤Þ¤»¤ó¡£
¡û GC ¤ËÀßÄꤵ¤ì¤ëÉÁ²è°À
XGCValues ¹½Â¤ÂΤΥá¥ó¥Ð¤ò GC ¤ÎÉÁ²è°À¤È¤·¤ÆÀßÄê¤Ç¤¤Þ¤¹¡£³Æ°À¤Ï¡¢´û¤ËÀâÌÀ¤·¤¿¤è¤¦¤Ë GC ¤ÎÀ¸À®»þ¤ËÀßÄê¤Ç¤¤Þ¤¹¤¬¡¢³Æ°ÀÀßÄêÍѤΠXlib ´Ø¿ô¤òÍѤ¤¤ÆÀßÄꤹ¤ë¤³¤È¤â²Äǽ¤Ç¤¹¡£¤³¤³¤Ç¤Ï GC ¤ÎÉÁ²è°À¤Î¤¦¤Á
- ɽ¼¨´Ø¿ô(function)
- ¿§(foreground, background)
- Àþ¤Î°À
- ÇËÀþ¤Î°À
- Åɤê¤Ä¤Ö¤·/¥¿¥¤¥ë/¥¹¥Æ¥£¥Ã¥×¥ë
- Åɤê¤Ä¤Ö¤·¤Îµ¬Â§/¥â¡¼¥É
- ¥Õ¥©¥ó¥È(font)
- »Ò¥¦¥£¥ó¥É¥¦¤Ø¤ÎÉÁ²è¥â¡¼¥É(subwindow_mode)
- GraphicsExpose¡¿NoExpose ¥¤¥Ù¥ó¥ÈÀ¸À®ÀßÄê(graphics_exposures)
¤Ë¤Ä¤¤¤ÆÀâÌÀ¤·¤Þ¤¹¡£¤³¤³¤ÇÀâÌÀ¤·¤Æ¤¤¤Ê¤¤¥á¥ó¥Ð¤Î¤¦¤Á¡¢clip_ ¤Ç»Ï¤Þ¤ë¥á¥ó¥Ð¤Ë´Ø¤·¤Æ¤Ï¥¯¥ê¥Ã¥Ô¥ó¥°¤È¤¤¤¦½ÅÍפʳµÇ°¤¬¤¢¤ê¤Þ¤¹¡£¥¯¥ê¥Ã¥Ô¥ó¥°¤Ï¡¢ÉÁ²èÎ̤òÍÞ¤¨¤¿¤ê¡¢Æ©²á¿§¤ò»ý¤Ä²èÁü¤ò°·¤¦ºÝ¤Ëɬ¿Ü¤ÎÆâÍƤǡ¢LECTURE 7 Expose ¥¤¥Ù¥ó¥È ¤Ë¤Æ¤¢¤é¤¿¤á¤ÆÀâÌÀ¤·¤Þ¤¹¡£¤½¤Î¾¤Ë¤Ä¤¤¤Æ¶½Ì£¤¬¤¢¤ëÊý¤Ï¡¢Xlib ¤Î¥Þ¥Ë¥å¥¢¥ë¤Ê¤É¤Î¤è¤ê¾ÜºÙ¤Êʸ¸¥¤ò»²¾È¤·¤Æ¤¯¤À¤µ¤¤¡£
¡ü ɽ¼¨´Ø¿ô(function)
ÉÁ²è¤Ï¡¢ÉÁ²èÂоÝ( dst )¤ª¤è¤Ó¤½¤³¤ËÉÁ²è¤¹¤ë¤â¤Î( src )¤ÎÁÐÊý¤ÎÂбþ¤¹¤ë¥Ô¥¯¥»¥ëƱ»Î¤ËÏÀÍý±é»»¤ò»Ü¤¹¤³¤È¤ÇÉÁ²è¤ò¹Ô¤¤¤Þ¤¹¡£¤³¤ÎÉÁ²è»þ¤Ë»Ü¤µ¤ì¤ëÏÀÍý±é»»¤È¤·¤Æ¡¢X ¥¦¥£¥ó¥É¥¦¥·¥¹¥Æ¥à¤Ç¤Ï 16 ¼ïÎà¤Î±é»»¤¬ÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤¹(²¼É½»²¾È)¡£¥Ç¥Õ¥©¥ë¥È¤Îɽ¼¨´Ø¿ô¤Ï GXcopy ¤Ç¤¹¡£
ɽ¼¨´Ø¿ô | ÏÀÍý±é»» | ±é»»·ë²Ì(src=0011¡¢dst=0101) |
---|---|---|
GXClear | 0 | 0000 |
GCand | src AND dst | 0001 |
GXandReverse | src AND (NOT dst) | 0010 |
GXcopy | src | 0011 |
GXandInverted | (NOT src) AND dst | 0100 |
GXnoop | dst | 0101 |
GXxor | src XOR dst | 0110 |
GXor | src OR dst | 0111 |
GXnor | (NOT src) AND (NOT dst) | 1000 |
GXequiv | (NOT src) XOR dst | 1001 |
GXinvert | NOT dst | 1010 |
GXorReverse | src OR (NOT dst) | 1011 |
GXcopyInverted | NOT src | 1100 |
GXorInverted | (NOT src) OR dst | 1101 |
GXnand | (NOT src) OR (NOT dst) | 1110 |
GXset | 1 | 1111 |
ÇÓ¾ŪÏÀÍýÏÂ( GXxor )¤Ï¥é¥Ð¡¼¥Ð¥ó¥É¤òÉÁ²è¤¹¤ë¤È¤¤ËÎɤ¯»ÈÍѤµ¤ì¤Þ¤¹¡£É½¼¨´Ø¿ô¤Ë GXxor ¤òÀßÄꤷ¤¿ GC ¤òÍѤ¤¤Æ°ìÅÙÉÁ²è¤·¡¢¤½¤Î¾å¤«¤éƱ¤¸ GC ¤òÍѤ¤¤Æ¤â¤¦°ìÅÙƱ¤¸¤â¤Î¤òÉÁ²è¤¹¤ë¤ÈÁ°¤ËÉÁ²è¤·¤¿¤â¤Î¤¬¾Ãµî¤µ¤ì¤Æ¸µÄ̤ê¤Î²èÁü¤¬ÆÀ¤é¤ì¤Þ¤¹¡£
ɽ¼¨´Ø¿ô¤ÎÀßÄê¤Ï¡¢XCreateGC »þ¤Ë function ¥á¥ó¥Ð¤òÀßÄꤷ¤¿ XGCValues ¹½Â¤ÂΤòÍѤ¤¤ë¾¤Ë¡¢ XSetFunction()¤ò»È¤Ã¤ÆÀßÄꤹ¤ë¤³¤È¤¬½ÐÍè¤Þ¤¹¡£
XSetFunction( Display* display, GC gc, int function ); function : ɽ¼¨´Ø¿ô( GXcopy¡¢GXxor¡¢...)¤ò»ØÄꤹ¤ë¡£
¡ü ¿§(foreground, background)
ÉÁ²è»þ¤Ë»ÈÍѤ¹¤ë¥Õ¥©¥¢¥°¥é¥¦¥ó¥É¥«¥é¡¼¤ª¤è¤Ó¥Ð¥Ã¥¯¥°¥é¥¦¥ó¥É¥«¥é¡¼¤ò¥Ô¥¯¥»¥ëÃͤǻØÄꤷ¤Þ¤¹¡£XCreateGC »þ¤Ë foreground¡¿background ¥á¥ó¥Ð¤òÀßÄꤷ¤¿ XGCValues ¹½Â¤ÂΤòÍѤ¤¤ë¾¤Ë¡¢XSetForeground()¡¢XSetBackground() ¤ò»È¤Ã¤ÆÀßÄꤹ¤ë¤³¤È¤¬½ÐÍè¤Þ¤¹¡£
XSetForeground( Display* display, GC gc, unsigned long foreground ); foreground : ¥Õ¥©¥¢¥°¥é¥¦¥ó¥É¥«¥é¡¼¤Î¥Ô¥¯¥»¥ëÃÍ XSetBackground( Display* display, GC gc, unsigned long background ); background : ¥Ð¥Ã¥¯¥°¥é¥¦¥ó¥É¥«¥é¡¼¤Î¥Ô¥¯¥»¥ëÃÍ
¡ü Àþ¤Î°À
- ÀþÉý ( line_width )
Àþ¤ÎÉý¤ò¥Ô¥¯¥»¥ë¿ô¤Ç»ØÄꤷ¤Þ¤¹¡£
- Àþ¤Î·Á¾õ ( line_style )
Àþ¤Î·Á¾õ(¼ÂÀþ/ÇËÀþ)¤ò»ØÄꤷ¤Þ¤¹¡£¼¡¤Î¤¦¤Á¤¤¤º¤ì¤«¤ò»ØÄꤷ¤Þ¤¹¡£
Äê¿ô̾ ÀâÌÀ LineSolid GC ¤Î¥Õ¥©¥¢¥°¥é¥¦¥ó¥É¥«¥é¡¼¤Ç¼ÂÀþ¤òÉÁ²è(¥Ç¥Õ¥©¥ë¥È) LineOnOffDash GC ¤Î¥Õ¥©¥¢¥°¥é¥¦¥ó¥É¥«¥é¡¼¤ÇÇËÀþ¤òÉÁ²è(ÇËÀþ¤¬¥ª¥Õ¤ÎÉôʬ¤ÏÉÁ¤«¤ì¤Ê¤¤) LineDoubleDash GC ¤Î¥Õ¥©¥¢¥°¥é¥¦¥ó¥É¥«¥é¡¼¤ÇÇËÀþ¤òÉÁ²è (ÇËÀþ¤¬¥ª¥Õ¤ÎÉôʬ¤Ï GC ¤Î¥Ð¥Ã¥¯¥°¥é¥¦¥ó¥É¥«¥é¡¼
- Àþ¤ÎüÅÀ·Á¾õ ( cap_style )
Àþ¤ÎüÅÀ¤Î·Á¾õ¤ò»ØÄꤷ¤Þ¤¹¡£¼¡¤Î¤¦¤Á¤¤¤º¤ì¤«¤ò»ØÄꤷ¤Þ¤¹¡£
Äê¿ô̾ ÀâÌÀ CapNotLast ÀþÉý¤¬0¤ª¤è¤Ó1¤Î¾ì¹ç¤Ë¤Ï½ªÃ¼¤Î¥Ô¥¯¥»¥ë¤òÉÁ²è¤·¤Ê¤¤°Ê³°¤Ï CapButt ¤ÈƱ¤¸ CapButt ½ªÃ¼¤¬Ê¿¤é¤ÇÆ͵¯¤¬¤Ê¤¤¡£Àþü¤Ï¿âľ CapRound ½ªÃ¼¤ÎÃæ±û¤òÃæ¿´¤Ë¤·¤¿ÀþÉý¤Îľ·Â¤ÎȾ±ß CapProjecting ÀþÉý¤ÎȾʬ¤À¤±½ªÃ¼¤ò¤Ï¤ß½Ð¤¹
- Àþ¤Î·ë¹ç·Á¾õ ( join_style )
2¤Ä¤ÎÀþ¤Î·ë¹ç·Á¾õ¤ò»ØÄꤷ¤Þ¤¹¡£¼¡¤Î¤¦¤Á¤¤¤º¤ì¤«¤ò»ØÄꤷ¤Þ¤¹¡£
Äê¿ô̾ ÀâÌÀ JoinMiter 2ËܤÎľÀþ¤Î³°Â¦¤Î¥¨¥Ã¥¸¤¬¸ò¤ï¤ë¤Þ¤Ç¿¤Ð¤¹(¥Ç¥Õ¥©¥ë¥È) JoinRound ÀܹçÅÀ¤òÃæ¿´¤Ë¤·¤¿ÀþÉý¤Îľ·Â¤Î±ß¸Ì JoinBevel ½ªÃ¼¤Ï CapButt ¤Ç¡¢¤Ç¤¤¿»°³Ñ·Á¤Î·ä´Ö¤òËä¤á¤ë
°Ê¾å¤ÎÉÁ²è°À¤ò GC ¤ËÀßÄꤹ¤ë¤Ë¤Ï¡¢XCreateGC ¤Ë¤ª¤¤¤Æ line_width¡¿line_style¡¿cap_style¡¿join_style ¥á¥ó¥Ð¤òÀßÄꤷ¤¿ XGCValues ¹½Â¤ÂΤòÍѤ¤¤ë¾¤Ë¡¢XSetLineAttributes()¤ò»È¤Ã¤ÆÀßÄꤹ¤ë¤³¤È¤¬½ÐÍè¤Þ¤¹¡£
XSetLineAttributes( Display* display, GC gc, unsigned int line_width, int line_style, int cap_style, int join_style ); line_width : ÀþÉý line_style : Àþ¤Î¥¹¥¿¥¤¥ë cap_style : Àþ¤ÎüÅÀ·Á¾õ join_style : Àþ¤Î·ë¹ç·Á¾õ
¡ü ÇËÀþ¤Î°À
ÇËÀþ¤Î°À¤Ï¡¢¤½¤Î¥Ñ¥¿¡¼¥ó¤È³«»Ï¥ª¥Õ¥»¥Ã¥È¤Ç»ØÄꤷ¤Þ¤¹¡£
- ÇËÀþ¤Î¥Ñ¥¿¡¼¥ó(dashes)
ÇËÀþ¤È¥®¥ã¥Ã¥×¤ÎŤµ¤ò¥Ô¥¯¥»¥ëñ°Ì¤Ç»ØÄê
- ÇËÀþ¤Î³«»Ï¥ª¥Õ¥»¥Ã¥È(dash_offset)
ÇËÀþ¥Ñ¥¿¡¼¥ó¤Î³«»ÏÅÀ¤Þ¤Ç¤Î¥ª¥Õ¥»¥Ã¥È¤ò¥Ô¥¯¥»¥ë¿ô¤Ç»ØÄê
°Ê¾å¤Î°À¤Ï¡¢XCreateGC »þ¤Ë dashes¡¿dash_offset ¥á¥ó¥Ð¤òÀßÄꤷ¤¿ XGCValues ¹½Â¤ÂΤòÍѤ¤¤ë¾¤Ë¡¢XSetDashes() ¤ò»È¤Ã¤ÆÀßÄꤹ¤ë¤³¤È¤¬½ÐÍè¤Þ¤¹¡£
XSetDashes( Display* display, GC gc, int dash_offset, char dash_list[], int n ); dash_offset : ÇËÀþ¤Î³«»Ï¥ª¥Õ¥»¥Ã¥È n : dash_list ¤ÎŤµ dash_list[] : ÇËÀþ¤Î¥°¥é¥Õ¥£¥Ã¥¯¥¹¥Ñ¥¿¡¼¥ó
dash_list ¤Ë¤Ï¡¢ÇËÀþ¤È¥®¥ã¥Ã¥×¤ÎŤµ¤ò¥Ô¥¯¥»¥ëÃͤÇɽ¤·¤¿¾å¤Ç¡¢ÇËÀþ¤È¥®¥ã¥Ã¥×¤Î¥Ñ¥¿¡¼¥ó¤òÎóµó¤·¤¿¤â¤Î¤òÀßÄꤷ¤Þ¤¹¡£¤¿¤È¤¨¤Ð 3 ¥Ô¥¯¥»¥ë¤ÎÀþ¡¢2 ¥Ô¥¯¥»¥ë¤Î¥®¥ã¥Ã¥×¡¢4 ¥Ô¥¯¥»¥ë¤ÎÀþ¡¢1 ¥Ô¥¯¥»¥ë¤Î¥®¥ã¥Ã¥×¡¢°Ê¹ß¤Ï¤½¤Î¥Ñ¥¿¡¼¥ó¤Î·«¤êÊÖ¤·¤È¤¤¤¦ÇËÀþ¤òÀßÄꤹ¤ë¤Ê¤é
char dash_list[] = { 3, 2, 4, 1 };
¤ÈÀßÄꤷ¤Þ¤¹¡£dash_offset ¤Ë¤Ï¤³¤Î¥Ñ¥¿¡¼¥ó¤ÎÃæ¤Î²¿¥Ô¥¯¥»¥ëÌܤ«¤éÀþ¤ò°ú¤»Ï¤á¤ë¤«¤òÀßÄꤷ¤Þ¤¹¡£
¡ü Åɤê¤Ä¤Ö¤·/¥¿¥¤¥ë/¥¹¥Æ¥£¥Ã¥×¥ë
Åɤê¤Ä¤Ö¤·¤ÎÊýË¡¤Ë¤Ï¡¢FillSolid¡¢FillTiled¡¢FillStippled¡¢¤½¤·¤Æ FillOpaqueStippled ¤Î 4 ¼ïÎब¤¢¤ê¤Þ¤¹¡£¤½¤ì¤¾¤ì¤ÎÆâÍƤϲ¼É½¤ÎÄ̤ê¤Ç¤¹¡£
Äê¿ô̾ | ÀâÌÀ |
---|---|
FillSolid | GC ¤Î¥Õ¥©¥¢¥°¥é¥¦¥ó¥É¥«¥é¡¼¤ÇÅɤê¤Ä¤Ö¤¹(¥Ç¥Õ¥©¥ë¥È) |
FillTiled | GC ¤Î tile ¤Ç»ØÄꤷ¤¿¥Ô¥¯¥¹¥Þ¥Ã¥×¤òÉߤ¤Ä¤á¤ë(¥¿¥¤¥ê¥ó¥°) |
FillStippled | GC ¤Î stipple ¤Ç»ØÄꤷ¤¿¥Ó¥Ã¥È¥Þ¥Ã¥×¤Ç¥Þ¥¹¥¯¤·¤¿Îΰè¤ò GC ¤Î¥Õ¥©¥¢¥°¥é¥¦¥ó¥É¥«¥é¡¼¤ÇÅɤê¤Ä¤Ö¤¹(¥¹¥Æ¥£¥Ã¥×¥ë) |
FillOpaqueStippled | GC ¤Î stipple ¤Ç»ØÄꤷ¤¿¥Ó¥Ã¥È¥Þ¥Ã¥×¤Î¥Ó¥Ã¥È¤¬ÀßÄꤵ¤ì¤Æ¤¤¤ëÉôʬ¤Ï GC ¤Î¥Õ¥©¥¢¥°¥é¥¦¥ó¥É¥«¥é¡¼¤Ç¡¢¥Ó¥Ã¥È¤¬ÀßÄꤵ¤ì¤Æ¤¤¤Ê¤¤Éôʬ¤Ï GC ¤Î¥Ð¥Ã¥¯¥°¥é¥¦¥ó¥É¥«¥é¡¼¤ÇÅɤê¤Ä¤Ö¤¹ |
¾å¤ÎÅɤê¤Ä¤Ö¤·¤ÎÊýË¡¤òÀßÄꤹ¤ë¤Ë¤Ï¡¢XCreateGC »þ¤Ë fill_style ¥á¥ó¥Ð¤òÀßÄꤷ¤¿ XGCValues ¹½Â¤ÂΤòÍѤ¤¤ë¾¤Ë¡¢XSetFillStyle() ¤ò»È¤Ã¤ÆÀßÄꤹ¤ë¤³¤È¤¬½ÐÍè¤Þ¤¹¡£
XSetFillStyle( Display* display, GC gc, int fill_style ); fill_style : Åɤê¤Ä¤Ö¤·¤Î¥¹¥¿¥¤¥ë
¥¿¥¤¥ê¥ó¥°¤Ë»ÈÍѤ¹¤ë¥Ô¥¯¥¹¥Þ¥Ã¥×¡¢¤ª¤è¤Ó¥¹¥Æ¥£¥Ã¥×¥ë¤Ë»ÈÍѤ¹¤ë¥Ó¥Ã¥È¥Þ¥Ã¥×¤Ï¤½¤ì¤¾¤ì¡¢XCreateGC »þ¤Ë tile¡¿stipple ¥á¥ó¥Ð¤òÀßÄꤷ¤¿ XGCValues ¹½Â¤ÂΤòÍѤ¤¤ë¾¤Ë¡¢XSetTile() ¤ª¤è¤Ó XSetStipple() ¤ò»È¤Ã¤ÆÀßÄꤹ¤ë¤³¤È¤¬½ÐÍè¤Þ¤¹¡£
XSetTile( Display* display, GC gc, Pixmap tile ); tile : ¥¿¥¤¥ê¥ó¥°ÍÑ¥Ô¥¯¥¹¥Þ¥Ã¥×ID XSetStipple( Display* display, GC gc, Pixmap stipple ); stipple : ¥¹¥Æ¥£¥Ã¥×¥ëÍѥӥåȥޥåפÎID
¡ü Åɤê¤Ä¤Ö¤·¤Îµ¬Â§/¥â¡¼¥É
- Åɤê¤Ä¤Ö¤·¤Îµ¬Â§( fill_rule )
¥Ý¥ê¥´¥ó¤òÅɤê¤Ä¤Ö¤¹¾ì¹ç¤Î¡¢Åɤê¤Ä¤Ö¤·µ¬Â§¤ò»ØÄꤷ¤Þ¤¹¡£¼¡¤Î2¤Ä¤¬»ØÄê¤Ç¤¤Þ¤¹¡£
Äê¿ô̾ ÀâÌÀ WindingRule ½Å¤Ê¤Ã¤Æ¤¤¤ëÎΰè¤Ï¤¹¤Ù¤ÆÅɤê¤Ä¤Ö¤¹ EvenOddRule ´ñ¿ô²ó½Å¤Ê¤Ã¤Æ¤¤¤ëÎΰè¤ÏÅɤê¤Ä¤Ö¤µ¤Ê¤¤ Åɤê¤Ä¤Ö¤·¤Îµ¬Â§¤Î»ØÄê¤Ë¤Ï¡¢XCreateGC »þ¤Ë fill_rule ¥á¥ó¥Ð¤òÀßÄꤷ¤¿ XGCValues ¹½Â¤ÂΤòÍѤ¤¤ë¾¤Ë¡¢XSetFillRule() ¤ò»È¤Ã¤ÆÀßÄꤹ¤ë¤³¤È¤¬½ÐÍè¤Þ¤¹¡£
XSetFillRule( Display* display, GC gc, int fill_rule ); fill_rule : WindingRule ¤« EvenOddRule¤ò»ØÄê
- ±ß¸Ì¤ÎÅɤê¤Ä¤Ö¤·¥â¡¼¥É( arc_mode )
±ß¸Ì¤òÅɤê¤Ä¤Ö¤¹¾ì¹ç¤ÎÅɤê¤Ä¤Ö¤·¥â¡¼¥É¤ò»ØÄꤷ¤Þ¤¹¡£¼¡¤Î2¤Ä¤¬»ØÄê²Äǽ¤Ç¤¹¡£
Äê¿ô̾ ÀâÌÀ ArcPieSlice ±ß¸Ì¤ÎüÅÀ¤È±ß¸Ì¤ÎÃæ¿´¤ò·ë¤ó¤ÇÊĤ¸¤¿Îΰè¤òÅɤê¤Ä¤Ö¤¹ ArcChord ±ß¸Ì¤ÎüÅÀƱ»Î¤ò·ë¤ó¤ÇÊĤ¸¤¿Îΰè¤òÅɤê¤Ä¤Ö¤¹ ±ß¸Ì¤ÎÅɤê¤Ä¤Ö¤·¥â¡¼¥É¤ÎÀßÄê¤Ë¤Ï¡¢XCreateGC »þ¤Ë arc_mode ¥á¥ó¥Ð¤òÀßÄꤷ¤¿ XGCValues ¹½Â¤ÂΤòÍѤ¤¤ë¾¤Ë¡¢XSetArcMode() ¤ò»È¤Ã¤ÆÀßÄꤹ¤ë¤³¤È¤¬½ÐÍè¤Þ¤¹¡£
XSetArcMode( Display* dpy, GC gc, int arc_mode ); arc_mode : ArcPieSlice ¤« ArcChord¤ò»ØÄê
¡ü ¥Õ¥©¥ó¥È(font)
ʸ»úÎó¤òÉÁ²è¤¹¤ëºÝ¤ËÍѤ¤¤ë¥Õ¥©¥ó¥È¤ò»ØÄꤷ¤Þ¤¹¡£¥Õ¥©¥ó¥È¤ÎÀßÄê¤Ï¡¢XCreateGC »þ¤Ë font ¥á¥ó¥Ð¤òÀßÄꤷ¤¿ XGCValues ¹½Â¤ÂΤòÍѤ¤¤ë¾¤Ë¡¢XSetFont() ¤ò»È¤Ã¤ÆÀßÄꤹ¤ë¤³¤È¤¬½ÐÍè¤Þ¤¹¡£
XSetFont( Display* display, GC gc, Font font ); font : ¥Õ¥©¥ó¥ÈID
¤È¤³¤í¤ÇÅö¤¿¤êÁ°¤Î¤³¤È¤Ç¤¹¤¬¡¢¥Õ¥©¥ó¥È¤òÀßÄꤹ¤ëÁ°¤Ë¥Õ¥©¥ó¥È¤ò¥í¡¼¥É¤·¤Ê¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó¡£¥Õ¥©¥ó¥È¤ò¥í¡¼¥É¤¹¤ë¤Ë¤Ï XLoadQueryFont() ¤ò»È¤¤¤Þ¤¹¡£
XFontStruct* XLoadQueryFont( Display* display, char* fontname ); fontname : ¥Õ¥©¥ó¥È̾ ( "-*-fixed-medium-r-normal--16-*-*-*" ¤ÎÍͤʷÁ¼° )
»ØÄꤷ¤¿¥Õ¥©¥ó¥È¤¬¸«ÉÕ¤«¤é¤Ê¤«¤Ã¤¿¾ì¹ç¡¢XLoadQueryFont() ¤Ï NULL ¤òÊÖ¤·¤Þ¤¹¡£¥Õ¥©¥ó¥È¤¬¸«ÉÕ¤«¤Ã¤¿¾ì¹ç¤Ï¡¢XFontStruct ¹½Â¤ÂΤؤΥݥ¤¥ó¥¿¤¬Ê֤äÆÍè¤Þ¤¹¤¬¡¢XSetFont() ¤Ë»ØÄꤹ¤ë¥Õ¥©¥ó¥È ID ¤Ë¤Ï XFontStruct ¤Î¥á¥ó¥Ð¤Ç¤¢¤ë fid ¤ò»ØÄꤷ¤Þ¤¹¡£
¤È¤³¤í¤Ç¤³¤ì¤é¤ÏȾ³Ñ±Ñ¿ô»ú¤Ê¤É¤Î 1 ¥Ð¥¤¥Èʸ»úÉÁ²èÍѤδؿô¤Ç¤¢¤ê¡¢ÆüËܸì¤Î¤è¤¦¤Ê¥Þ¥ë¥Á¥Ð¥¤¥Èʸ»ú¤ÎÉÁ²è¤Ë¤Ä¤¤¤Æ¤Ï°Ê¹ß¤Î LECTURE ¤ÇÊÌÅÓÀâÌÀ¤·¤Þ¤¹¡£
¡ü »Ò¥¦¥£¥ó¥É¥¦¤Ø¤ÎÉÁ²è¥â¡¼¥É(subwindow_mode)
¿Æ¥¦¥£¥ó¥É¥¦¾å¤Î»Ò¥¦¥£¥ó¥É¥¦Îΰè¤ËÂФ·¤Æ¤âÉÁ²è¤ò¹Ô¤¦¤«¤É¤¦¤«¤ò»ØÄꤷ¤Þ¤¹¡£
Äê¿ô̾ | ÀâÌÀ |
---|---|
ClipByChildren | »Ò¥¦¥£¥ó¥É¥¦Îΰè¤Ë¤ÏÉÁ²è¤·¤Ê¤¤(¥Ç¥Õ¥©¥ë¥È) |
IncludeInferiors | »Ò¥¦¥£¥ó¥É¥¦Îΰè¤ËÉÁ²è¤¹¤ë |
»Ò¥¦¥£¥ó¥É¥¦¤Ø¤ÎÉÁ²è¥â¡¼¥É¤ÎÀßÄê¤Ë¤Ï¡¢XCreateGC »þ¤Ë subwindow_mode ¥á¥ó¥Ð¤òÀßÄꤷ¤¿ XGCValues ¹½Â¤ÂΤòÍѤ¤¤ë¾¤Ë¡¢XSetSubwindowMode() ¤ò»È¤Ã¤ÆÀßÄꤹ¤ë¤³¤È¤¬½ÐÍè¤Þ¤¹¡£
XSetSubwindowMode( Display* display, GC gc, int subwindow_mode ); subwindow_mode : ClipByChildren ¤«IncludeInferiors ¤ò»ØÄê
¡ü GraphicsExpose¡¿NoExpose ¥¤¥Ù¥ó¥ÈÀ¸À®ÀßÄê(graphics_exposures)
GC ¤ËÂФ·¤ÆÌÀ¼¨Åª¤Ë»ØÄꤷ¤Ê¤¤¸Â¤ê¡¢XCopyPlane¡¿XCopyArea ¼Â¹Ô»þ¤Ë GraphicsExpose¡¿NoExpose ¥¤¥Ù¥ó¥È¤¬¥¯¥é¥¤¥¢¥ó¥È¤ËÂФ·¤ÆÁ÷¤é¤ì¤ÆÍè¤Þ¤¹ ( XSelectInput ¤Ë¤è¤ë¥Þ¥¹¥¯¤ÎÍ̵´Ø·¸¤Ê¤·¤Ë )¡£¤³¤ì¤é¤Î¥¤¥Ù¥ó¥È¤òÁ÷¤é¤Ê¤¤¤Ç¤â¤é¤¦Íͤˤ¹¤ë¤Ë¤Ï¡¢XCreateGC »þ¤Ë graphis-exposures ¥á¥ó¥Ð¤ò False ¤ËÀßÄꤷ¤¿ XGCValues ¹½Â¤ÂΤòÍѤ¤¤ÆÀ¸À®¤·¤Þ¤¹ ( º£¤Î½ê¡¢¤½¤ì°Ê³°¤ÎÊýË¡¤¬Ê¬¤«¤ê¤Þ¤»¤ó )¡£