graphics

package
v0.0.0-...-a30bc99 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 21, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package graphics provides tools for generating images.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Center

func Center(rect image.Rectangle) image.Point

Center returns the center point of a given rectangle

func CenteredRectangle

func CenteredRectangle(centerPoint image.Point, width int, height int) image.Rectangle

CenteredRectangle returns a rectangle of the given dimensions centered on the given point

func DrawCircle

func DrawCircle(circle geometry.Circle, color string, canvas image.Image) image.Image

DrawCircle returns an image with a circle drawn matching the given input on the given image

func DrawEdge

func DrawEdge(edge geometry.Edge, color string, canvas image.Image) image.Image

DrawEdge returns an image with all of the given edges rendered on the given image

func DrawEdges

func DrawEdges(edges []geometry.Edge, color string, canvas image.Image) image.Image

DrawEdges returns an image with all of the given edges rendered on the given image

func DrawPoints

func DrawPoints(points []geometry.Point, color string, canvas image.Image) image.Image

DrawPoints returns an image with all of the given points rendered on the given image

func DrawPolygon

func DrawPolygon(polygon geometry.Polygon, color string, canvas image.Image) image.Image

DrawPolygon returns an image with the given polygon drawn on the given image

func DrawTriangle

func DrawTriangle(triangle geometry.Triangle, color string, canvas image.Image) image.Image

DrawTriangle returns an image with the given triangle drawn on the given image

func LoadPNG

func LoadPNG(path string) image.Image

LoadPNG loads a PNG image and returns it as an Image. It relies on the WORLD_DATA_PATH environment variable to determine where to load the file from.

func RenderFilledImage

func RenderFilledImage(path string, pattern Pattern) image.Image

RenderFilledImage returns an image filled with a particular pattern

Types

type Pattern

type Pattern struct {
	Type            string
	Color           color.RGBA
	PatternFileName string
}

Pattern is a fill pattern

func (Pattern) Fill

func (pattern Pattern) Fill(dc *gg.Context)

Fill fills an image with a pattern

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL