From 5d510c1aa2c794e82c114cf0adf540f6829886d7 Mon Sep 17 00:00:00 2001 From: Kurt Jung Date: Tue, 13 Aug 2013 11:41:22 -0400 Subject: Added support with example for transparency in a variety of blending modes. This was adapted from the FPDF transparency script by Martin Hall-May. --- fpdf_test.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'fpdf_test.go') 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 +} -- cgit v1.2.1-24-ge1ad