mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-22 20:50:44 +00:00
seek for trailing signature and recognize v2 TGA files and hint that to ImageMagick
This commit is contained in:
parent
ae6323b042
commit
656fe6e576
1 changed files with 12 additions and 1 deletions
|
@ -2,9 +2,11 @@
|
|||
|
||||
<abstract>ImageMagick image representation.</abstract>
|
||||
|
||||
Copyright (C) 2011 Free Software Foundation, Inc.
|
||||
Copyright (C) 2011-2024 Free Software Foundation, Inc.
|
||||
|
||||
Author: Eric Wasylishen <ewasylishen@gmail.com>
|
||||
Riccardo Mottola
|
||||
|
||||
Date: June 2011
|
||||
|
||||
This file is part of the GNUstep Application Kit Library.
|
||||
|
@ -130,6 +132,7 @@
|
|||
ExceptionInfo *exception = AcquireExceptionInfo();
|
||||
ImageInfo *imageinfo = CloneImageInfo(NULL);
|
||||
Image *images, *image;
|
||||
char signature[32];
|
||||
|
||||
// Set the background color to transparent
|
||||
// (otherwise SVG's are rendered against a white background by default)
|
||||
|
@ -139,6 +142,14 @@
|
|||
QueryColorDatabase("none", &imageinfo->background_color, exception);
|
||||
#endif
|
||||
|
||||
bzero(signature, 32);
|
||||
[data getBytes:signature range:NSMakeRange([data length]-18, 18)];
|
||||
if (strncmp(signature, "TRUEVISION-XFILE.", 17) == 0)
|
||||
{
|
||||
NSWarnLog(@"Targa file detected!, giving a magick hint...");
|
||||
strcpy(imageinfo->magick, "TGA");
|
||||
}
|
||||
|
||||
images = BlobToImage(imageinfo, [data bytes], [data length], exception);
|
||||
|
||||
if (exception->severity != UndefinedException)
|
||||
|
|
Loading…
Reference in a new issue