summaryrefslogtreecommitdiff
path: root/fpdf_test.go
diff options
context:
space:
mode:
authorKurt Jung <kurt.w.jung@code.google.com>2013-08-13 18:28:16 -0400
committerKurt Jung <kurt.w.jung@code.google.com>2013-08-13 18:28:16 -0400
commitcb9b6b05fca2d3154237d94eae678b8c97a2604e (patch)
tree52d0b9e269fc51aac2fb8e12a1103db263c1a132 /fpdf_test.go
parent3d921b9e0ed6dd64b81b477017d1fc79d0e77e9a (diff)
Gradient support adapted from the FPDF gradients script by Andreas Würmser.
Diffstat (limited to 'fpdf_test.go')
-rw-r--r--fpdf_test.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/fpdf_test.go b/fpdf_test.go
index c121260..08dca43 100644
--- a/fpdf_test.go
+++ b/fpdf_test.go
@@ -721,3 +721,22 @@ func ExampleFpdf_tutorial12() {
// Output:
// Successfully generated pdf/tutorial12.pdf
}
+
+// Gradients
+func ExampleFpdf_tutorial13() {
+ pdf := New("", "", "", FONT_DIR)
+ pdf.SetFont("Helvetica", "", 12)
+ pdf.AddPage()
+ pdf.LinearGradient(0, 0, 210, 100, 250, 250, 255, 220, 220, 225, 0, 0, 0, .5)
+ pdf.LinearGradient(20, 25, 75, 75, 220, 220, 250, 80, 80, 220, 0, .2, 0, .8)
+ pdf.Rect(20, 25, 75, 75, "D")
+ pdf.LinearGradient(115, 25, 75, 75, 220, 220, 250, 80, 80, 220, 0, 0, 1, 1)
+ pdf.Rect(115, 25, 75, 75, "D")
+ pdf.RadialGradient(20, 120, 75, 75, 220, 220, 250, 80, 80, 220, 0.25, 0.75, 0.25, 0.75, 1)
+ pdf.Rect(20, 120, 75, 75, "D")
+ pdf.RadialGradient(115, 120, 75, 75, 220, 220, 250, 80, 80, 220, 0.25, 0.75, 0.75, 0.75, 0.75)
+ pdf.Rect(115, 120, 75, 75, "D")
+ pdf.OutputAndClose(docWriter(pdf, 13))
+ // Output:
+ // Successfully generated pdf/tutorial13.pdf
+}