Changeset 433 for ImageMagick/trunk/coders/braille.c
- Timestamp:
- 10/23/09 07:43:35 (5 months ago)
- Files:
-
- 1 modified
-
ImageMagick/trunk/coders/braille.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ImageMagick/trunk/coders/braille.c
r1 r433 176 176 *value; 177 177 178 int 179 unicode = 0, 180 iso_11548_1 = 0; 181 178 182 long 179 183 y; … … 196 200 unsigned long 197 201 cell_height = 4; 198 int199 unicode = 0, iso_11548_1 = 0;200 202 201 203 /* … … 206 208 assert(image != (Image *) NULL); 207 209 assert(image->signature == MagickSignature); 208 209 210 if (LocaleCompare(image_info->magick, "UBRL") == 0) 210 unicode =1;211 unicode=1; 211 212 else 212 213 if (LocaleCompare(image_info->magick, "ISOBRL") == 0) 213 iso_11548_1 =1;214 iso_11548_1=1; 214 215 else 215 cell_height = 3; 216 216 cell_height=3; 217 217 if (image->debug != MagickFalse) 218 218 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename); … … 220 220 if (status == MagickFalse) 221 221 return(status); 222 223 222 if (!iso_11548_1) 224 223 { … … 230 229 if (image->page.x) 231 230 { 232 (void) FormatMagickString(buffer,MaxTextExtent,"X: %ld\n", image->page.x); 231 (void) FormatMagickString(buffer,MaxTextExtent,"X: %ld\n", 232 image->page.x); 233 233 (void) WriteBlobString(image,buffer); 234 234 } 235 235 if (image->page.y) 236 236 { 237 (void) FormatMagickString(buffer,MaxTextExtent,"Y: %ld\n", image->page.y); 237 (void) FormatMagickString(buffer,MaxTextExtent,"Y: %ld\n", 238 image->page.y); 238 239 (void) WriteBlobString(image,buffer); 239 240 } … … 241 242 image->columns+(image->columns % 2)); 242 243 (void) WriteBlobString(image,buffer); 243 (void) FormatMagickString(buffer,MaxTextExtent,"Height: %lu\n", image->rows); 244 (void) FormatMagickString(buffer,MaxTextExtent,"Height: %lu\n", 245 image->rows); 244 246 (void) WriteBlobString(image,buffer); 245 246 247 (void) WriteBlobString(image,"\n"); 247 248 } 248 249 249 (void) SetImageType(image,BilevelType); 250 polarity=(IndexPacket) (PixelIntensityToQuantum(&image->colormap[0]) >= 251 (Quantum) (QuantumRange/2)); 252 if (image->colors == 2) 253 polarity=(IndexPacket) 254 (PixelIntensityToQuantum(&image->colormap[0]) >= 255 PixelIntensityToQuantum(&image->colormap[1])); 250 if (image->storage_class == PseudoClass) { 251 polarity=(IndexPacket) (PixelIntensityToQuantum(&image->colormap[0]) >= 252 (Quantum) (QuantumRange/2)); 253 if (image->colors == 2) 254 polarity=(IndexPacket) 255 (PixelIntensityToQuantum(&image->colormap[0]) >= 256 PixelIntensityToQuantum(&image->colormap[1])); 257 polarity = 0; 258 } 256 259 for (y=0; y < (long) image->rows; y+=cell_height) 257 260 { … … 263 266 break; 264 267 indexes=GetVirtualIndexQueue(image); 265 266 268 for (x=0; x < (long) image->columns; x+=2) 267 269 { … … 271 273 do 272 274 { 273 #define do_cell(dx,dy,bit) \ 274 cell |= (indexes[x+dx+dy*image->columns]==polarity)<<bit; 275 #define do_cell(dx,dy,bit) do { \ 276 if (image->storage_class == PseudoClass) \ 277 cell |= (indexes[x+dx+dy*image->columns] == polarity) << bit; \ 278 else \ 279 cell |= (p[x+dx+dy*image->columns].green == 0) << bit; \ 280 } while (0) 275 281 276 282 do_cell(0,0,0);
