summaryrefslogtreecommitdiff
path: root/fpdf.go
diff options
context:
space:
mode:
authorKurt <kurt.w.jung@gmail.com>2019-03-06 15:18:01 -0500
committerKurt <kurt.w.jung@gmail.com>2019-03-06 15:18:01 -0500
commit6b7c17b5b904039a423e8df6e51875702bae5763 (patch)
tree5202cba8e8b0bb020c3e1440c8ac1c5e6e962ba2 /fpdf.go
parenta80b38af5767fdc558bed247f31aa45a0f5150c5 (diff)
Unconditionally assign colors (fill, text and draw) and line width, cap style and line join style so that the manipulation of these properties in transformations, which begin with default values, will work as intended. Add example to demonstrate expected results.
Diffstat (limited to 'fpdf.go')
-rw-r--r--fpdf.go32
1 files changed, 10 insertions, 22 deletions
diff --git a/fpdf.go b/fpdf.go
index 1199c4f..18ab3b0 100644
--- a/fpdf.go
+++ b/fpdf.go
@@ -838,9 +838,7 @@ func rgbColorValue(r, g, b int, grayStr, fullStr string) (clr colorType) {
// The method can be called before the first page is created. The value is
// retained from page to page.
func (f *Fpdf) SetDrawColor(r, g, b int) {
- if r != f.color.draw.ir || g != f.color.draw.ig || b != f.color.draw.ib {
- f.setDrawColor(r, g, b)
- }
+ f.setDrawColor(r, g, b)
}
func (f *Fpdf) setDrawColor(r, g, b int) {
@@ -862,9 +860,7 @@ func (f *Fpdf) GetDrawColor() (int, int, int) {
// -255). The method can be called before the first page is created and the
// value is retained from page to page.
func (f *Fpdf) SetFillColor(r, g, b int) {
- if r != f.color.fill.ir || g != f.color.fill.ig || b != f.color.fill.ib {
- f.setFillColor(r, g, b)
- }
+ f.setFillColor(r, g, b)
}
func (f *Fpdf) setFillColor(r, g, b int) {
@@ -886,9 +882,7 @@ func (f *Fpdf) GetFillColor() (int, int, int) {
// components (0 - 255). The method can be called before the first page is
// created. The value is retained from page to page.
func (f *Fpdf) SetTextColor(r, g, b int) {
- if r != f.color.text.ir || g != f.color.text.ig || b != f.color.text.ib {
- f.setTextColor(r, g, b)
- }
+ f.setTextColor(r, g, b)
}
func (f *Fpdf) setTextColor(r, g, b int) {
@@ -923,9 +917,7 @@ func (f *Fpdf) GetStringWidth(s string) float64 {
// The method can be called before the first page is created. The value is
// retained from page to page.
func (f *Fpdf) SetLineWidth(width float64) {
- if f.lineWidth != width {
- f.setLineWidth(width)
- }
+ f.setLineWidth(width)
}
func (f *Fpdf) setLineWidth(width float64) {
@@ -954,11 +946,9 @@ func (f *Fpdf) SetLineCapStyle(styleStr string) {
default:
capStyle = 0
}
- if capStyle != f.capStyle {
- f.capStyle = capStyle
- if f.page > 0 {
- f.outf("%d J", f.capStyle)
- }
+ f.capStyle = capStyle
+ if f.page > 0 {
+ f.outf("%d J", f.capStyle)
}
}
@@ -975,11 +965,9 @@ func (f *Fpdf) SetLineJoinStyle(styleStr string) {
default:
joinStyle = 0
}
- if joinStyle != f.joinStyle {
- f.joinStyle = joinStyle
- if f.page > 0 {
- f.outf("%d j", f.joinStyle)
- }
+ f.joinStyle = joinStyle
+ if f.page > 0 {
+ f.outf("%d j", f.joinStyle)
}
}