From 7751c17f106d9d7d4c6c290b969ece1c8dab4371 Mon Sep 17 00:00:00 2001 From: Kurt Date: Sun, 12 Nov 2017 14:04:27 -0500 Subject: Add partial support for spot colors. This does not yet include gradients, etc --- def.go | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) (limited to 'def.go') diff --git a/def.go b/def.go index fd6ef81..88e4dea 100644 --- a/def.go +++ b/def.go @@ -39,6 +39,34 @@ type gradientType struct { objNum int } +type colorMode int + +const ( + colorModeRGB colorMode = iota + colorModeSpot + colorModeCMYK +) + +type colorType struct { + r, g, b float64 + ir, ig, ib int + mode colorMode + spotStr string // name of current spot color + gray bool + str string +} + +// SpotColorType specifies a named spot color value +type spotColorType struct { + id, objID int + val cmykColorType +} + +// CMYKColorType specifies an ink-based CMYK color value +type cmykColorType struct { + c, m, y, k byte // 0% to 100% +} + // SizeType fields Wd and Ht specify the horizontal and vertical extents of a // document element such as a page. type SizeType struct { @@ -254,8 +282,9 @@ type Fpdf struct { colorFlag bool // indicates whether fill and text colors are different color struct { // Composite values of colors - draw, fill, text clrType + draw, fill, text colorType } + spotColorMap map[string]spotColorType // Map of named ink-based colors } type encType struct { -- cgit v1.2.1-24-ge1ad