summaryrefslogtreecommitdiff
path: root/fpdf_test.go
diff options
context:
space:
mode:
authorKurt Jung <kurt.w.jung@code.google.com>2013-08-13 11:41:22 -0400
committerKurt Jung <kurt.w.jung@code.google.com>2013-08-13 11:41:22 -0400
commit5d510c1aa2c794e82c114cf0adf540f6829886d7 (patch)
treeb003af7112a22e79ed4089999538d552b9cc4c95 /fpdf_test.go
parente77eb348899dca9a071f7c674cca4ea2bcc238c8 (diff)
Added support with example for transparency in a variety of blending modes.
This was adapted from the FPDF transparency script by Martin Hall-May.
Diffstat (limited to 'fpdf_test.go')
-rw-r--r--fpdf_test.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/fpdf_test.go b/fpdf_test.go
index 494d281..c121260 100644
--- a/fpdf_test.go
+++ b/fpdf_test.go
@@ -704,3 +704,20 @@ func ExampleFpdf_tutorial11() {
// Output:
// Successfully generated pdf/tutorial11.pdf
}
+
+// Transparency
+func ExampleFpdf_tutorial12() {
+ pdf := New("", "", "", FONT_DIR)
+ pdf.SetFont("Helvetica", "", 48)
+ pdf.SetLineWidth(4)
+ pdf.SetFillColor(180, 180, 180)
+ pdf.AddPage()
+ pdf.SetXY(55, 60)
+ pdf.CellFormat(100, 40, "Go", "1", 0, "C", true, 0, "")
+ pdf.SetAlpha(0.5, "Normal")
+ pdf.Image(IMG_DIR+"/golang-gopher.png", 30, 10, 150, 0, false, "", 0, "")
+ pdf.SetAlpha(1.0, "Normal")
+ pdf.OutputAndClose(docWriter(pdf, 12))
+ // Output:
+ // Successfully generated pdf/tutorial12.pdf
+}