~ubuntu-branches/ubuntu/trusty/graphicsmagick/trusty-proposed

« back to all changes in this revision

Viewing changes to coders/txt.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Kobras
  • Date: 2009-05-07 20:09:28 UTC
  • mfrom: (5.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20090507200928-5rb3jyvrsi9x3zfl
Tags: 1.3.5-5
* debian/control: Update Conflicts/Replaces of -dev-compat package to
  follow libmagick-dev package split. Closes: #526482
* magick/GraphicsMagick-config.{in,1}: Do not expose compiler options
  used to build the library itself via GraphicsMagick-config. Only
  provide options that are actually useful to depending applications.
  Adjust documentation accordingly. Closes: #523596

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
*/
38
38
#include "magick/studio.h"
39
39
#include "magick/blob.h"
40
 
#include "magick/cache.h"
 
40
#include "magick/pixel_cache.h"
41
41
#include "magick/color.h"
42
42
#include "magick/constitute.h"
43
43
#include "magick/magick.h"
105
105
    char
106
106
      buffer[MaxTextExtent];
107
107
 
108
 
    memset((void *)buffer,0,MaxTextExtent);
109
 
    memcpy((void *)buffer,(const void *)magick,Min(MaxTextExtent,length));
 
108
    (void) memset((void *)buffer,0,MaxTextExtent);
 
109
    (void) memcpy((void *)buffer,(const void *)magick,Min(MaxTextExtent,length));
110
110
 
111
111
    count=sscanf(buffer,"%lu,%lu: (%u, %u, %u) #%02X%02X%02X",
112
112
                 &column, &row, &red, &green, &blue, &hex_red, &hex_green,
239
239
 
240
240
      (void) strcpy(density,PSDensityGeometry);
241
241
      count=GetMagickDimension(density,&image->x_resolution,
242
 
        &image->y_resolution);
 
242
        &image->y_resolution,NULL,NULL);
243
243
      if (count != 2)
244
244
        image->y_resolution=image->x_resolution;
245
245
    }
266
266
      clone_info=CloneImageInfo(image_info);
267
267
      clone_info->blob=(void *) NULL;
268
268
      clone_info->length=0;
269
 
      (void) strncpy(clone_info->filename,image_info->texture,MaxTextExtent-1);
 
269
      (void) strlcpy(clone_info->filename,image_info->texture,MaxTextExtent);
270
270
      texture=ReadImage(clone_info,exception);
271
271
      DestroyImageInfo(clone_info);
272
272
    }
273
273
  /*
274
274
    Annotate the text image.
275
275
  */
276
 
  SetImage(image,OpaqueOpacity);
 
276
  (void) SetImage(image,OpaqueOpacity);
277
277
  draw_info=CloneDrawInfo(image_info,(DrawInfo *) NULL);
278
278
  draw_info->fill=image_info->pen;
279
279
  (void) CloneString(&draw_info->text,image_info->filename);
282
282
  status=GetTypeMetrics(image,draw_info,&metrics);
283
283
  if (status == False)
284
284
    ThrowReaderException(TypeError,UnableToGetTypeMetrics,image);
285
 
  (void) strncpy(filename,image_info->filename,MaxTextExtent-1);
 
285
  (void) strlcpy(filename,image_info->filename,MaxTextExtent);
286
286
  if (draw_info->text != '\0')
287
287
    *draw_info->text='\0';
288
288
  p=ReadBlobString(image,text);
302
302
    offset+=(long) (metrics.ascent-metrics.descent);
303
303
    if (image->previous == (Image *) NULL)
304
304
      if (QuantumTick(offset,image->rows))
305
 
        if (!MagickMonitor(LoadImageText,offset,image->rows,&image->exception))
 
305
        if (!MagickMonitorFormatted(offset,image->rows,&image->exception,
 
306
                                    LoadImageText,image->filename))
306
307
          break;
307
308
    p=ReadBlobString(image,text);
308
309
    if ((offset < (long) image->rows) && (p != (char *) NULL))
313
314
          handler;
314
315
 
315
316
        handler=SetMonitorHandler((MonitorHandler) NULL);
316
 
        TextureImage(image,texture);
 
317
        (void) TextureImage(image,texture);
317
318
        (void) SetMonitorHandler(handler);
318
319
      }
319
320
    (void) AnnotateImage(image,draw_info);
333
334
    image->next->columns=image->columns;
334
335
    image->next->rows=image->rows;
335
336
    image=SyncNextImageInList(image);
336
 
    (void) strncpy(image->filename,filename,MaxTextExtent-1);
337
 
    SetImage(image,OpaqueOpacity);
338
 
    if (!MagickMonitor(LoadImagesText,TellBlob(image),GetBlobSize(image),exception))
 
337
    (void) strlcpy(image->filename,filename,MaxTextExtent);
 
338
    (void) SetImage(image,OpaqueOpacity);
 
339
    if (!MagickMonitorFormatted(TellBlob(image),GetBlobSize(image),exception,
 
340
                                LoadImagesText,image->filename))
339
341
      break;
340
342
  }
341
343
  if (texture != (Image *) NULL)
344
346
        handler;
345
347
 
346
348
      handler=SetMonitorHandler((MonitorHandler) NULL);
347
 
      TextureImage(image,texture);
 
349
      (void) TextureImage(image,texture);
348
350
      (void) SetMonitorHandler(handler);
349
351
    }
350
352
  (void) AnnotateImage(image,draw_info);
389
391
  entry->decoder=(DecoderHandler) ReadTXTImage;
390
392
  entry->encoder=(EncoderHandler) WriteTXTImage;
391
393
  entry->raw=True;
392
 
  entry->description=AcquireString("Text");
393
 
  entry->module=AcquireString("TXT");
 
394
  entry->description="Text";
 
395
  entry->module="TXT";
394
396
  (void) RegisterMagickInfo(entry);
395
397
 
396
398
  entry=SetMagickInfo("TXT");
397
399
  entry->decoder=(DecoderHandler) ReadTXTImage;
398
400
  entry->encoder=(EncoderHandler) WriteTXTImage;
399
 
  entry->description=AcquireString("Text");
400
 
  entry->module=AcquireString("TXT");
 
401
  entry->description="Text";
 
402
  entry->module="TXT";
401
403
  (void) RegisterMagickInfo(entry);
402
404
}
403
405
 
492
494
    /*
493
495
      Convert MIFF to TXT raster pixels.
494
496
    */
495
 
    TransformColorspace(image,RGBColorspace);
 
497
    (void) TransformColorspace(image,RGBColorspace);
496
498
    for (y=0; y < (long) image->rows; y++)
497
499
    {
498
500
      p=AcquireImagePixels(image,0,y,image->columns,1,&image->exception);
514
516
    if (image->next == (Image *) NULL)
515
517
      break;
516
518
    image=SyncNextImageInList(image);
517
 
    status=MagickMonitor(SaveImagesText,scene++,GetImageListLength(image),
518
 
      &image->exception);
 
519
    status=MagickMonitorFormatted(scene++,GetImageListLength(image),
 
520
                                  &image->exception,SaveImagesText,
 
521
                                  image->filename);
519
522
    if (status == False)
520
523
      break;
521
524
  } while (image_info->adjoin);