diff options
-rw-r--r-- | demos/c/api_test.c | 80 | ||||
-rw-r--r-- | examples/spots.ps | 17 | ||||
-rw-r--r-- | examples/spots2.pdf | 146 |
3 files changed, 216 insertions, 27 deletions
diff --git a/demos/c/api_test.c b/demos/c/api_test.c index 2768c6bf3..6560cb79c 100644 --- a/demos/c/api_test.c +++ b/demos/c/api_test.c @@ -1,3 +1,18 @@ +/* Copyright (C) 2001-2023 Artifex Software, Inc. + All Rights Reserved. + + This software is provided AS-IS with no warranty, either express or + implied. + + This software is distributed under license and may not be copied, + modified or distributed except as expressly authorized under the terms + of the license contained in the file LICENSE in this distribution. + + Refer to licensing information at http://www.artifex.com or contact + Artifex Software, Inc., 1305 Grant Avenue - Suite 200, Novato, + CA 94945, U.S.A., +1(415)492-9861, for further information. +*/ + #ifdef _WIN32 /* Stop windows builds complaining about sprintf being insecure. */ #define _CRT_SECURE_NO_WARNINGS @@ -151,6 +166,7 @@ static FILE *save_header(teststate_t *ts) ts->legacy ? "_l" : "", align_str, suffix); + printf("Outputting %s\n", text); ts->file = fopen(text, "wb"); if (ts->file == NULL) { fprintf(stderr, "Fatal error: couldn't open %s for writing.\n", text); @@ -494,7 +510,7 @@ adjust_band_height(void *handle, void *device, int bandheight) teststate_t *ts = (teststate_t *)handle; SANITY_CHECK(ts); - printf("adjust_band_height: %d - >", bandheight); + printf("adjust_band_height: %d -> ", bandheight); if (bandheight > ts->h / 4) bandheight = ts->h / 4; @@ -644,6 +660,7 @@ callout(void *instance, /* This is the function that actually runs a test. */ static int do_ddtest(const char *title, int format, int use_clist, int legacy, + int ps, const char *fname) { int code; @@ -659,7 +676,7 @@ static int do_ddtest(const char *title, int format, /* Construct the argc/argv to pass to ghostscript. */ int argc = 0; - char *argv[10]; + char *argv[20]; argv[argc++] = "gs"; argv[argc++] = "-sDEVICE=display"; @@ -667,9 +684,19 @@ static int do_ddtest(const char *title, int format, argv[argc++] = format_arg; if (legacy) argv[argc++] = handle_arg; - if (format & DISPLAY_COLORS_SEPARATION) - argv[argc++] = "../../examples/spots.ps"; - else + if (format & DISPLAY_COLORS_SEPARATION) { + /* Two different spots test files. The PS one + * uses 4 process colors + 4 spots, the + * PDF one uses 4 process colors + 3 spots. + * Chunky mode can't use more than 8 in total, + * and we want to test the behaviour of the + * system with an 'odd' number of spots. + */ + if (ps) + argv[argc++] = "../../examples/spots.ps"; + else + argv[argc++] = "../../examples/spots2.pdf"; + } else argv[argc++] = "../../examples/tiger.eps"; sprintf(format_arg, "-dDisplayFormat=16#%x", format); @@ -777,7 +804,7 @@ failearly: return code; } -static int displaydev_test(const char *title, int format, const char *fname) +static int displaydev_test(const char *title, int format, int ps, const char *fname) { int use_clist, legacy, align, code; @@ -789,7 +816,7 @@ static int displaydev_test(const char *title, int format, const char *fname) if (align != 2) { form |= align<<20; } - code = do_ddtest(title, form, use_clist, legacy, fname); + code = do_ddtest(title, form, use_clist, legacy, ps, fname); if (code < 0) return code; } @@ -1153,26 +1180,29 @@ int main(int argc, char *argv[]) NULL)); #endif -#define DD(STR, FMT, FILE)\ - RUNTEST(displaydev_test(STR, FMT, FILE)) +#define DD(STR, FMT, PS, FILE)\ + RUNTEST(displaydev_test(STR, FMT, PS, FILE)) /* Run a variety of tests for the display device. */ - DD("Chunky Windows Gray", 0x030802, "apitest0"); - DD("Chunky Windows RGB", 0x030804, "apitest1"); - /* Display device does no support "little endian" CMYK */ - DD("Chunky Windows CMYK", 0x020808, "apitest2"); - - DD("Planar Windows Gray", 0x830802, "apitest3"); - DD("Planar Windows RGB", 0x830804, "apitest4"); - DD("Planar Windows CMYK", 0x820808, "apitest5"); - - DD("Planar Interleaved Windows Gray", 0x1030802, "apitest6"); - DD("Planar Interleaved Windows RGB", 0x1030804, "apitest7"); - DD("Planar Interleaved Windows CMYK", 0x1020808, "apitest8"); - - DD("Chunky Spots", 0x0A0800, "apitest9"); - DD("Planar Spots", 0x8A0800, "apitest10"); - DD("Planar Interleaved Spots", 0x10A0800, "apitest11"); + DD("Chunky Windows Gray", 0x030802, 0, "apitest0"); + DD("Chunky Windows RGB", 0x030804, 0, "apitest1"); + /* Display device does not support "little endian" CMYK */ + DD("Chunky Windows CMYK", 0x020808, 0, "apitest2"); + + DD("Planar Windows Gray", 0x830802, 0, "apitest3"); + DD("Planar Windows RGB", 0x830804, 0, "apitest4"); + DD("Planar Windows CMYK", 0x820808, 0, "apitest5"); + + DD("Planar Interleaved Windows Gray", 0x1030802, 0, "apitest6"); + DD("Planar Interleaved Windows RGB", 0x1030804, 0, "apitest7"); + DD("Planar Interleaved Windows CMYK", 0x1020808, 0, "apitest8"); + + DD("Chunky Spots (PS)", 0x0A0800, 1, "apitest9"); + DD("Planar Spots (PS)", 0x8A0800, 1, "apitest10"); + DD("Planar Interleaved Spots (PS)", 0x10A0800, 1, "apitest11"); + DD("Chunky Spots (PDF)", 0x0A0800, 0, "apitest12"); + DD("Planar Spots (PDF)", 0x8A0800, 0, "apitest13"); + DD("Planar Interleaved Spots", 0x10A0800, 0, "apitest14"); return 0; } diff --git a/examples/spots.ps b/examples/spots.ps index bef300047..4df2ffa43 100644 --- a/examples/spots.ps +++ b/examples/spots.ps @@ -1,4 +1,17 @@ -%! +% Copyright (C) 2001-2023 Artifex Software, Inc. +% All Rights Reserved. +% +% This software is provided AS-IS with no warranty, either express or +% implied. +% +% This software is distributed under license and may not be copied, +% modified or distributed except as expressly authorized under the terms +% of the license contained in the file LICENSE in this distribution. +% +% Refer to licensing information at http://www.artifex.com or contact +% Artifex Software, Inc., 1305 Grant Avenue - Suite 200, Novato, +% CA 94945, U.S.A., +1(415)492-9861, for further information. +% % Cyan 1 0 0 0 setcmykcolor @@ -16,7 +29,7 @@ 0 0 1 0 setcmykcolor 100 0 50 50 rectfill 0 0 .5 0 setcmykcolor -100 0 50 50 rectfill +100 50 50 50 rectfill % Black 0 0 0 1 setcmykcolor diff --git a/examples/spots2.pdf b/examples/spots2.pdf new file mode 100644 index 000000000..d3f235eae --- /dev/null +++ b/examples/spots2.pdf @@ -0,0 +1,146 @@ +%PDF-1.7 +%쏢 +%%Invocation: path/gswin64c.exe -dDisplayFormat=13109248 -dDisplayResolution=96 ? ? -sDEVICE=pdfwrite ? +5 0 obj +<</Length 6 0 R/Filter /FlateDecode>> +stream +x}Q + @wu)BT=qGIn9;qL(cd2*`#6{`2u
(7})n?_O3|t|,ylL49
pd^endstream +endobj +6 0 obj +130 +endobj +4 0 obj +<</Type/Page/MediaBox [0 0 612 792] +/Parent 3 0 R +/Resources<</ProcSet[/PDF] +/ColorSpace 13 0 R +>> +/Contents 5 0 R +>> +endobj +3 0 obj +<< /Type /Pages /Kids [ +4 0 R +] /Count 1 +>> +endobj +1 0 obj +<</Type /Catalog /Pages 3 0 R +/Metadata 14 0 R +>> +endobj +8 0 obj +[/Separation +/MuddyCyan +/DeviceCMYK +7 0 R]endobj +10 0 obj +[/Separation +/MuddyMagenta +/DeviceCMYK +9 0 R]endobj +12 0 obj +[/Separation +/MuddyBlack +/DeviceCMYK +11 0 R]endobj +13 0 obj +<</R8 +8 0 R/R10 +10 0 R/R12 +12 0 R>> +endobj +11 0 obj +<</FunctionType 4 +/Domain[0 +1] +/Range[0 +1 +0 +1 +0 +1 +0 +1]/Length 29>>stream +{0.1 exch 0.1 exch 0.1 exch } +endstream +endobj +9 0 obj +<</FunctionType 4 +/Domain[0 +1] +/Range[0 +1 +0 +1 +0 +1 +0 +1]/Length 17>>stream +{0.1 exch 0.1 0 } +endstream +endobj +7 0 obj +<</FunctionType 4 +/Domain[0 +1] +/Range[0 +1 +0 +1 +0 +1 +0 +1]/Length 12>>stream +{0.1 0.1 0 } +endstream +endobj +14 0 obj +<</Type/Metadata +/Subtype/XML/Length 1188>>stream +<?xpacket begin='' id='W5M0MpCehiHzreSzNTczkc9d'?> +<?adobe-xap-filters esc="CRLF"?> +<x:xmpmeta xmlns:x='adobe:ns:meta/' x:xmptk='XMP toolkit 2.9.1-13, framework 1.6'> +<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#' xmlns:iX='http://ns.adobe.com/iX/1.0/'> +<rdf:Description rdf:about="" xmlns:pdf='http://ns.adobe.com/pdf/1.3/' pdf:Producer='GPL Ghostscript GIT PRERELEASE 10.01.0'/> +<rdf:Description rdf:about="" xmlns:xmp='http://ns.adobe.com/xap/1.0/'><xmp:ModifyDate>2023-02-22T12:31:40Z</xmp:ModifyDate> +<xmp:CreateDate>2023-02-22T12:31:40Z</xmp:CreateDate> +<xmp:CreatorTool>UnknownApplication</xmp:CreatorTool></rdf:Description> +<rdf:Description rdf:about="" xmlns:xapMM='http://ns.adobe.com/xap/1.0/mm/' xapMM:DocumentID='uuid:5b3f9f03-b508-11ed-0000-14de31ada30d'/> +<rdf:Description rdf:about="" xmlns:dc='http://purl.org/dc/elements/1.1/' dc:format='application/pdf'><dc:title><rdf:Alt><rdf:li xml:lang='x-default'>Untitled</rdf:li></rdf:Alt></dc:title></rdf:Description> +</rdf:RDF> +</x:xmpmeta> + + +<?xpacket end='w'?> +endstream +endobj +2 0 obj +<</Producer(GPL Ghostscript GIT PRERELEASE 10.01.0) +/CreationDate(D:20230222123140Z00'00') +/ModDate(D:20230222123140Z00'00')>>endobj +xref +0 15 +0000000000 65535 f +0000000530 00000 n +0000002446 00000 n +0000000471 00000 n +0000000338 00000 n +0000000119 00000 n +0000000319 00000 n +0000001070 00000 n +0000000595 00000 n +0000000954 00000 n +0000000652 00000 n +0000000825 00000 n +0000000713 00000 n +0000000773 00000 n +0000001181 00000 n +trailer +<< /Size 15 /Root 1 0 R /Info 2 0 R +/ID [<273DA2886EA4B9DF71AB7821FB8A4C51><273DA2886EA4B9DF71AB7821FB8A4C51>] +>> +startxref +2587 +%%EOF |