diff options
author | Kurt Jung <kurt.w.jung@gmail.com> | 2015-07-04 13:14:40 -0400 |
---|---|---|
committer | Kurt Jung <kurt.w.jung@gmail.com> | 2015-07-04 13:14:40 -0400 |
commit | f0690e7eabd6a1dc812923ce417ebdb7da490f14 (patch) | |
tree | 18d446216908d4bbddde478010c9052c6ad870ee | |
parent | 5cb99b114890dc1ef96e06b70f26fe5cfae63db7 (diff) |
Dashed lines: tutorial example and tip of hat to Claudio Felber
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | doc.go | 3 | ||||
-rw-r--r-- | fpdf.go | 12 | ||||
-rw-r--r-- | fpdf_test.go | 4 |
4 files changed, 14 insertions, 6 deletions
@@ -6,3 +6,4 @@ pdf.txt *.sublime* font/Ubuntu-* *.0 +*.swp @@ -71,7 +71,8 @@ Schroeder. Ivan Daniluk generalized the font and image loading code to use the Reader interface while maintaining backward compatibility. Anthony Starks provided code for the Polygon function. Robert Lillack provided the Beziergon function and corrected some naming issues with the internal curve function. -Bruno Michel has provided valuable assistance with the code. +Claudio Felber provided implementations for dashed line drawing and generalized +font loading. Bruno Michel has provided valuable assistance with the code. The FPDF website is http://www.fpdf.org/. @@ -788,10 +788,14 @@ func (f *Fpdf) SetLineCapStyle(styleStr string) { } } -// SetDashPattern sets the dash pattern that is used to draw lines. -// The dashArray elements are numbers that specify the lengths of alternating -// dashes and gaps. The dash phase specifies the distance into the dash pattern -// at which to start the dash. The dash pattern is retained from page to page. +// SetDashPattern sets the dash pattern that is used to draw lines. The +// dashArray elements are numbers, in units established in New(), that specify +// the lengths of alternating dashes and gaps. The dash phase specifies the +// distance into the dash pattern at which to start the dash. The dash pattern +// is retained from page to page. Call this method with an empty array to +// restore solid line drawing. +// +// See tutorial 28 for an example of this function. func (f *Fpdf) SetDashPattern(dashArray []float64, dashPhase float64) { scaled := make([]float64, len(dashArray)) for i, value := range dashArray { diff --git a/fpdf_test.go b/fpdf_test.go index f8df0c3..bb69569 100644 --- a/fpdf_test.go +++ b/fpdf_test.go @@ -1415,8 +1415,10 @@ func ExampleFpdf_tutorial28() { srcPrev = src } pdf.MultiCell(wd-margin-margin, ln, msgStr, "", "C", false) - pdf.SetDrawColor(224, 224, 224) + pdf.SetDashPattern([]float64{0.8, 0.8}, 0) + pdf.SetDrawColor(160, 160, 160) pdf.Polygon(srcList, "D") + pdf.SetDashPattern([]float64{}, 0) pdf.SetDrawColor(64, 64, 128) pdf.SetLineWidth(pdf.GetLineWidth() * 3) pdf.Beziergon(curveList, "D") |