Exemplo n.º 1
0
// Parse will draw the rectangle on the document with the given attributes.
func (b *Rectangle) Parse(doc documents.Document) {
	if b.Rotation != 0 {
		doc.TransformBegin()
		fmt.Println(b.Position.X + b.Width/2)
		fmt.Println(b.Position.Y + b.Height/2)
		doc.TransformRotate(b.Rotation, b.Position.X+b.Width/2, b.Position.Y+b.Height/2)
	}

	doc.SetFillColor(utils.HexToRGB(b.Color))
	doc.Rect(b.Position.X, b.Position.Y, b.Width, b.Height, "F")

	if b.Rotation != 0 {
		doc.TransformEnd()
	}
}