summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad Hards <bradh@kde.org>2007-11-28 21:54:37 +1100
committerBrad Hards <bradh@kde.org>2007-11-28 21:54:37 +1100
commit9a5121d5a240be956ddbf645c9c7125b69cd1f83 (patch)
treef335bd01e46716104b2f8eca690fece840cc051f
parentf6edbe53fb44ccb65d2b5070c2380319276e8ce1 (diff)
parent81d68365771254bd1da25f097d41a9c45f9b3285 (diff)
Merge branch 'master' of ssh://bradh@git.freedesktop.org/git/poppler/test
-rw-r--r--Makefile3
-rwxr-xr-xtest-gen/blend.pl83
-rw-r--r--tests/blend.pdfbin0 -> 116426 bytes
3 files changed, 85 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 60f49de..466c2ff 100644
--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,8 @@ CFLAGS = $(shell pkg-config --cflags poppler-glib pango gdk-2.0) -g -Wall -O2
LDLIBS = $(shell pkg-config --libs poppler-glib) -lssl -lpng
PDFNAMES = mask.pdf text.pdf image.pdf type3.pdf cropbox.pdf \
inline-image.pdf degenerate-path.pdf mask-seams.pdf \
- zero-width.pdf encoding.pdf jpeg.pdf fonts.pdf
+ zero-width.pdf encoding.pdf jpeg.pdf fonts.pdf \
+ blend.pdf
PDFS = $(addprefix tests/, $(PDFNAMES))
diff --git a/test-gen/blend.pl b/test-gen/blend.pl
new file mode 100755
index 0000000..e884a69
--- /dev/null
+++ b/test-gen/blend.pl
@@ -0,0 +1,83 @@
+#!/usr/bin/perl
+
+use Text::PDF::File;
+use Text::PDF::Page; # pulls in Pages
+use Text::PDF::Utils; # not strictly needed
+use Text::PDF::SFont;
+do "image.inc";
+$pdf = Text::PDF::File->new; # Make up a new document
+$root = Text::PDF::Pages->new($pdf); # Make a page tree in the document
+$root->proc_set("PDF", "Text"); # Say that all pages have PDF and Text instructions
+$root->bbox(0, 0, 595, 840); # hardwired page size A4 (for this app.) for all pages
+$page = Text::PDF::Page->new($pdf, $root); # Make a new page in the tree
+
+my ($w,$h,$bpc,$cs,$img)=parseImage('romedalen.ppm');
+my $key='IMG1';
+$xo=PDFDict();
+$xo->{'Type'}=PDFName('XObject');
+$xo->{'Subtype'}=PDFName('Image');
+$xo->{'Name'}=PDFName($key);
+$xo->{'Width'}=PDFNum($w);
+$xo->{'Height'}=PDFNum($h);
+$xo->{'Filter'}=PDFArray(PDFName('FlateDecode'));
+$xo->{'BitsPerComponent'}=PDFNum($bpc);
+$xo->{'ColorSpace'}=PDFName($cs);
+$xo->{' stream'}=$img;
+$pdf->new_obj($xo);
+$root->{'Resources'}->{'XObject'}=PDFDict();
+$root->{'Resources'}->{'XObject'}->{$key}=$xo;
+$root->{'Resources'}->{'ExtGState'}=PDFDict();
+
+@modes=('Normal', 'Multiply', 'Screen', 'Overlay', 'Darken', 'Lighten', 'ColorDodge', 'ColorBurn', 'HardLight',
+ 'SoftLight', 'Difference', 'Exclusion','Hue','Saturation','Color','Luminocity' );
+$state_count = 0;
+@gstates=();
+foreach $mode (@modes) {
+ $td=PDFDict();
+ $td->{'ca'}=PDFNum(0.7);
+ $td->{'CA'}=PDFNum(1.0);
+ $td->{'BM'}=PDFName($mode);
+ $td->{'Type'}=PDFName('ExtGState');
+ $td->{'OPM'}=PDFNum(1);
+ $td->{'AIS'}=PDFBool('false');
+ $td->{'SMask'}=PDFName('None');
+ $pdf->new_obj($td);
+ $gstate = "RE$state_count";
+ $state_count += 1;
+ push @gstates, $gstate;
+
+ $root->{'Resources'}->{'ExtGState'}->{$gstate}=$td;
+}
+$page->add("q\n"); #saveState
+$page->add("0.51373 0.54510 0.54510 rg\n");
+$page->add("0.0 0.4 0.4 RG\n");
+$page->add("40.0 w\n");
+$y = 150.0;
+for ($i=0; $i<3; $i++) {
+ $page->add("$y 0.0 m\n");
+ $page->add("$y 1000 l\n");
+ $y += 100.0;
+ $page->add("S\n");
+}
+
+$x = 100;
+$y = 100;
+$sx = $w/3;
+$sy = $h/3;
+
+foreach $gstate (@gstates) {
+ $page->add("q\n"); #saveState
+ $page->add("/$gstate gs\n");
+ $page->add(sprintf("%0.3f %0.3f %0.3f %0.3f %0.3f %0.3f cm\n", $sx,0,0,$sy,$x,$y));
+ $page->add("/$key Do\n");
+ $y += 100;
+ if ($y > 700) {
+ $x += 100;
+ $y = 100;
+ }
+ $page->add("Q\n"); #restoreState
+}
+$page->add("Q"); #restoreState
+$pdf->out_file($ARGV[0]); # output the document to a file
+
+# all done!
diff --git a/tests/blend.pdf b/tests/blend.pdf
new file mode 100644
index 0000000..2ca9bc1
--- /dev/null
+++ b/tests/blend.pdf
Binary files differ