Documentation ¶
Index ¶
- func DrawShapes(img draw.Image, x, y int, shapes ...Shaper) error
- func FilledImage(width, height int, fill color.Color) draw.Image
- func SaveImage(img image.Image, filename string) error
- type Circle
- type CircularShaper
- type Option
- type RegularPolygon
- func (polygon *RegularPolygon) Draw(img draw.Image, x, y int) error
- func (shape RegularPolygon) Fill() color.Color
- func (shape RegularPolygon) SetFill(fill color.Color)
- func (polygon *RegularPolygon) SetSides(sides int)
- func (polygon *RegularPolygon) Sides() int
- func (polygon *RegularPolygon) String() string
- type RegularPolygonalShaper
- type Shaper
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Circle ¶
type Circle struct {
// contains filtered or unexported fields
}
The zero value is invalid! Use NewCircle() to create a valid Circle.
type CircularShaper ¶
type RegularPolygon ¶
type RegularPolygon struct { *Circle // contains filtered or unexported fields }
The zero value is invalid! Use NewRegularPolygon() to create a valid RegularPolygon.
func NewRegularPolygon ¶
func NewRegularPolygon(fill color.Color, radius, sides int) *RegularPolygon
func (*RegularPolygon) SetSides ¶
func (polygon *RegularPolygon) SetSides(sides int)
func (*RegularPolygon) Sides ¶
func (polygon *RegularPolygon) Sides() int
func (*RegularPolygon) String ¶
func (polygon *RegularPolygon) String() string
type RegularPolygonalShaper ¶
type RegularPolygonalShaper interface { CircularShaper // Fill(); SetFill(); Draw(); Radius(); SetRadius() Sides() int SetSides(sides int) }
type Shaper ¶
type Shaper interface { Fill() color.Color SetFill(fill color.Color) Draw(img draw.Image, x, y int) error }
func New ¶
Factory function: The returned Shaper can only call Shaper methods unless we use type assertion: see main() in ../main.go for examples. Note that this function could return a CircularShaper (in which case no type assertion would be needed to set the Radius); but we prefer the to be more general since that allows us to add other non-CircularShaper shapes later without requiring existing callers to be changed.
Click to show internal directories.
Click to hide internal directories.