summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorSebastian Rasmussen <sebras@hotmail.com>2009-05-23 02:18:04 +0200
committerSebastian Rasmussen <sebras@hotmail.com>2009-05-23 02:18:04 +0200
commitcaf5337c01bed9561ab1533c6c762df2031db313 (patch)
treea8fc7427ee2825df47f87e156255b965885009dc /apps
parentda6f61c67c5c591f805a6a933ff7ce03c85563e7 (diff)
downloadmupdf-caf5337c01bed9561ab1533c6c762df2031db313.tar.xz
Removed dumping of images from pdfshow.
Diffstat (limited to 'apps')
-rw-r--r--apps/pdfshow.c138
1 files changed, 1 insertions, 137 deletions
diff --git a/apps/pdfshow.c b/apps/pdfshow.c
index 280ef8f7..ba12ba09 100644
--- a/apps/pdfshow.c
+++ b/apps/pdfshow.c
@@ -151,137 +151,6 @@ void showstream(int num, int gen)
fz_dropstream(stm);
}
-int isimage(fz_obj *obj)
-{
- fz_obj *type = fz_dictgets(obj, "Subtype");
- return fz_isname(type) && !strcmp(fz_toname(type), "Image");
-}
-
-void showimage(fz_obj *img)
-{
- fz_error error;
- fz_obj *obj;
- int mask = 0;
- char *cs = "";
- int bpc;
- int w;
- int h;
- int n;
-
- obj = fz_dictgets(img, "BitsPerComponent");
- if (!obj)
- die(fz_throw("No bits per component"));
- error = pdf_resolve(&obj, xref);
- if (error)
- die(error);
- bpc = fz_toint(obj);
-
- obj = fz_dictgets(img, "Width");
- if (!obj)
- die(fz_throw("No width"));
- error = pdf_resolve(&obj, xref);
- if (error)
- die(error);
- w = fz_toint(obj);
-
- obj = fz_dictgets(img, "Height");
- if (!obj)
- die(fz_throw("No height"));
- error = pdf_resolve(&obj, xref);
- if (error)
- die(error);
- h = fz_toint(obj);
-
- obj = fz_dictgets(img, "ImageMask");
- if (obj)
- {
- error = pdf_resolve(&obj, xref);
- if (error)
- die(error);
- mask = fz_tobool(obj);
- }
-
- obj = fz_dictgets(img, "ColorSpace");
- if (!mask && !obj)
- die(fz_throw("No colorspace"));
- if (obj)
- {
- error = pdf_resolve(&obj, xref);
- if (error)
- die(error);
- if (fz_isname(obj))
- {
- cs = fz_toname(obj);
-
- if (!strcmp(cs, "DeviceGray"))
- n = 1;
- else if (!strcmp(cs, "DeviceRGB"))
- n = 3;
- }
- else if (fz_isarray(obj))
- {
- fz_obj *csarray = obj;
-
- obj = fz_arrayget(csarray, 0);
- if (!obj)
- die(fz_throw("No colorspace"));
- error = pdf_resolve(&obj, xref);
- if (error)
- die(error);
- if (!fz_isname(obj))
- die(fz_throw("Not a colorspace name"));
- cs = fz_toname(obj);
-
- if (!strcmp(cs, "ICCBased"))
- {
- obj = fz_arrayget(csarray, 1);
- if (!obj)
- die(fz_throw("No colorspace dict"));
- error = pdf_resolve(&obj, xref);
- if (error)
- die(error);
- if (!fz_isdict(obj))
- die(fz_throw("Not a colorspace dict"));
-
- obj = fz_dictgets(obj, "N");
- if (!obj)
- die(fz_throw("No number of components"));
- error = pdf_resolve(&obj, xref);
- if (error)
- die(error);
- if (!fz_isint(obj))
- die(fz_throw("Not a number of components"));
- n = fz_toint(obj);
- }
- else if (!strcmp(cs, "CalGray"))
- {
- n = 1;
- }
- else if (!strcmp(cs, "CalRGB"))
- {
- n = 3;
- }
- }
- }
-
- if (!mask)
- {
- if (n == 1 && bpc == 1)
- printf("P4\n%d %d\n", w, h);
- else if (n == 1 && bpc == 8)
- printf("P5\n%d %d\n%d\n", w, h, (1 << bpc) - 1);
- else if (n == 3)
- printf("P6\n%d %d\n%d\n", w, h, (1 << bpc) - 1);
- }
- else
- {
- if (bpc == 1)
- printf("P4\n%d %d\n", w, h);
- else if (bpc == 8)
- printf("P5\n%d %d\n%d\n", w, h, (1 << bpc) - 1);
- }
-}
-
void showobject(int num, int gen)
{
fz_error error;
@@ -294,12 +163,7 @@ void showobject(int num, int gen)
if (error)
die(error);
- if (showbinary && showdecode && isimage(obj))
- {
- showimage(obj);
- showstream(num, gen);
- }
- else if (pdf_isstream(xref, num, gen))
+ if (pdf_isstream(xref, num, gen))
{
printf("%d %d obj\n", num, gen);
fz_debugobj(obj);