Changeset 487
- Timestamp:
- Jun 23, 2005, 12:06:42 AM (16 years ago)
- Location:
- libcaca/trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
libcaca/trunk/configure.ac
r483 r487 38 38 AC_ARG_ENABLE(gl, 39 39 [ --enable-gl OpenGL support (autodetected)]) 40 AC_ARG_ENABLE(null, 41 [ --enable-null Null driver support (autodetected)]) 40 42 41 43 dnl example programs features … … 139 141 fi 140 142 143 if test "${enable_null}" != "no"; then 144 ac_cv_my_have_null="yes" 145 AC_DEFINE(USE_NULL, 1, Define to activate the Null backend driver) 146 CACA_DRIVERS="${CACA_DRIVERS} null" 147 fi 148 141 149 if test "${enable_ncurses}" != "no"; then 142 150 ac_cv_my_have_ncurses="no" -
libcaca/trunk/src/caca.c
r483 r487 200 200 #if defined(USE_GL) 201 201 if(_caca_driver == CACA_DRIVER_GL) 202 { 203 /* Nothing to do */ 204 } 205 else 206 #endif 207 #if defined(USE_NULL) 208 if(_caca_driver == CACA_DRIVER_NULL) 202 209 { 203 210 /* Nothing to do */ … … 443 450 else 444 451 #endif 452 #if defined(USE_NULL) 453 if(_caca_driver == CACA_DRIVER_NULL) 454 { 455 /* Nothing to do */ 456 } 457 else 458 #endif 445 459 { 446 460 /* Dummy */ … … 490 504 else 491 505 #endif 506 #if defined(USE_NULL) 507 if(!strcasecmp(var, "null")) 508 { 509 _caca_driver = CACA_DRIVER_NULL; 510 } 511 else 512 #endif 513 492 514 _caca_driver = CACA_DRIVER_NONE; 493 515 … … 525 547 return; 526 548 #endif 549 #if defined(USE_NULL) 550 _caca_driver = CACA_DRIVER_NULL; 551 return; 552 #endif 553 527 554 _caca_driver = CACA_DRIVER_NONE; 528 555 return; -
libcaca/trunk/src/caca.h
r486 r487 64 64 * - \c x11 uses the native X11 driver. 65 65 * - \c gl uses freeglut and opengl libraries. 66 * - \c null uses nothing at all, and will display nothing as well. 66 67 * 67 68 * \li \b CACA_GEOMETRY: set the video display size. The format of this … … 361 362 * @{ */ 362 363 char* caca_get_html(void); 364 char* caca_get_html3(void); 363 365 char* caca_get_irc(void); 364 366 /* @} */ -
libcaca/trunk/src/caca_internals.h
r483 r487 51 51 #if defined(USE_GL) 52 52 CACA_DRIVER_GL = 6, 53 #endif 54 #if defined(USE_NULL) 55 CACA_DRIVER_NULL = 7, 53 56 #endif 54 57 CACA_DRIVER_NONE = 0 -
libcaca/trunk/src/event.c
r483 r487 195 195 unsigned int ticks; 196 196 #endif 197 #if defined(USE_NULL) 198 { 199 if(_caca_driver == CACA_DRIVER_NULL) 200 return CACA_EVENT_NONE; 201 } 202 #endif 203 197 204 unsigned int event = _lowlevel_event(); 198 205 -
libcaca/trunk/src/graphics.c
r486 r487 404 404 break; 405 405 #endif 406 #if defined(USE_NULL) 407 case CACA_DRIVER_NULL: 408 /* Nothing to do */ 409 break; 410 #endif 406 411 default: 407 412 break; … … 491 496 #if defined(USE_GL) 492 497 case CACA_DRIVER_GL: 498 break; 499 #endif 500 #if defined(USE_NULL) 501 case CACA_DRIVER_NULL: 493 502 break; 494 503 #endif … … 590 599 #if defined(USE_GL) 591 600 case CACA_DRIVER_GL: 601 break; 602 #endif 603 #if defined(USE_NULL) 604 case CACA_DRIVER_NULL: 592 605 break; 593 606 #endif … … 1048 1061 else 1049 1062 #endif 1050 1063 #if defined(USE_NULL) 1064 if(_caca_driver == CACA_DRIVER_NULL) 1065 { 1066 if(getenv("CACA_GEOMETRY") && *(getenv("CACA_GEOMETRY"))) 1067 sscanf(getenv("CACA_GEOMETRY"), 1068 "%ux%u", &_caca_width, &_caca_height); 1069 if(!_caca_width) 1070 _caca_width = 80; 1071 if(!_caca_height) 1072 _caca_height = 32; 1073 } 1074 else 1075 #endif 1051 1076 { 1052 1077 /* Dummy */ … … 1127 1152 { 1128 1153 glutDestroyWindow(gl_window); 1154 } 1155 else 1156 #endif 1157 #if defined(USE_NULL) 1158 if(_caca_driver == CACA_DRIVER_NULL) 1159 { 1160 /* I'm bored to write 'nothing to do'. 1161 * So I don't. 1162 */ 1129 1163 } 1130 1164 else … … 1510 1544 else 1511 1545 #endif 1546 #if defined(USE_NULL) 1547 if(_caca_driver == CACA_DRIVER_NULL) 1548 { 1549 /* Do I told you about my cat ? */ 1550 } 1551 #endif 1512 1552 { 1513 1553 /* Dummy */ … … 1630 1670 } 1631 1671 else 1672 #endif 1673 #if defined(USE_NULL) 1674 if(_caca_driver == CACA_DRIVER_NULL) 1675 { 1676 /* \_o< pOaK */ 1677 /* By the way, we should never reach this, 1678 * as events are not handled 1679 */ 1680 } 1632 1681 #endif 1633 1682 { … … 1843 1892 } 1844 1893 1894 /** \brief Generate HTML3 representation of current image. 1895 * 1896 * This function generates and returns the HTML3 representation of 1897 * the current image. It is way bigger than caca_get_html(), but 1898 * permits viewing in old browsers (or limited ones such as links) 1899 * 1900 */ 1901 char* caca_get_html3(void) 1902 { 1903 char *buffer; 1904 unsigned int x,y; 1905 1906 /* 13000 -> css palette 1907 40 -> max size used for a pixel (plus 10, never know)*/ 1908 1909 buffer = malloc((13000 + ((_caca_width*_caca_height)*40))*sizeof(char)); 1910 1911 1912 /* Table */ 1913 sprintf(buffer, "<table cols='%d' cellpadding='0' cellspacing='0'>\n", caca_get_height()); 1914 1915 for(y=0;y<_caca_height;y++) 1916 { 1917 sprintf(buffer, 1918 "%s<tr>",buffer); 1919 1920 for(x=0;x<_caca_width;x++) 1921 { 1922 int len; 1923 int i; 1924 uint8_t *attr = cache_attr + x + y * _caca_width; 1925 1926 /* Use colspan option to factorize cells with same attributes 1927 (see below) */ 1928 len=1; 1929 while(x + len < _caca_width 1930 && (attr[len]>>4) == (attr[0]>>4) && 1931 (attr[len]&0x0f) == (attr[0]&0x0f)) 1932 len++; 1933 1934 if(len==1) 1935 { 1936 sprintf(buffer, 1937 "%s<td bgcolor=#%06X ><font color='#%06X'>%c</font></td>", buffer, 1938 html_palette[cache_attr[x+y*caca_get_width()]>>4], 1939 html_palette[cache_attr[x+y*caca_get_width()]&0x0f], 1940 cache_char[x+y*caca_get_width()]); 1941 } 1942 else 1943 { 1944 sprintf(buffer, 1945 "%s<td bgcolor=#%06X colspan=%d><font color='#%06X'>",buffer, 1946 html_palette[cache_attr[x+y*caca_get_width()]>> 4], 1947 len+1, 1948 html_palette[cache_attr[x+y*caca_get_width()]&0x0f]); 1949 1950 for(i=0;i<len;i++) 1951 { 1952 if(cache_char[x+y*caca_get_width()]!=' ') 1953 sprintf(buffer, "%s%c", buffer, cache_char[x+y*caca_get_width()]); 1954 else 1955 sprintf(buffer, "%s ", buffer); 1956 x++; 1957 } 1958 sprintf(buffer, "%s</font></td>", buffer); 1959 1960 } 1961 1962 } 1963 sprintf(buffer, "%s</tr>\n",buffer); 1964 } 1965 1966 /* Footer */ 1967 sprintf(buffer, "%s</table>\n",buffer); 1968 1969 /* Crop to really used size */ 1970 buffer = realloc(buffer, (strlen(buffer)+1) * sizeof(char)); 1971 1972 return buffer; 1973 } 1974 1845 1975 1846 1976 static int const irc_palette[] =
Note: See TracChangeset
for help on using the changeset viewer.