fix c255 for rgb conversion

This commit is contained in:
Stani 2015-06-27 13:50:43 +02:00
parent a422b2462d
commit bbcbc3df5e

View file

@ -14,8 +14,6 @@ import (
"github.com/stanim/gofpdf" "github.com/stanim/gofpdf"
) )
const c255 = 254.0 / 65535.0
var ( var (
caps = map[draw2d.Cap]string{ caps = map[draw2d.Cap]string{
draw2d.RoundCap: "round", draw2d.RoundCap: "round",
@ -27,6 +25,8 @@ func notImplemented(method string) {
fmt.Printf("%s: not implemented\n", method) fmt.Printf("%s: not implemented\n", method)
} }
const c255 = 255.0 / 65535.0
func rgb(c color.Color) (int, int, int) { func rgb(c color.Color) (int, int, int) {
r, g, b, _ := c.RGBA() r, g, b, _ := c.RGBA()
return int(float64(r) * c255), int(float64(g) * c255), int(float64(b) * c255) return int(float64(r) * c255), int(float64(g) * c255), int(float64(b) * c255)