package structs type Coordinates struct { X int `form:"x" json:"x"` Y int `form:"y" json:"y"` } type Color struct { R uint32 `form:"r" json:"r"` G uint32 `form:"g" json:"g"` B uint32 `form:"b" json:"b"` } type Pixel struct { Coordinates Color } func (c *Color) RGBA() (r, g, b, a uint32) { return c.R, c.G, c.B, 65535 }