|
¡û ¤Ï¤¸¤á¤Ë
LECTURE 17 DIB ( Device-Independent Bitmap ) ¤Îɽ¼¨ ¤Ç¤Ï¡¢¼«ºî¥³¡¼¥É¤òÍѤ¤¤Æ DIB ¥Õ¥¡¥¤¥ë¡ÊWindows ¤Ç»È¤ï¤ì¤Æ¤¤¤ë¥Ó¥Ã¥È¥Þ¥Ã¥×¥Õ¥¡¥¤¥ë¡Ë¤ÎÆɤ߹þ¤ß¡¿É½¼¨¤ò¹Ô¤¤¤Þ¤·¤¿¡£¤³¤³¤Ç¤Ï Imlib (freshmeat.net ¤Î¾Ò²ð¥Ú¡¼¥¸) ¤È¤¤¤¦¥é¥¤¥Ö¥é¥ê¤ò»È¤Ã¤Æ²èÁü¤òɽ¼¨¤·¤Æ¤ß¤¿¤¤¤È»×¤¤¤Þ¤¹¡£
Imlib ¤Ï¸½ºß GNOME ¥×¥í¥¸¥§¥¯¥È¤Ç´ÉÍý¤µ¤ì¤Æ¤¤¤ë²èÁüÆɤ߹þ¤ß¥é¥¤¥Ö¥é¥ê¤Ç¡¢ÆâÉô¤«¤é libpng Åù¤Î¥é¥¤¥Ö¥é¥ê¤ò»È¤Ã¤Æ²èÁü¤ÎÆɤ߽ñ¤¤ò²Äǽ¤È¤·¤Æ¤¤¤Þ¤¹¡£xlib ¤«¤é»È¤¦¥é¥¤¥Ö¥é¥ê¤È¤·¤Æ¸½ºß¼çή¤Ê¤Î¤«¤Û¤È¤ó¤É»È¤ï¤ì¤Æ¤¤¤Ê¤¤¤Î¤«¤è¤¯Ê¬¤«¤é¤Ê¤¤¤Î¤Ç¤¹¤¬¡¢³ä¤È°ÊÁ°¤«¤éÃΤäƤ¤¤ë¤Î¤Ç»È¤Ã¤Æ¤ß¤ë¤³¤È¤Ë¤·¤Þ¤¹¡£
¡û ¥µ¥ó¥×¥ë¥×¥í¥°¥é¥à
Imlib ¤ò»È¤Ã¤Æ»ØÄꤷ¤¿²èÁü¤òɽ¼¨¤¹¤ë¥µ¥ó¥×¥ë¥×¥í¥°¥é¥à x_imlib.c ¤Ç¤¹¡£¤Ï¤¸¤á¤Ë ¤Î¥Ú¡¼¥¸¤«¤éÁ´¤Æ¤Î¥µ¥ó¥×¥ë¥×¥í¥°¥é¥à¤ò¸Ç¤á¤¿ tar ¥Ü¡¼¥ë¤ò¥À¥¦¥ó¥í¡¼¥É¤¹¤ë¤³¤È¤â¤Ç¤¤Þ¤¹¡£
¥³¥ó¥Ñ¥¤¥ë»þ¤Ë Imlib ¤Î¥é¥¤¥Ö¥é¥ê¤ò¥ê¥ó¥¯¤¹¤ëɬÍפ¬¤¢¤ê¤Þ¤¹¤Î¤Ç¡¢¤³¤ì¤Þ¤Ç¤Î¥µ¥ó¥×¥ë¥×¥í¥°¥é¥à¤Î¥³¥ó¥Ñ¥¤¥ë¥ª¥×¥·¥ç¥ó¤Ë²Ã¤¨¤Æ -lImlib ¥ª¥×¥·¥ç¥ó¤ò»ØÄꤷ¤Æ¤¯¤À¤µ¤¤¡£
Î㡧 gcc -I/usr/X11R6/include -L/usr/X11R6/lib -o x_imlib x_imlib.c -lX11 -lImlib ¢¨ÀèÆü X.Org Foundation ¤«¤é¥ê¥ê¡¼¥¹¤µ¤ì¤¿ X11R7.1 ¤Î´Ä¶¤Ç¤Ï ¤ä¤Ï¤ê X11R7 ¤Ê¤ó¤Ç¤·¤ç¤¦¤«¡©¼þ¤ê¤Ë´Ä¶¤¬Ìµ¤¤¤â¤Î¤Ç¡°¡°¡¨ <=== Fedora6 Åù¤Ç¤Ï¡¢/usr/X11... ¤È¤¤¤¦¥Ç¥£¥ì¥¯¥È¥ê¼«ÂΤ¬Ìµ¤¤¤ó¤Ç¤¹¤Í¡Ä
¥³¥ó¥Ñ¥¤¥ë¤ò½ª¤¨¤¿¤é¡¢²èÁü¥Õ¥¡¥¤¥ë̾¤ò°ú¿ô¤ËÍ¿¤¨¤Æ¼Â¹Ô¤·¤Æ¤ß¤Æ¤¯¤À¤µ¤¤¡£²èÁü¤¬É½¼¨¤µ¤ì¤Þ¤¹¡£¤½¤Î¾õÂ֤Ǻ¸±¦¤Î¥«¡¼¥½¥ë¥¡¼¤ò²¡¤¹¤È¡¢²èÁü¤¬º¸±¦È¿Å¾É½¼¨¤µ¤ì¤Þ¤¹¡£¤Þ¤¿¡¢¾å²¼¤Î¥«¡¼¥½¥ë¥¡¼¤ò²¡¤¹¤È¡¢²èÁü¤¬¾å²¼È¿Å¾É½¼¨¤µ¤ì¤Þ¤¹¡£Esc ¥¡¼¤ò²¡¤¹¤È½ªÎ»¤·¤Þ¤¹¡£
--- ¸µ²èÁü ---
--- º¸±¦È¿Å¾ ---
--- ¾å²¼È¿Å¾ ---
--- x_imlib.c ---
1 #include <X11/Xlib.h> 2 #include <X11/keysym.h> 3 #include <X11/Xutil.h> /* shape.h ¤ÎÁ°¤ËɬÍ× */ 4 #include <X11/extensions/shape.h> /* Shape Extension */ 5 #include <Imlib.h> 6 #include <stdio.h> 7 8 9 static Display* display; 10 static Window window; 11 static ImlibData* imlib_data; 12 static ImlibImage* imlib_image; 13 static Pixmap pixmap; 14 static Pixmap mask; 15 static int width; 16 static int height; 17 18 19 static void render( void ); 20 static void update_image( void ); 21 static void flip_horizontal( void ); 22 static void flip_vertical( void ); 23 24 25 int 26 main( int argc, char** argv ) 27 { 28 int screen; 29 30 if ( argc <= 1 ) { 31 fprintf( stderr, "²èÁü¥Õ¥¡¥¤¥ë¤ò»ØÄꤷ¤Æ¤¯¤À¤µ¤¤¡£\n" ); 32 exit(1); 33 } 34 35 display = XOpenDisplay( NULL ); 36 screen = DefaultScreen( display ); 37 38 if ( ( imlib_data = Imlib_init( display ) ) == NULL ) { 39 fprintf( stderr, "Imlib ¤Î½é´ü²½¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£\n" ); 40 XCloseDisplay( display ); 41 exit(1); 42 } 43 44 if ( ( imlib_image = Imlib_load_image( imlib_data, argv[1] ) ) == NULL ) { 45 fprintf( stderr, "²èÁü¤ÎÆɤ߹þ¤ß¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£\n" ); 46 XCloseDisplay( display ); 47 exit(1); 48 } 49 50 width = imlib_image->rgb_width; 51 height = imlib_image->rgb_height; 52 53 window = XCreateSimpleWindow( 54 display, 55 DefaultRootWindow( display ), 56 width, 57 height, 58 width, 59 height, 60 0, 61 BlackPixel( display, screen ), 62 BlackPixel( display, screen ) 63 ); 64 65 XSelectInput( display, window, StructureNotifyMask | KeyPressMask ); 66 XMapWindow( display, window ); 67 render(); 68 update_image(); 69 70 while ( 1 ) { 71 int esc_pressed = 0; 72 XEvent event; 73 KeySym key_sym; 74 75 XNextEvent( display, &event ); 76 77 switch ( event.type ) { 78 case KeyPress: 79 XLookupString( &( event.xkey ), 80 NULL, 0, &key_sym, NULL ); 81 82 switch ( key_sym ) { 83 case XK_Left: 84 case XK_Right: 85 flip_horizontal(); 86 break; 87 case XK_Up: 88 case XK_Down: 89 flip_vertical(); 90 break; 91 case XK_Escape: 92 esc_pressed = 1; 93 break; 94 } 95 96 break; 97 98 case ConfigureNotify: 99 width = event.xconfigure.width; 100 height = event.xconfigure.height; 101 Imlib_free_pixmap( imlib_data, pixmap ); 102 render(); 103 update_image(); 104 break; 105 } 106 107 if ( esc_pressed ) { 108 break; 109 } 110 } 111 112 113 Imlib_free_pixmap( imlib_data, pixmap ); 114 Imlib_kill_image( imlib_data, imlib_image ); 115 XDestroyWindow( display, window ); 116 XCloseDisplay( display ); 117 118 return 0; 119 } 120 121 122 static void 123 render( void ) 124 { 125 Imlib_render( imlib_data, imlib_image, width, height ); 126 pixmap = Imlib_move_image( imlib_data, imlib_image ); 127 mask = Imlib_move_mask( imlib_data, imlib_image ); 128 } 129 130 131 static void 132 update_image( void ) 133 { 134 XSetWindowBackgroundPixmap( display, window, pixmap ); 135 136 if ( mask ) { 137 XShapeCombineMask( display, window, 138 ShapeBounding, 0, 0, mask, ShapeSet ); 139 } 140 141 XClearWindow( display, window ); 142 XSync( display, False ); 143 } 144 145 146 static void 147 flip_horizontal( void ) 148 { 149 Imlib_free_pixmap( imlib_data, pixmap ); 150 Imlib_flip_image_horizontal( imlib_data, imlib_image ); 151 render(); 152 update_image(); 153 } 154 155 156 static void 157 flip_vertical( void ) 158 { 159 Imlib_free_pixmap( imlib_data, pixmap ); 160 Imlib_flip_image_vertical( imlib_data, imlib_image ); 161 render(); 162 update_image(); 163 } 164 165 166 /* End of x_imlib.c */
¡û ¥µ¥ó¥×¥ë¥×¥í¥°¥é¥à¤ÎÀâÌÀ
¤Ç¤Ï¡¢¥µ¥ó¥×¥ë¥×¥í¥°¥é¥à¤Ë¤Ä¤¤¤ÆÀâÌÀ¤·¤Æ¤¤¤¤Þ¤¹¡£
- 5 ¹ÔÌÜ
Imlib ¤ò»È¤¦¤¿¤á¤ËɬÍ×¤Ê Imlib.h ¤ò¥¤¥ó¥¯¥ë¡¼¥É¤·¤Æ¤¤¤Þ¤¹¡£
- 11 ¡Á 16 ¹ÔÌÜ
ImlibData ·¿¤Ï Imlib ¤È¤ä¤ê¤È¤ê¤¹¤ë¤¿¤á¤Î¶¦Ḁ̈ǡ¼¥¿¤ò³ÊǼ¤¹¤ë¹½Â¤ÂΤǡ¢ImlibImage ¤Ï 1 ²èÁü¤ËÂбþ¤¹¤ë¥Ç¡¼¥¿¤ò³ÊǼ¤¹¤ë¹½Â¤ÂΤǤ¹¡£pixmap ¤È mask ¤ÏÆɤ߹þ¤ó¤À²èÁü¥Ç¡¼¥¿¤ª¤è¤ÓÂбþ¤¹¤ë¥Þ¥¹¥¯¤ò³ÊǼ¤¹¤ë¤¿¤á¤ÎÊÑ¿ô¤Ç¡¢width / height ¤Ï²èÁü¤ÎÉý¤È¹â¤µ¤òɽ¤·¤Þ¤¹¡£
- 25 ¡Á 119 ¹ÔÌÜ ( main() )
x_imlib.c ¤Î main ´Ø¿ô¤Ç¤¹¡£³Æ½èÍý¤Ë¤Ä¤¤¤Æ°Ê²¼¤ÇÀâÌÀ¤·¤Æ¤¤¤¤Þ¤¹¡£
- 38 ¡Á 42 ¹ÔÌÜ
Imlib ¤ò½é´ü²½¤·¤Æ¤¤¤Þ¤¹¡£Imlib ¤Î½é´ü²½¤Ï Imlib_init() ¤ò»È¤Ã¤Æ¹Ô¤¤¤Þ¤¹¡£
ImlibData* Imlib_init( Display* disp );
¤³¤Î´Ø¿ô¤ò¼Â¹Ô¤¹¤ë¤È Imlib ¤¬½é´ü²½¤µ¤ì¡¢ImlibData ·¿¤Î¥Ý¥¤¥ó¥¿¤¬ÊÖ¤ê¤Þ¤¹¡£¤³¤Î¥Ý¥¤¥ó¥¿¤Ï¾¤Î Imlib ´Ø¿ô¤Ë¤Æ°ú¿ô¤È¤·¤Æ»ØÄꤹ¤ë¤³¤È¤Ë¤Ê¤ê¤Þ¤¹¡£
- 44 ¡Á 48 ¹ÔÌÜ
»ØÄꤵ¤ì¤¿²èÁü¥Õ¥¡¥¤¥ë¤ò Imlib ¤ò»È¤Ã¤ÆÆɤ߹þ¤ß¤Þ¤¹¡£²èÁü¤ÎÆɤ߹þ¤ß¤Ë¤Ï Imlib_load_image() ¤ò»ÈÍѤ·¤Þ¤¹¡£
ImlibImage* Imlib_load_image( ImlibData* id, char* file ); file : Æɤ߹þ¤ß²èÁü¥Õ¥¡¥¤¥ë¥Ñ¥¹
Imlib ¤Ï¡¢libpng ¤ä libjpeg Åù¤Î¥é¥¤¥Ö¥é¥ê¤ä¡¢ImageMagick Åù¤Î¥Ä¡¼¥ë¤ò»È¤¤ÍÍ¡¹¤Ê²èÁü¥Õ¥©¡¼¥Þ¥Ã¥È¤ÎÆɤ߹þ¤ß¤ò²Äǽ¤È¤·¤Æ¤¤¤Þ¤¹¡Ê¤â¤Á¤í¤ó¤½¤ì¤é¤Î¥é¥¤¥Ö¥é¥ê¤¬´Ä¶¤Ë¥¤¥ó¥¹¥È¡¼¥ë¤µ¤ì¤Æ¤¤¤Ê¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó¤¬¡Ë¡£Á´¤Æ¤ÎɬÍפʳ°Éô¥é¥¤¥Ö¥é¥ê¤¬¥¤¥ó¥¹¥È¡¼¥ë¤µ¤ì¤Æ¤¤¤ë´Ä¶¤Ç¤Ï¡¢JPEG/GIF/PPM/PGM/XPM/PNG/TIFF/EIM ¤È¤¤¤Ã¤¿²èÁü¤òÆɤ߹þ¤à¤³¤È¤¬½ÐÍè¤ëÍͤǤ¹¡Ê¼«Ê¬¤Ç¤ÏÁ´¤Æ¤Ï»î¤·¤Æ¤¤¤Þ¤»¤ó¡Ë¡£
- 67 ¡Á 68 ¹ÔÌÜ
Imlib_load_image() ¤ÇÆɤ߹þ¤ó¤À²èÁü¤Ï¡¢X ¤Çɽ¼¨¤Ç¤¤ë Pixmap ¤Î·Á¼°¤Ë¤Ï¤Ê¤Ã¤Æ¤¤¤Þ¤»¤ó¡£render() ¤Ï Imlib ¤¬Æɤ߹þ¤ó¤À²èÁü¥Ç¡¼¥¿¤ò Pixmap ¤ËÊÑ´¹¤·¡¢¥Õ¥¡¥¤¥ë¤ÎÀèƬ¤ÇÀë¸À¤·¤¿ pixmap / mask ÊÑ¿ô¤Ë ID ¤ò³ÊǼ¤¹¤ë¼«ºî´Ø¿ô¤Ç¤¹¡£¤Þ¤¿ update_image() ¤Ï¡¢¥¦¥£¥ó¥É¥¦¤Ë²èÁü¤òɽ¼¨¤¹¤ë¤¿¤á¤Î¼«ºî´Ø¿ô¤Ç¤¹¡£¤¤¤º¤ì¤â¸åÄøÀâÌÀ¤·¤Þ¤¹¡£
- 83 ¡Á 86 ¹ÔÌÜ
º¸±¦¤Î¥«¡¼¥½¥ë¥¡¼¤¬²¡¤µ¤ì¤¿»þ¤Î½èÍý¤Ç¤¹¡£¼ÂºÝ¤Î½èÍý¤Ï 146 ¡Á 153 ¹ÔÌܤΠflip_horizontal() ¤Ç¹Ô¤Ã¤Æ¤¤¤Þ¤¹¡£flip_horizontal() ¤Ç¤Ï¡¢Imlib_free_pixmap() ¤Ç¸½ºß¤Îɽ¼¨ÍÑ Pixmap ¤Î²òÊü½èÍý¤ò¹Ô¤¤¡¢Imlib_flip_image_horizontal() ¤Ç²èÁü¤Îº¸±¦È¿Å¾½èÍý¤ò¹Ô¤Ã¤Æ¤¤¤Þ¤¹¡£
void Imlib_flip_image_horizontal( ImlibData* id, ImlibImage* image );
Imlib_flip_image_horizontal() ¤Ï¡¢ImlibImage ÆâÉô¤Î²èÁü¥Ç¡¼¥¿¤Îȿž½èÍý¤ò¹Ô¤¦¤Î¤ß¤Ç¤¹¤Î¤Ç¡¢ºÆÅÙ render() / update_image() ¤Ë¤Æ Pixmap ¤ÎÀ¸À® / ²èÁüɽ¼¨¤ò¹Ô¤Ã¤Æ¤¤¤Þ¤¹¡£Imlib_free_pixmap() ¤Ë¤Ä¤¤¤Æ¤Ï¸åÄøÀâÌÀ¤·¤Þ¤¹¡£
- 87 ¡Á 90 ¹ÔÌÜ
¾å²¼¤Î¥«¡¼¥½¥ë¥¡¼¤¬²¡¤µ¤ì¤¿»þ¤Î½èÍý¤Ç¤¹¡£¼ÂºÝ¤Î½èÍý¤Ï 156 ¡Á 163 ¹ÔÌܤΠflip_vertical() ¤Ç¹Ô¤Ã¤Æ¤¤¤Þ¤¹¡£flip_vertical() ¤Ç¤Ï¡¢Imlib_free_pixmap() ¤Ç¸½ºß¤Îɽ¼¨ÍÑ Pixmap ¤Î²òÊü½èÍý¤ò¹Ô¤¤¡¢Imlib_flip_image_vertical() ¤Ç²èÁü¤Î¾å²¼È¿Å¾½èÍý¤ò¹Ô¤Ã¤Æ¤¤¤Þ¤¹¡£
void Imlib_flip_image_vertical( ImlibData* id, ImlibImage* image );
Imlib_flip_image_vertical() ¤Ï¡¢ImlibImage ÆâÉô¤Î²èÁü¥Ç¡¼¥¿¤Îȿž½èÍý¤ò¹Ô¤¦¤Î¤ß¤Ç¤¹¤Î¤Ç¡¢ºÆÅÙ render() / update_image() ¤Ë¤Æ Pixmap ¤ÎÀ¸À® / ²èÁüɽ¼¨¤ò¹Ô¤Ã¤Æ¤¤¤Þ¤¹¡£Imlib_free_pixmap() ¤Ë¤Ä¤¤¤Æ¤Ï¸åÄøÀâÌÀ¤·¤Þ¤¹¡£
- 98 ¡Á 104 ¹ÔÌÜ
ConfigureNotify ¤Ï¡¢¥¦¥£¥ó¥É¥¦¤ÎÂ礤µ¤¬Êѹ¹¤µ¤ì¤¿¾ì¹ç¤ËÁ÷¤é¤ì¤Æ¤¯¤ë¥¤¥Ù¥ó¥È¤Ç¤¹¡£¿·¤·¤¤¥¦¥£¥ó¥É¥¦¤ÎÂ礤µ¤òÊݸ¤·¡¢¤½¤ÎÂ礤µ¤Çɽ¼¨ÍÑ Pixmap ¤òºî¤êľ¤·¤ÇºÆɽ¼¨¤·¤Æ¤¤¤Þ¤¹¡£
Imlib ¤ÏÆâÉô¤Ç¥¥ã¥Ã¥·¥åµ¡¹½¤ò¼ÂÁõ¤·¤Æ¤¤¤ë¤¿¤á¡¢Pixmap ¤¬ÉÔÍפˤʤ俾ì¹ç¤ÏÉáÄÌ¤Ë XFreePixmap() ¤ò»È¤¦¤Î¤Ç¤Ï¤Ê¤¯¡¢Imlib_free_pixmap() ¤ò»È¤¦É¬Íפ¬¤¢¤ê¤Þ¤¹¡£
void Imlib_free_pixmap( ImlibData* id, Pixmap pixmap ); pixmap : ²òÊü¤¹¤ë Pixmap ID
¤³¤Î´Ø¿ô¤Ï¡¢Pixmap ¤Î»²¾È¥«¥¦¥ó¥¿¡ÊImlib ¤¬ÆâÉô¤Ç´ÉÍý¡Ë¤ò¸º¤é¤·¡¢»²¾È¥«¥¦¥ó¥¿¤¬ 0 ¤Ë¤Ê¤Ã¤¿»þÅÀ¤Ç¥¥ã¥Ã¥·¥å¤Ë°ÜÆ°¤·¤Þ¤¹¡£¤½¤Î¸å¡¢¥¥ã¥Ã¥·¥å¤¬°ìÇդˤʤ俾ì¹ç¤Ë¸Å¤¤ Pixmap ¤«¤é²òÊü¤µ¤ì¤Þ¤¹¡Ê¤¹¤°¤Ë²òÊü¤¹¤ë¤ï¤±¤Ç¤Ï¤Ê¤¤ÍͤǤ¹¡£¡Ë¡£Imlib ¤ÇºîÀ®¤·¤¿ Pixmap ¤ò²òÊü¤¹¤ëºÝ¤Ë¤Ï¤³¤Î´Ø¿ô¤ò»È¤Ã¤Æ¤¯¤À¤µ¤¤¡£¤Þ¤¿¡¢Imlib ¤ÇºîÀ®¤·¤Æ¤¤¤Ê¤¤ Pixmap ¤Ç¤âÉáÄ̤˲òÊü¤Ç¤¤Þ¤¹¤Î¤Ç¡¢¤³¤Î´Ø¿ô¤ÇÅý°ì¤·¤Æ¤â¹½¤ï¤Ê¤¤¤È»×¤¤¤Þ¤¹¡£¤Þ¤¿¡¢´ØÏ¢¤¹¤ë¥Þ¥¹¥¯ÍÑ Pixmap ¤â¼«Æ°Åª¤Ë²òÊü¤·¤Þ¤¹¤Î¤Ç¡¢¥Þ¥¹¥¯¤ËÂФ·¤Æ¸ÄÊ̤˲òÊü¤¹¤ëɬÍפϤ¢¤ê¤Þ¤»¤ó¡£
- 113 ¡Á 114 ¹ÔÌÜ
Imlib_free_pixmap() ¤Ë¤è¤Ã¤Æ Pixmap ¤ò²òÊü¤·¤¿¸å¡¢Imlib_kill_image() ¤ò»È¤Ã¤Æ ImlibImage ¹½Â¤ÂΤò²òÊü¤·¤Æ¤¤¤Þ¤¹¡£
void Imlib_kill_image( ImlibData* id, ImlibImage* image ); void Imlib_destroy_image( ImlibData* id, ImlibImage* image );
Imlib_kill_image() ¤ò¼Â¹Ô¤¹¤ë¤È¡¢²èÁü¥Ç¡¼¥¿Åù¤ò¥¥ã¥Ã¥·¥å¤ËÊݸ¤¹¤ë¤³¤È¤Ê¤¯Â¨ºÂ¤Ë²òÊü¤·¤Þ¤¹¡£¤Ê¤ª¡¢Imlib_destroy_image() ¤ÎÊý¤Ï¡¢»²¾È¥«¥¦¥ó¥¿¤ò¸º¤é¤·¤Æ¥«¥¦¥ó¥¿¤¬ 0 ¤Ë¤Ê¤Ã¤¿»þÅÀ¤Ç¥¥ã¥Ã¥·¥å¤Ë°ÜÆ°¤·¤Þ¤¹¡£¤½¤Î¸å¡¢¥¥ã¥Ã¥·¥å¤¬°ìÇդˤʤ俺ݤ˲òÊü¤µ¤ì¤Þ¤¹¡£
- 122 ¡Á 128 ¹ÔÌÜ ( render() )
Imlib_render() ¤ò»È¤¤¡¢ImlibImage ¤Ë³ÊǼ¤µ¤ì¤Æ¤¤¤ë²èÁü¥Ç¡¼¥¿¤«¤é»ØÄêÉý¤È¹â¤µ¤Î Pixmap¡Ê¤ª¤è¤ÓÂбþ¤¹¤ë¥Þ¥¹¥¯¡Ë¤òÀ¸À®¤·¤Æ¤¤¤Þ¤¹¡£
int Imlib_render( ImlibData* id, ImlibImage* image, int width, int height ); width : À¸À®¤¹¤ë Pixmap ¤ÎÉý height : À¸À®¤¹¤ë Pixmap ¤Î¹â¤µ
Pixmap À¸À®¤ËÀ®¸ù¤·¤¿¾ì¹ç¤Ï 1 ¤ò¡¢¼ºÇÔ¤·¤¿¾ì¹ç¤Ï 0 ¤òÊÖ¤·¤Þ¤¹¡£¤½¤Î¸å¡¢¼ÂºÝ¤Ë Pixmap ¤È¥Þ¥¹¥¯¤ò¼è¤ê½Ð¤¹¤¿¤á¤Ë Imlib_move_image() ¤ª¤è¤Ó Imlib_move_mask() ¤ò¼Â¹Ô¤·¤Æ¤¤¤Þ¤¹¡£
Pixmap Imlib_move_image( ImlibData* id, ImlibImage* image ); Pixmap Imlib_move_mask( ImlibData* id, ImlibImage* image );
Imlib_move_image() / Imlib_move_mask() ¤ò¼Â¹Ô¤¹¤ë¤È Pixmap / ¥Þ¥¹¥¯¤òÊÖ¤·¤Þ¤¹¡£Pixmap ¤¬À¸À®¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¤Ï 0 ¤Þ¤¿¤Ï NULL ¤òÊÖ¤·¤Þ¤¹¡£¤³¤ì¤é¤ò¼Â¹Ô¤¹¤ë¤È ImlibImage ¤ËÀßÄꤵ¤ì¤Æ¤¤¤ë Pixmap ID ¤¬½é´ü²½¤µ¤ì¤ë¤¿¤á¡¢Æ±¤¸ÆâÍƤΠPixmap ¤ò¼èÆÀ¤¹¤ë¤Ë¤ÏºÆÅÙ Imlib_render() ¤«¤é¤ä¤êľ¤¹É¬Íפ¬¤¢¤ê¤Þ¤¹¡£¼èÆÀ¤·¤¿ Pixmap ¤ËÊѹ¹¤ò²Ã¤¨¤ë¤Î¤Ç¥ª¥ê¥¸¥Ê¥ë¤Î Pixmap ¤òºÆÅÙ¼èÆÀ¤·¤¿¤¤¾ì¹ç¤Ï¡¢¼¡¤Î Imlib_copy_image() / Imlib_copy_mask() ¤ò»È¤Ã¤Æ¤¯¤À¤µ¤¤¡£
Pixmap Imlib_copy_image( ImlibData* id, ImlibImage* image ); Pixmap Imlib_copy_mask( ImlibData* id, ImlibImage* image );
Imlib_copy_image() / Imlib_copy_mask() ¤Ï¡¢ÊÝ»ý¤·¤Æ¤¤¤ë Pixmap ¤Î¥³¥Ô¡¼¤òºîÀ®¤·¤ÆÊÖ¤·¤Þ¤¹¡£¥ª¥ê¥¸¥Ê¥ë¤¬Êݸ¤µ¤ì¤ë¤¿¤á¡¢¼èÆÀ¤·¤¿ Pixmap ¤ËÊѹ¹¤ò²Ã¤¨¤¿¸å¤Ç¥ª¥ê¥¸¥Ê¥ë¤òºÆ¼èÆÀ¤·¤¿¤¤¾ì¹ç¤Ï¡¢¤â¤¦°ìÅÙ Imlib_copy_image() / Imlib_copy_mask() ¤ò¼Â¹Ô¤¹¤ì¤ÐÎɤ¤¤Ç¤¹¡£¤¿¤À¤·¥³¥Ô¡¼½èÍý¤ò¹Ô¤¦¤¿¤á¡¢Imlib_move_image() / Imlib_move_mask() ¤è¤ê¤â¥Ñ¥Õ¥©¡¼¥Þ¥ó¥¹¤¬Íî¤Á¤Þ¤¹¡£
- 131 ¡Á 143 ¹ÔÌÜ ( update_image( void ) )
Pixmap ¤ò¥¦¥£¥ó¥É¥¦¤ÎÇØ·Ê Pixmap ¤È¤·¤ÆÀßÄꤷ¡¢¹¹¤Ë XShapeCombineMask() ¤ò»È¤Ã¤Æ¥Þ¥¹¥¯¤òÀßÄꤷ¤Æ¤¤¤Þ¤¹¡£¤³¤ì¤Ë¤è¤ê¡¢Æ©²áɽ¼¨¤¹¤Ù¤²èÁü¤â¤¤Á¤ó¤Èɽ¼¨¤µ¤ì¤Þ¤¹¡£
°Ê¾å¤Ç x_imlib.c ¤Ë¤Ä¤¤¤Æ¤ÎÀâÌÀ¤Ï½ª¤ï¤ê¤Ç¤¹¡£¼¡²ó¤Ï¡¢Æɤ߹þ¤ó¤À²èÁü¥Ç¡¼¥¿¤ò¤Á¤ç¤Ã¤È²Ã¹©¤·¤Æ¤ß¤¿¤¤¤È»×¤¤¤Þ¤¹¡£