Changeset 1919
- Timestamp:
- Nov 7, 2007, 11:29:02 AM (15 years ago)
- Location:
- libcaca/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
libcaca/trunk/doc/img2txt.1
r1918 r1919 11 11 .B \-H 12 12 .I height 13 ] 14 [ 15 .B \-x 16 .I font-width 17 ] 18 [ 19 .B \-y 20 .I font-height 13 21 ] 14 22 .PD 0 … … 60 68 .B \-H, \-\-height=<height> 61 69 Change output line count. If not given, the height is computed to match correct aspect ratio. 70 .TP 71 .B \-x, \-\-font-width=<width> 72 Change output font width. If not given, the default is set to 6. This value will be used for computing aspect ratio. 73 .TP 74 .B \-y, \-\-font-height=<height> 75 Change output font height. If not given, the default is set to 10. This value will be used for computing aspect ratio. 62 76 .TP 63 77 .B \-b, \-\-brightness=<brightness> -
libcaca/trunk/src/img2txt.c
r1917 r1919 50 50 fprintf(stderr, " -W, --width=WIDTH\t\tWidth of resulting image\n"); 51 51 fprintf(stderr, " -H, --height=HEIGHT\t\tHeight of resulting image\n"); 52 fprintf(stderr, " -x, --font-width=WIDTH\t\tWidth of output font\n"); 53 fprintf(stderr, " -y, --font-height=HEIGHT\t\tHeight of output font\n"); 52 54 fprintf(stderr, " -b, --brightness=BRIGHTNESS\tBrightness of resulting image\n"); 53 55 fprintf(stderr, " -c, --contrast=CONTRAST\tContrast of resulting image\n"); … … 97 99 unsigned long int len; 98 100 struct image *i; 99 unsigned int cols = 0, lines = 0 ;101 unsigned int cols = 0, lines = 0, font_width = 6, font_height = 10; 100 102 char *format = NULL; 101 103 char *dither = NULL; … … 116 118 { "width", 1, NULL, 'W' }, 117 119 { "height", 1, NULL, 'H' }, 120 { "font-width", 1, NULL, 'x' }, 121 { "font-height", 1, NULL, 'y' }, 118 122 { "format", 1, NULL, 'f' }, 119 123 { "dither", 1, NULL, 'd' }, … … 122 126 { "contrast", 1, NULL, 'c' }, 123 127 { "help", 0, NULL, 'h' }, 124 { "version", 128 { "version", 0, NULL, 'v' }, 125 129 }; 126 int c = mygetopt(argc, argv, "W:H:f:d:g:b:c:h:v ", long_options, &option_index);130 int c = mygetopt(argc, argv, "W:H:f:d:g:b:c:h:v:x:y:", long_options, &option_index); 127 131 if(c == -1) 128 132 break; … … 136 140 lines = atoi(myoptarg); 137 141 break; 142 case 'x': /* --width */ 143 font_width = atoi(myoptarg); 144 break; 145 case 'y': /* --height */ 146 font_height = atoi(myoptarg); 147 break; 138 148 case 'f': /* --format */ 139 149 format = myoptarg; … … 185 195 { 186 196 cols = 60; 187 lines = cols * i->h * 6 / i->w / 10;197 lines = cols * i->h * font_width / i->w / font_height; 188 198 } 189 199 else if(cols && !lines) 190 200 { 191 lines = cols * i->h * 6 / i->w / 10;201 lines = cols * i->h * font_width / i->w / font_height; 192 202 } 193 203 else if(!cols && lines) 194 204 { 195 cols = lines * i->w * 10 / i->h / 6;205 cols = lines * i->w * font_height / i->h / font_width; 196 206 } 197 207
Note: See TracChangeset
for help on using the changeset viewer.