summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2018-11-14 00:15:14 +0100
committerTor Andersson <tor.andersson@artifex.com>2018-11-14 00:15:14 +0100
commit813e78aefb939daffd8f071be0790470ab037f2c (patch)
tree487a6cf616227f96f7fbe1732fdd89698a1b8646
parentadb68c17dcb8f92508eda3dde0077b0d87158075 (diff)
downloadmupdf-master.tar.xz
Remove TARGA output support.HEADmaster
It is not very useful.
-rw-r--r--docs/man/mutool.12
-rw-r--r--docs/manual-mutool-convert.html2
-rw-r--r--docs/manual-mutool-draw.html2
-rw-r--r--include/mupdf/fitz.h1
-rw-r--r--include/mupdf/fitz/output-tga.h36
-rw-r--r--include/mupdf/fitz/writer.h3
-rw-r--r--platform/win32/libmupdf.vcproj8
-rw-r--r--source/fitz/output-tga.c169
-rw-r--r--source/fitz/writer.c7
-rw-r--r--source/tools/muconvert.c2
-rw-r--r--source/tools/mudraw.c17
-rw-r--r--source/tools/murun.c2
12 files changed, 10 insertions, 241 deletions
diff --git a/docs/man/mutool.1 b/docs/man/mutool.1
index 7f641d68..394295e5 100644
--- a/docs/man/mutool.1
+++ b/docs/man/mutool.1
@@ -23,7 +23,7 @@ convert to another vector format, or extract the text content.
.PP
The supported input document formats are: pdf, xps, cbz, and epub.
.PP
-The supported output image formats are: pbm, pgm, ppm, pam, png, tga, pwg, pcl and ps.
+The supported output image formats are: pbm, pgm, ppm, pam, png, pwg, pcl and ps.
The supported output vector formats are: svg, pdf, and debug trace (as xml).
The supported output text formats are: plain text, html, and structured text (as xml).
.TP
diff --git a/docs/manual-mutool-convert.html b/docs/manual-mutool-convert.html
index c8205bd0..61e05fee 100644
--- a/docs/manual-mutool-convert.html
+++ b/docs/manual-mutool-convert.html
@@ -69,7 +69,7 @@ Image output
CBZ (comic book zip) is a multi-page image format.
<p>
-The following single page image formats are also supported: PNG, PNM, PAM, TGA, PBM, PKM.
+The following single page image formats are also supported: PNG, PNM, PAM, PBM, PKM.
Each page is written to a separate file.
<p>
diff --git a/docs/manual-mutool-draw.html b/docs/manual-mutool-draw.html
index 435c4b00..ac7c9f66 100644
--- a/docs/manual-mutool-draw.html
+++ b/docs/manual-mutool-draw.html
@@ -24,7 +24,7 @@ mutool draw [options] file [pages]
The supported input document formats are: pdf, xps, cbz, and epub.
<p>
-The supported output image formats are: pbm, pgm, ppm, pam, png, tga,
+The supported output image formats are: pbm, pgm, ppm, pam, png,
pwg, pcl and ps. The supported output vector formats are: svg, pdf,
and debug trace (as xml). The supported output text formats are: plain
text, html, and structured text (as xml).
diff --git a/include/mupdf/fitz.h b/include/mupdf/fitz.h
index 9f697c8a..d7c73577 100644
--- a/include/mupdf/fitz.h
+++ b/include/mupdf/fitz.h
@@ -69,7 +69,6 @@ extern "C" {
#include "mupdf/fitz/output-ps.h"
#include "mupdf/fitz/output-psd.h"
#include "mupdf/fitz/output-svg.h"
-#include "mupdf/fitz/output-tga.h"
#ifdef __cplusplus
}
diff --git a/include/mupdf/fitz/output-tga.h b/include/mupdf/fitz/output-tga.h
deleted file mode 100644
index e481b09e..00000000
--- a/include/mupdf/fitz/output-tga.h
+++ /dev/null
@@ -1,36 +0,0 @@
-#ifndef MUPDF_FITZ_OUTPUT_TGA_H
-#define MUPDF_FITZ_OUTPUT_TGA_H
-
-#include "mupdf/fitz/system.h"
-#include "mupdf/fitz/context.h"
-#include "mupdf/fitz/output.h"
-#include "mupdf/fitz/band-writer.h"
-#include "mupdf/fitz/pixmap.h"
-
-/*
- fz_save_pixmap_as_tga: Save a pixmap as a TGA image file.
- Can accept RGB, BGR or Grayscale pixmaps, with or without
- alpha.
-*/
-void fz_save_pixmap_as_tga(fz_context *ctx, fz_pixmap *pixmap, const char *filename);
-
-/*
- Write a pixmap to an output stream in TGA format.
- Can accept RGB, BGR or Grayscale pixmaps, with or without
- alpha.
-*/
-void fz_write_pixmap_as_tga(fz_context *ctx, fz_output *out, fz_pixmap *pixmap);
-
-/*
- fz_new_tga_band_writer: Generate a new band writer for TGA
- format images. Note that image must be generated vertically
- flipped for use with this writer!
-
- Can accept RGB, BGR or Grayscale pixmaps, with or without
- alpha.
-
- is_bgr: True, if the image is generated in bgr format.
-*/
-fz_band_writer *fz_new_tga_band_writer(fz_context *ctx, fz_output *out, int is_bgr);
-
-#endif
diff --git a/include/mupdf/fitz/writer.h b/include/mupdf/fitz/writer.h
index 6850d06d..b0af0688 100644
--- a/include/mupdf/fitz/writer.h
+++ b/include/mupdf/fitz/writer.h
@@ -85,7 +85,7 @@ int fz_option_eq(const char *a, const char *b);
path: The document name to write (or NULL for default)
format: Which format to write (currently cbz, html, pdf, pam, pbm,
- pgm, pkm, png, ppm, pnm, svg, text, tga, xhtml)
+ pgm, pkm, png, ppm, pnm, svg, text, xhtml)
options: NULL, or pointer to comma separated string to control
file generation.
@@ -103,7 +103,6 @@ fz_document_writer *fz_new_pwg_writer(fz_context *ctx, const char *path, const c
fz_document_writer *fz_new_cbz_writer(fz_context *ctx, const char *path, const char *options);
fz_document_writer *fz_new_png_pixmap_writer(fz_context *ctx, const char *path, const char *options);
-fz_document_writer *fz_new_tga_pixmap_writer(fz_context *ctx, const char *path, const char *options);
fz_document_writer *fz_new_pam_pixmap_writer(fz_context *ctx, const char *path, const char *options);
fz_document_writer *fz_new_pnm_pixmap_writer(fz_context *ctx, const char *path, const char *options);
fz_document_writer *fz_new_pgm_pixmap_writer(fz_context *ctx, const char *path, const char *options);
diff --git a/platform/win32/libmupdf.vcproj b/platform/win32/libmupdf.vcproj
index ebef2db0..fc317e21 100644
--- a/platform/win32/libmupdf.vcproj
+++ b/platform/win32/libmupdf.vcproj
@@ -2096,10 +2096,6 @@
>
</File>
<File
- RelativePath="..\..\source\fitz\output-tga.c"
- >
- </File>
- <File
RelativePath="..\..\source\fitz\output.c"
>
</File>
@@ -2683,10 +2679,6 @@
>
</File>
<File
- RelativePath="..\..\include\mupdf\fitz\output-tga.h"
- >
- </File>
- <File
RelativePath="..\..\include\mupdf\fitz\output.h"
>
</File>
diff --git a/source/fitz/output-tga.c b/source/fitz/output-tga.c
deleted file mode 100644
index 51ebe5db..00000000
--- a/source/fitz/output-tga.c
+++ /dev/null
@@ -1,169 +0,0 @@
-#include "mupdf/fitz.h"
-
-#include <string.h>
-
-/*
- * Write pixmap to TGA file (with or without alpha channel)
- */
-
-typedef struct {
- fz_band_writer super;
- int is_bgr;
-} tga_band_writer;
-
-static inline void tga_put_pixel(fz_context *ctx, fz_output *out, const unsigned char *data, int n, int is_bgr)
-{
- int a, inva;
- switch(n)
- {
- case 4: /* RGBA or BGRA */
- a = data[3];
- inva = a ? 256 * 255 / a : 0;
- if (!is_bgr) {
- fz_write_byte(ctx, out, (data[2] * inva + 128)>>8);
- fz_write_byte(ctx, out, (data[1] * inva + 128)>>8);
- fz_write_byte(ctx, out, (data[0] * inva + 128)>>8);
- } else {
- fz_write_byte(ctx, out, (data[0] * inva + 128)>>8);
- fz_write_byte(ctx, out, (data[1] * inva + 128)>>8);
- fz_write_byte(ctx, out, (data[2] * inva + 128)>>8);
- }
- fz_write_byte(ctx, out, a);
- break;
- case 3: /* RGB or BGR */
- if (!is_bgr) {
- fz_write_byte(ctx, out, data[2]);
- fz_write_byte(ctx, out, data[1]);
- fz_write_byte(ctx, out, data[0]);
- } else {
- fz_write_byte(ctx, out, data[0]);
- fz_write_byte(ctx, out, data[1]);
- fz_write_byte(ctx, out, data[2]);
- }
- break;
- case 2: /* GA */
- a = data[1];
- inva = a ? 256 * 255 / a : 0;
- inva = (data[0] * inva + 128)>>8;
- fz_write_byte(ctx, out, inva);
- fz_write_byte(ctx, out, inva);
- fz_write_byte(ctx, out, inva);
- fz_write_byte(ctx, out, a);
- break;
- case 1: /* G */
- fz_write_byte(ctx, out, data[0]);
- break;
- }
-}
-
-void
-fz_save_pixmap_as_tga(fz_context *ctx, fz_pixmap *pixmap, const char *filename)
-{
- fz_output *out = fz_new_output_with_path(ctx, filename, 0);
- fz_try(ctx)
- {
- fz_write_pixmap_as_tga(ctx, out, pixmap);
- fz_close_output(ctx, out);
- }
- fz_always(ctx)
- fz_drop_output(ctx, out);
- fz_catch(ctx)
- fz_rethrow(ctx);
-}
-
-void
-fz_write_pixmap_as_tga(fz_context *ctx, fz_output *out, fz_pixmap *pixmap)
-{
- fz_band_writer *writer = fz_new_tga_band_writer(ctx, out, fz_colorspace_is_bgr(ctx, pixmap->colorspace));
- fz_try(ctx)
- {
- fz_write_header(ctx, writer, pixmap->w, pixmap->h, pixmap->n, pixmap->alpha, pixmap->xres, pixmap->yres, 0, pixmap->colorspace, pixmap->seps);
- fz_write_band(ctx, writer, -pixmap->stride, pixmap->h, pixmap->samples + pixmap->stride * (pixmap->h-1));
- }
- fz_always(ctx)
- fz_drop_band_writer(ctx, writer);
- fz_catch(ctx)
- fz_rethrow(ctx);
-}
-
-static void
-tga_write_header(fz_context *ctx, fz_band_writer *writer_, const fz_colorspace *cs)
-{
- tga_band_writer *writer = (tga_band_writer *)writer_;
- fz_output *out = writer->super.out;
- int w = writer->super.w;
- int h = writer->super.h;
- int n = writer->super.n;
- int alpha = writer->super.alpha;
- unsigned char head[18];
- int d = (alpha && n > 1) ? 4 : (n == 1 ? 1 : 3);
-
- if (writer->super.s != 0)
- fz_throw(ctx, FZ_ERROR_GENERIC, "TGA writer cannot cope with spot colors");
- if (n-alpha > 1 && n != 3+alpha)
- fz_throw(ctx, FZ_ERROR_GENERIC, "pixmap must be grayscale/rgb/rgba (with or without alpha) to write as tga");
- memset(head, 0, sizeof(head));
- head[2] = n > 1 ? 10 /* RGB or RGBA or GA */ : 11 /* G */;
- head[12] = w & 0xFF; head[13] = (w >> 8) & 0xFF;
- head[14] = h & 0xFF; head[15] = (h >> 8) & 0xFF;
- head[16] = d * 8; /* BPP */
- head[17] = alpha && n > 1 ? 8 : 0; /* Alpha bpp */
-
- fz_write_data(ctx, out, head, sizeof(head));
-}
-
-static void
-tga_write_band(fz_context *ctx, fz_band_writer *writer_, int stride, int band_start, int band_height, const unsigned char *samples)
-{
- tga_band_writer *writer = (tga_band_writer *)writer_;
- fz_output *out = writer->super.out;
- int w = writer->super.w;
- int n = writer->super.n;
- int d = (writer->super.alpha && n > 1) ? 4 : (n == 1 ? 1 : 3);
- int is_bgr = writer->is_bgr;
- int k;
-
- for (k = 0; k < band_height; k++)
- {
- int i, j;
- const unsigned char *line = samples + stride * k;
- for (i = 0, j = 1; i < w; i += j, j = 1)
- {
- for (; i + j < w && j < 128 && !memcmp(line + i * n, line + (i + j) * n, d); j++);
- if (j > 1)
- {
- fz_write_byte(ctx, out, j - 1 + 128);
- tga_put_pixel(ctx, out, line + i * n, n, is_bgr);
- }
- else
- {
- for (; i + j < w && j <= 128 && memcmp(line + (i + j - 1) * n, line + (i + j) * n, d) != 0; j++);
- if (i + j < w || j > 128)
- j--;
- fz_write_byte(ctx, out, j - 1);
- for (; j > 0; j--, i++)
- tga_put_pixel(ctx, out, line + i * n, n, is_bgr);
- }
- }
- }
-}
-
-static void
-tga_write_trailer(fz_context *ctx, fz_band_writer *writer)
-{
- fz_output *out = writer->out;
-
- fz_write_data(ctx, out, "\0\0\0\0\0\0\0\0TRUEVISION-XFILE.\0", 26);
-}
-
-fz_band_writer *fz_new_tga_band_writer(fz_context *ctx, fz_output *out, int is_bgr)
-{
- tga_band_writer *writer = fz_new_band_writer(ctx, tga_band_writer, out);
-
- writer->super.header = tga_write_header;
- writer->super.band = tga_write_band;
- writer->super.trailer = tga_write_trailer;
- writer->is_bgr = is_bgr;
-
- return &writer->super;
-}
diff --git a/source/fitz/writer.c b/source/fitz/writer.c
index ada07089..77512f6a 100644
--- a/source/fitz/writer.c
+++ b/source/fitz/writer.c
@@ -68,11 +68,6 @@ fz_document_writer *fz_new_png_pixmap_writer(fz_context *ctx, const char *path,
return fz_new_pixmap_writer(ctx, path, options, "out-%04d.png", 0, fz_save_pixmap_as_png);
}
-fz_document_writer *fz_new_tga_pixmap_writer(fz_context *ctx, const char *path, const char *options)
-{
- return fz_new_pixmap_writer(ctx, path, options, "out-%04d.tga", 0, fz_save_pixmap_as_tga);
-}
-
fz_document_writer *fz_new_pam_pixmap_writer(fz_context *ctx, const char *path, const char *options)
{
return fz_new_pixmap_writer(ctx, path, options, "out-%04d.pam", 0, fz_save_pixmap_as_pam);
@@ -125,8 +120,6 @@ fz_new_document_writer(fz_context *ctx, const char *path, const char *format, co
if (!fz_strcasecmp(format, "png"))
return fz_new_png_pixmap_writer(ctx, path, options);
- if (!fz_strcasecmp(format, "tga"))
- return fz_new_tga_pixmap_writer(ctx, path, options);
if (!fz_strcasecmp(format, "pam"))
return fz_new_pam_pixmap_writer(ctx, path, options);
if (!fz_strcasecmp(format, "pnm"))
diff --git a/source/tools/muconvert.c b/source/tools/muconvert.c
index 04faed8c..c6fca7c1 100644
--- a/source/tools/muconvert.c
+++ b/source/tools/muconvert.c
@@ -42,7 +42,7 @@ static void usage(void)
"\n"
"\t-o -\toutput file name (%%d for page number)\n"
"\t-F -\toutput format (default inferred from output file name)\n"
- "\t\t\traster: cbz, png, pnm, pgm, ppm, pam, tga, pbm, pkm.\n"
+ "\t\t\traster: cbz, png, pnm, pgm, ppm, pam, pbm, pkm.\n"
"\t\t\tprint-raster: pcl, pclm, ps, pwg.\n"
"\t\t\tvector: pdf, svg.\n"
"\t\t\ttext: html, xhtml, text, stext.\n"
diff --git a/source/tools/mudraw.c b/source/tools/mudraw.c
index 5a78ae8d..30c8a545 100644
--- a/source/tools/mudraw.c
+++ b/source/tools/mudraw.c
@@ -35,7 +35,7 @@ int gettimeofday(struct timeval *tv, struct timezone *tz);
enum {
OUT_NONE,
- OUT_PNG, OUT_TGA, OUT_PNM, OUT_PGM, OUT_PPM, OUT_PAM,
+ OUT_PNG, OUT_PNM, OUT_PGM, OUT_PPM, OUT_PAM,
OUT_PBM, OUT_PKM, OUT_PWG, OUT_PCL, OUT_PS, OUT_PSD,
OUT_TEXT, OUT_HTML, OUT_XHTML, OUT_STEXT, OUT_PCLM,
OUT_TRACE, OUT_SVG,
@@ -74,7 +74,6 @@ static const suffix_t suffix_table[] =
#endif
{ ".psd", OUT_PSD, 1 },
{ ".ps", OUT_PS, 0 },
- { ".tga", OUT_TGA, 0 },
{ ".txt", OUT_TEXT, 0 },
{ ".text", OUT_TEXT, 0 },
@@ -131,7 +130,6 @@ static const format_cs_table_t format_cs_table[] =
{ OUT_PCLM, CS_RGB, { CS_RGB, CS_GRAY } },
{ OUT_PS, CS_RGB, { CS_GRAY, CS_RGB, CS_CMYK } },
{ OUT_PSD, CS_CMYK, { CS_GRAY, CS_GRAY_ALPHA, CS_RGB, CS_RGB_ALPHA, CS_CMYK, CS_CMYK_ALPHA, CS_ICC } },
- { OUT_TGA, CS_RGB, { CS_GRAY, CS_GRAY_ALPHA, CS_RGB, CS_RGB_ALPHA } },
{ OUT_TRACE, CS_RGB, { CS_RGB } },
{ OUT_SVG, CS_RGB, { CS_RGB } },
@@ -318,7 +316,7 @@ static void usage(void)
"\n"
"\t-o -\toutput file name (%%d for page number)\n"
"\t-F -\toutput format (default inferred from output file name)\n"
- "\t\traster: png, tga, pnm, pam, pbm, pkm, pwg, pcl, ps\n"
+ "\t\traster: png, pnm, pam, pbm, pkm, pwg, pcl, ps\n"
"\t\tvector: svg, pdf, trace\n"
"\t\ttext: txt, html, stext\n"
"\n"
@@ -723,11 +721,6 @@ static void dodrawpage(fz_context *ctx, fz_page *page, fz_display_list *list, in
zoom = resolution / 72;
ctm = fz_pre_scale(fz_rotate(rotation), zoom, zoom);
- if (output_format == OUT_TGA)
- {
- ctm = fz_pre_scale(fz_pre_translate(ctm, 0, -height), 1, -1);
- }
-
tbounds = fz_transform_rect(mediabox, ctm);
ibounds = fz_round_rect(tbounds);
@@ -844,8 +837,6 @@ static void dodrawpage(fz_context *ctx, fz_page *page, fz_display_list *list, in
bander = fz_new_ps_band_writer(ctx, out);
else if (output_format == OUT_PSD)
bander = fz_new_psd_band_writer(ctx, out);
- else if (output_format == OUT_TGA)
- bander = fz_new_tga_band_writer(ctx, out, fz_colorspace_is_bgr(ctx, colorspace));
else if (output_format == OUT_PWG)
{
if (out_cs == CS_MONO)
@@ -1710,9 +1701,9 @@ int mudraw_main(int argc, char **argv)
if (band_height)
{
- if (output_format != OUT_PAM && output_format != OUT_PGM && output_format != OUT_PPM && output_format != OUT_PNM && output_format != OUT_PNG && output_format != OUT_PBM && output_format != OUT_PKM && output_format != OUT_PCL && output_format != OUT_PCLM && output_format != OUT_PS && output_format != OUT_PSD && output_format != OUT_TGA)
+ if (output_format != OUT_PAM && output_format != OUT_PGM && output_format != OUT_PPM && output_format != OUT_PNM && output_format != OUT_PNG && output_format != OUT_PBM && output_format != OUT_PKM && output_format != OUT_PCL && output_format != OUT_PCLM && output_format != OUT_PS && output_format != OUT_PSD)
{
- fprintf(stderr, "Banded operation only possible with PxM, PCL, PCLM, PS, PSD, PNG and TGA outputs\n");
+ fprintf(stderr, "Banded operation only possible with PxM, PCL, PCLM, PS, PSD, and PNG outputs\n");
exit(1);
}
if (showmd5)
diff --git a/source/tools/murun.c b/source/tools/murun.c
index d122ce51..90fc77ea 100644
--- a/source/tools/murun.c
+++ b/source/tools/murun.c
@@ -4731,7 +4731,7 @@ int murun_main(int argc, char **argv)
// Pixmap.scale()
jsB_propfun(J, "Pixmap.saveAsPNG", ffi_Pixmap_saveAsPNG, 1);
- // Pixmap.saveAsPNM, PAM, TGA, PWG, PCL
+ // Pixmap.saveAsPNM, PAM, PWG, PCL
// Pixmap.halftone() -> Bitmap
// Pixmap.md5()