summaryrefslogtreecommitdiff
path: root/Build/source/texk/dvipdfm-x/pdfximage.c
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2014-08-11 08:45:59 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2014-08-11 08:45:59 +0000
commit1cc525b5f4bba709ce6f624d26f6d170ca405683 (patch)
tree94d4bdb301f7b67abe78c6158601b1557e666e34 /Build/source/texk/dvipdfm-x/pdfximage.c
parent82c4fbd59ef01eb96adfd4c62bbab9f43fcbf7cb (diff)
texk/dvipdfm-x: Add support for JPEG 2000 (and BMP for extractbb),
from Shunsaku Hirata <shunsaku.hirata74@gmail.com> git-svn-id: svn://tug.org/texlive/trunk@34905 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/dvipdfm-x/pdfximage.c')
-rw-r--r--Build/source/texk/dvipdfm-x/pdfximage.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/Build/source/texk/dvipdfm-x/pdfximage.c b/Build/source/texk/dvipdfm-x/pdfximage.c
index eefd4f74a6a..53c1ddcab8c 100644
--- a/Build/source/texk/dvipdfm-x/pdfximage.c
+++ b/Build/source/texk/dvipdfm-x/pdfximage.c
@@ -40,6 +40,7 @@
#include "mpost.h"
#include "pngimage.h"
#include "jpegimage.h"
+#include "jp2image.h"
#include "bmpimage.h"
#include "pdfximage.h"
@@ -56,6 +57,7 @@ static int ps_include_page (pdf_ximage *ximage, const char *file_name);
#define IMAGE_TYPE_MPS 4
#define IMAGE_TYPE_EPS 5
#define IMAGE_TYPE_BMP 6
+#define IMAGE_TYPE_JP2 7
struct attr_
@@ -223,6 +225,10 @@ source_image_type (FILE *fp)
{
format = IMAGE_TYPE_JPEG;
}
+ else if (check_for_jp2(fp))
+ {
+ format = IMAGE_TYPE_JP2;
+ }
#ifdef HAVE_LIBPNG
else if (check_for_png(fp))
{
@@ -271,6 +277,13 @@ load_image (const char *ident, const char *fullname, int format, FILE *fp,
goto error;
I->subtype = PDF_XOBJECT_TYPE_IMAGE;
break;
+ case IMAGE_TYPE_JP2:
+ if (_opts.verbose)
+ MESG("[JP2]");
+ if (jp2_include_image(I, fp) < 0)
+ goto error;
+ I->subtype = PDF_XOBJECT_TYPE_IMAGE;
+ break;
#ifdef HAVE_LIBPNG
case IMAGE_TYPE_PNG:
if (_opts.verbose)
@@ -509,8 +522,9 @@ pdf_ximage_set_image (pdf_ximage *I, void *image_info, pdf_obj *resource)
pdf_add_dict(dict, pdf_new_name("Subtype"), pdf_new_name("Image"));
pdf_add_dict(dict, pdf_new_name("Width"), pdf_new_number(info->width));
pdf_add_dict(dict, pdf_new_name("Height"), pdf_new_number(info->height));
- pdf_add_dict(dict, pdf_new_name("BitsPerComponent"),
- pdf_new_number(info->bits_per_component));
+ if (info->bits_per_component > 0) /* Ignored for JPXDecode filter. FIXME */
+ pdf_add_dict(dict, pdf_new_name("BitsPerComponent"),
+ pdf_new_number(info->bits_per_component));
if (I->attr_dict)
pdf_merge_dict(dict, I->attr_dict);