gg

package module
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: MIT Imports: 25 Imported by: 1

README

Go Graphics (for TEKO)

gg ist ein Package mit Typen und Funktionen für die Erstellung von 2D Pixelbilder in Go. Es basiert weitgehend auf dem gleichnamigen Package gg. Ich habe einige kleinere Anpassungen am bestehenden Package gemacht, die Farb- und Schriftverwaltung sowie die geometrischen Funktionen stark ausgebaut und in Unterpackages verschoben, so dass diese auch unabhängig verwendet werden können.

Ausserdem finden sich zus Reihe von Programmen gestellt, die ich jeweils als Aufgaben im Unterricht verwende (siehe Verzeichnis Aufgaben).

Pixel- oder Rasterbildern. Die Sammlung dient im Rahmen des Unterrichtes im Fach "Mathematik und SW-Tools" als Werkzeugkasten. Sie basiert massgeblich auf dem gleichnamigen Paket , wurde geringfügig modifiziert und um ein paar Unterpakete ergänzt - so finden sich bspw. in 'gg/color' Farben (analog 'image/color').

Installation

Mit folgedem Befehl wird das Paket in der neusten Version, inkl. aller Unterpakete installiert.

go get -u github.com/stefan-muehlebach/gg

Dokumentation

https://pkg.go.dev/github.com/stefan-muehlebach/gg?tab=doc

Hello, Circle!

Der Klassiker unter den Erstlingswerken. Zwar in einer graphischen aber noch recht unbunten Variante.

package main

import (
    "github.com/stefan-muehlebach/gg"
    "github.com/stefan-muehlebach/gg/colornames"
)

func main() {
    gc := gg.NewContext(512, 512)
    gc.DrawCircle(256.0, 256.0, 224.0)
    gc.SetFillColor(colornames.Black)
    gc.Fill()
    gc.SavePNG("circle.png")
}

Beispiele

Ein wichtiger Bestandteil dieser Sammlung sind die Beispiele. Auch wenn sie ursprünglich zum Testen der Software erstellt wurden, können sie auch verwendet werden, um die einzelnen Funktionen besser zu verstehen.

Graphische Umgebungen

Stehen im Zentrum jeder Anwendung und werden über folgende Funktionen erstellt.

NewContext(width, height int) *Context
NewContextForImage(im image.Image) *Context
NewContextForRGBA(im *image.RGBA) *Context

Zeichenfunktionen

Was wäre eine Graphikumgebung ohne Werkzeuge, um Kreise, Geraden oder Rechtecke (und vieles mehr) zu erstellen,

DrawPoint(x, y, r float64)
DrawLine(x1, y1, x2, y2 float64)
DrawRectangle(x, y, w, h float64)
DrawRoundedRectangle(x, y, w, h, r float64)
DrawCircle(x, y, r float64)
DrawArc(x, y, r, angle1, angle2 float64)
DrawEllipse(x, y, rx, ry float64)
DrawEllipticalArc(x, y, rx, ry, angle1, angle2 float64)
DrawRegularPolygon(n int, x, y, r, rotation float64)
DrawImage(im image.Image, x, y float64)
DrawImageAnchored(im image.Image, x, y, ax, ay float64)
SetPixel(x, y int, c color.Color)

MoveTo(x, y float64)
LineTo(x, y float64)
QuadraticTo(x1, y1, x2, y2 float64)
CubicTo(x1, y1, x2, y2, x3, y3 float64)
ClosePath()
ClearPath()
NewSubPath()

Clear()
Stroke()
Fill()
FillStroke()
StrokePreserve()
FillPreserve()

Bei der Darstellung von Bildern oder Schriften kann es hilfreich sein, diese zentriert an einer bestimmten Stelle auszugeben. Verwende dazu die Funktion DrawImageAnchored mit 0.5 für die Parameter ax und ay. Mit 0 wird das Bild links oben ausgerichtet, mit 1 rechts unten. DrawStringAnchored bietet die gleiche Funktionalität für Texte an, so dass der Aufruf von MeasureString dazu nicht notwendig sein sollte.

Textfunktionen

Übernehmen sogar den Zeilenumbruch für dich!

DrawString(s string, x, y float64)
DrawStringAnchored(s string, x, y, ax, ay float64)
DrawStringWrapped(s string, x, y, ax, ay, width, lineSpacing float64, align Align)
MeasureString(s string) (w, h float64)
MeasureMultilineString(s string, lineSpacing float64) (w, h float64)
WordWrap(s string, w float64) []string
SetFontFace(face font.Face)
LoadFontFace(path string, points float64) error

Farbfunktionen

Für die Erstellung und Veränderung von Farben stehen im Package gg/color eine Anzahl von neuen Farbtypen (RGBAF, HSL, HSV, etc) zur Verfügung. Im Package gg/colornames sind alle Farben aus SVG 1.1 als vorbereitete Variablen zu finden.

SetStrokeColor(c color.Color)
SetFillColor(c color.Color)

Optionen für Linen und Flächen

SetStrokeWidth(lineWidth float64)
SetLineCap(lineCap LineCap)
SetLineJoin(lineJoin LineJoin)
SetDash(dashes ...float64)
SetDashOffset(offset float64)
SetFillRule(fillRule FillRule)

Verläufe und Muster

gg unterstützt lineare, radiale und konische Verläufe sowie Muster um graphische Objekte damit zu füllen. Es können sogar eigene Muster definiert werden.

SetFillStyle(pattern Pattern)
SetStrokeStyle(pattern Pattern)
NewSolidPattern(color color.Color)
NewLinearGradient(x0, y0, x1, y1 float64)
NewRadialGradient(x0, y0, r0, x1, y1, r1 float64)
NewConicGradient(cx, cy, deg float64)
NewSurfacePattern(im image.Image, op RepeatOp)

Koordinatensysteme

Wie das Koordinatensystem interpretiert werden soll, kann mit diesen Funktionen beeinflusst werden.

Identity()
Translate(tx, ty float64)
Scale(sx, sy float64)
ScaleAbout(sx, sy, x, y float64)
Rotate(angle float64)
RotateAbout(angle, x, y float64)
TransformPoint(x, y float64) (tx, ty float64)

Matrix() (geom.Matrix)
SetMatrix(m geom.Matrix)

Die Funktionen RotateAbout und ScaleAbout haben ihren Bezugspunkt an der Stelle x, y und nicht beim Ursprung.

Stackfunktionen

Die aktuellen Einstellungen (insbesondere die Koordiantentransformationen) können auf einem Stack gesichert und wiederhergestellt werden. Der Aufruf ist mehrfach und damit geschachtelt möglich.

Push()
Pop()

Ausschnittsfunktionen

Mit folgenden Funktionen werden die Zeicheoperationen auf ein bestimtes Gebiet beschränkt. Der aktuelle Pfad wird dabei als Rand des Gebietes verwendet.

Clip()
ClipPreserve()
ResetClip()
AsMask() *image.Alpha
SetMask(mask *image.Alpha)
InvertMask()

Hilfsfunktionen

Manchmal will man sie einfach nicht selber schreiben müssen!

Radians(degrees float64) float64
Degrees(radians float64) float64
LoadImage(path string) (image.Image, error)
LoadPNG(path string) (image.Image, error)
SavePNG(path string, im image.Image) error

Ein weiteres Beispiel

Das Bild dazu siehst du weiter unten.

package main

import (
    "github.com/stefan-muehlebach/gg"
    "github.com/stefan-muehlebach/gg/color"
)

func main() {
    const S = 512
    dc := gg.NewContext(S, S)
    dc.SetFillColor(color.RGBAF{0, 0, 0, 0.2})
    for i := 0; i < 360; i += 15 {
        dc.Push()
        dc.RotateAbout(gg.Radians(float64(i)), S/2, S/2)
        dc.DrawEllipse(S/2, S/2, S*7/16, S/8)
        dc.Fill()
        dc.Pop()
    }
    dc.SavePNG("ellipses.png")
}

Ellipses

Hall of fame

Ohne die Unterstützung folgender Personen wäre das Werk nicht, viel später oder weniger freudig zustande gekommen.

  • Weber, Nicolas - für die allererste Installation dieses Paketes ausserhalb meines Computers.

Documentation

Overview

Eine Sammlung von Funktionen um Pixel-, resp. Rasterbilder zu erstellen.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CubicBezier

func CubicBezier(x0, y0, x1, y1, x2, y2, x3, y3 float64) []Point

func Degrees

func Degrees(radians float64) float64

Konvertiert einen Winkel vom Bogenmass nach Grad.

func LoadFontFace

func LoadFontFace(path string, points float64) (font.Face, error)

LoadFontFace is a helper function to load the specified font file with the specified point size. Note that the returned `font.Face` objects are not thread safe and cannot be used in parallel across goroutines. You can usually just use the Context.LoadFontFace function instead of this package-level function.

func LoadImage

func LoadImage(path string) (image.Image, error)

Läadt das Bild in der Datei path und stellt die Bilddaten als Image im ersten Rückgabewert zur Verfügung. Bei einem Fehler ist der zweite Rückgabewert nicht nil und muss entsprechend behandelt werden.

func LoadJPG

func LoadJPG(path string) (image.Image, error)

func LoadPNG

func LoadPNG(path string) (image.Image, error)

Wie LoadImage, jedoch ausschliesslich für PNG-Dateien. Bei einem Fehler ist der zweite Rückgabewert nicht nil und muss entsprechend behandelt werden.

func Radians

func Radians(degrees float64) float64

Konvertiert einen Winkel in Grad nach dem Bogenmass.

func SaveJPG

func SaveJPG(path string, im image.Image, quality int) error

func SavePNG

func SavePNG(path string, im image.Image) error

Types

type Align

type Align int
const (
	AlignLeft Align = iota
	AlignCenter
	AlignRight
)

type Context

type Context struct {
	// contains filtered or unexported fields
}

func NewContext

func NewContext(width, height int) *Context

NewContext creates a new image.RGBA with the specified width and height and prepares a context for rendering onto that image.

func NewContextForImage

func NewContextForImage(im image.Image) *Context

NewContextForImage copies the specified image into a new image.RGBA and prepares a context for rendering onto that image.

func NewContextForRGBA

func NewContextForRGBA(im *image.RGBA) *Context

NewContextForRGBA prepares a context for rendering onto the specified image. No copy is made.

func (*Context) AsMask

func (dc *Context) AsMask() *image.Alpha

AsMask returns an *image.Alpha representing the alpha channel of this context. This can be useful for advanced clipping operations where you first render the mask geometry and then use it as a mask.

func (*Context) Bounds

func (dc *Context) Bounds() geom.Rectangle

Bounds returns the coordinates of the visible range as a rectangle.

func (*Context) Clear

func (dc *Context) Clear()

Clear fills the entire image with the current color.

func (*Context) ClearPath

func (dc *Context) ClearPath()

ClearPath clears the current path. There is no current point after this operation.

func (*Context) Clip

func (dc *Context) Clip()

Clip updates the clipping region by intersecting the current clipping region with the current path as it would be filled by dc.Fill(). The path is cleared after this operation.

func (*Context) ClipPreserve

func (dc *Context) ClipPreserve()

ClipPreserve updates the clipping region by intersecting the current clipping region with the current path as it would be filled by dc.Fill(). The path is preserved after this operation.

func (*Context) ClosePath

func (dc *Context) ClosePath()

ClosePath adds a line segment from the current point to the beginning of the current subpath. If there is no current point, this is a no-op.

func (*Context) CubicTo

func (dc *Context) CubicTo(x1, y1, x2, y2, x3, y3 float64)

CubicTo adds a cubic bezier curve to the current path starting at the current point. If there is no current point, it first performs MoveTo(x1, y1). Because freetype/raster does not support cubic beziers, this is emulated with many small line segments.

func (*Context) DrawArc

func (dc *Context) DrawArc(x, y, r, angle1, angle2 float64)

func (*Context) DrawCircle

func (dc *Context) DrawCircle(x, y, r float64)

func (*Context) DrawEllipse

func (dc *Context) DrawEllipse(x, y, rx, ry float64)

func (*Context) DrawEllipticalArc

func (dc *Context) DrawEllipticalArc(x, y, rx, ry, angle1, angle2 float64)

func (*Context) DrawImage

func (dc *Context) DrawImage(im image.Image, x, y float64)

DrawImage draws the specified image at the specified point.

func (*Context) DrawImageAnchored

func (dc *Context) DrawImageAnchored(im image.Image, x, y, ax, ay float64)

DrawImageAnchored draws the specified image at the specified anchor point. The anchor point is x - w * ax, y - h * ay, where w, h is the size of the image. Use ax=0.5, ay=0.5 to center the image at the specified point.

func (*Context) DrawLine

func (dc *Context) DrawLine(x1, y1, x2, y2 float64)

func (*Context) DrawPoint

func (dc *Context) DrawPoint(x, y, r float64)

DrawPoint is like DrawCircle but ensures that a circle of the specified size is drawn regardless of the current transformation matrix. The position is still transformed, but not the shape of the point.

func (*Context) DrawRectangle

func (dc *Context) DrawRectangle(x, y, w, h float64)

func (*Context) DrawRegularPolygon

func (dc *Context) DrawRegularPolygon(n int, x, y, r, rotation float64)

func (*Context) DrawRoundedRectangle

func (dc *Context) DrawRoundedRectangle(x, y, w, h, r float64)

func (*Context) DrawString

func (dc *Context) DrawString(s string, x, y float64)

DrawString draws the specified text at the specified point.

func (*Context) DrawStringAnchored

func (dc *Context) DrawStringAnchored(s string, x, y, ax, ay float64)

DrawStringAnchored draws the specified text at the specified anchor point. The anchor point is x - w * ax, y - h * ay, where w, h is the size of the text. Use ax=0.5, ay=0.5 to center the text at the specified point.

func (*Context) DrawStringWrapped

func (dc *Context) DrawStringWrapped(s string, x, y, ax, ay, width, lineSpacing float64, align Align)

DrawStringWrapped word-wraps the specified string to the given max width and then draws it at the specified anchor point using the given line spacing and text alignment.

func (*Context) EncodeHTML added in v1.1.0

func (dc *Context) EncodeHTML()

Diese Methode dient aktuell ausschliesslich dazu, die Bilder auch auf "Better Go Playground" anzeigen zu können. Ob dieses Kunststück auch auf weiteren Web-Umgebungen gelingt, kann ich nicht sagen.

func (*Context) EncodeJPG

func (dc *Context) EncodeJPG(w io.Writer, o *jpeg.Options) error

EncodeJPG encodes the image as a JPG and writes it to the provided io.Writer in JPEG 4:2:0 baseline format with the given options. Default parameters are used if a nil *jpeg.Options is passed.

func (*Context) EncodePNG

func (dc *Context) EncodePNG(w io.Writer) error

EncodePNG codiert das Bild als PNG Daten und schreibt sie über den angegebenen io.Writer.

func (*Context) Fill

func (dc *Context) Fill()

Fill fills the current path with the current color. Open subpaths are implicity closed. The path is cleared after this operation.

func (*Context) FillPreserve

func (dc *Context) FillPreserve()

FillPreserve fills the current path with the current color. Open subpaths are implicity closed. The path is preserved after this operation.

func (*Context) FillStroke

func (dc *Context) FillStroke()

FillStroke is a convenient functions which does a FillPreserve first and a Stroke afterwards. See also [StrokeFill].

func (*Context) FontHeight

func (dc *Context) FontHeight() float64

func (*Context) GetCurrentPoint

func (dc *Context) GetCurrentPoint() (geom.Point, bool)

GetCurrentPoint will return the current point and if there is a current point. The point will have been transformed by the context's transformation matrix.

func (*Context) Height

func (dc *Context) Height() int

Height returns the height of the image in pixels.

func (*Context) Identity

func (dc *Context) Identity()

Stellt die Transformationsmatrix auf die Einheitsmatrix.

func (*Context) Image

func (dc *Context) Image() image.Image

Image returns the image that has been drawn by this context.

func (*Context) InvertMask

func (dc *Context) InvertMask()

InvertMask inverts the alpha values in the current clipping mask such that a fully transparent region becomes fully opaque and vice versa.

func (*Context) LineTo

func (dc *Context) LineTo(x, y float64)

LineTo adds a line segment to the current path starting at the current point. If there is no current point, it is equivalent to MoveTo(x, y)

func (*Context) LoadFontFace

func (dc *Context) LoadFontFace(path string, points float64) error

func (*Context) Mask

func (dc *Context) Mask() *image.Alpha

func (*Context) Matrix

func (dc *Context) Matrix() geom.Matrix

Liefert die aktuelle Transformationsmatrix. Die Transformation dieses Kontexts kann entweder über eine Reihe von Methoden ('Rotate()', 'Scale()', etc.) oder direkt durch Auslesen, Anpassen und mittels 'SetMatrix()' Zurückschreiben der Matrix verändert werden.

func (*Context) MeasureMultilineString

func (dc *Context) MeasureMultilineString(s string, lineSpacing float64) (width, height float64)

func (*Context) MeasureString

func (dc *Context) MeasureString(s string) (w, h float64)

MeasureString returns the rendered width and height of the specified text given the current font face.

func (*Context) MoveTo

func (dc *Context) MoveTo(x, y float64)

MoveTo starts a new subpath within the current path starting at the specified point.

func (*Context) Multiply

func (dc *Context) Multiply(m geom.Matrix)

Hängt die Transformation im 'm' der aktuellen Transformationsmatrix an. Die neue Transformation wird also durch Rechtsmultiplikation mit 'm' gebildet.

func (*Context) NewSubPath

func (dc *Context) NewSubPath()

NewSubPath starts a new subpath within the current path. There is no current point after this operation.

func (*Context) Pop

func (dc *Context) Pop()

Holt die zuletzt gesicherten Einstellungen vom Stack. Siehe auch [Push].

func (*Context) Push

func (dc *Context) Push()

Sichert die aktuellen Einstellungen des graphischen Kontexts auf einem Stack. Siehe auch [Pop].

func (*Context) QuadraticTo

func (dc *Context) QuadraticTo(x1, y1, x2, y2 float64)

QuadraticTo adds a quadratic bezier curve to the current path starting at the current point. If there is no current point, it first performs MoveTo(x1, y1)

func (*Context) ResetClip

func (dc *Context) ResetClip()

ResetClip clears the clipping region.

func (*Context) Rotate

func (dc *Context) Rotate(angle float64)

Ergänzt die aktuelle Transformation um eine Rotation im Gegenuhrzeigersinn. Der Winkel ist im Bogenmass anzugeben.

func (*Context) RotateAbout

func (dc *Context) RotateAbout(angle, x, y float64)

Ergänzt die aktuelle Transformation um eine Rotation im Gegenuhrzeigersinn um einen bestimmten Rotationspunkt. Der Winkel ist im Bogenmass anzugeben.

func (*Context) SaveJPG

func (dc *Context) SaveJPG(path string, quality int) error

SaveJPG codiert das Bild as JPEG Daten und schreibt diese in die Datei path. Mit quality kann die Kompressionsrate vorgegeben werden.

func (*Context) SavePNG

func (dc *Context) SavePNG(path string) error

SavePNG codiert das Bild als PNG Daten und schreibt diese in die Datei path.

func (*Context) Scale

func (dc *Context) Scale(sx, sy float64)

Ergänzt die atuelle Transformation um eine Skalierung, wobei die Skalierung in X-, resp. Y-Richtung getrennt angegeben werden kann.

func (*Context) ScaleAbout

func (dc *Context) ScaleAbout(sx, sy, x, y float64)

Ergänzt die atuelle Transformation um eine Skalierung, wobei die Skalierung in X-, resp. Y-Richtung getrennt angegeben werden kann. Der Mittelpunkt der Streckung befindet sich beim Punkt 'x,y'.

func (*Context) SetDash

func (dc *Context) SetDash(dashes ...float64)

SetDash sets the current dash pattern to use. Call with zero arguments to disable dashes. The values specify the lengths of each dash, with alternating on and off lengths.

func (*Context) SetDashOffset

func (dc *Context) SetDashOffset(offset float64)

SetDashOffset sets the initial offset into the dash pattern to use when stroking dashed paths.

func (*Context) SetFillColor

func (dc *Context) SetFillColor(c color.Color)

func (*Context) SetFillRule

func (dc *Context) SetFillRule(fillRule FillRule)

func (*Context) SetFillRuleEvenOdd

func (dc *Context) SetFillRuleEvenOdd()

func (*Context) SetFillRuleWinding

func (dc *Context) SetFillRuleWinding()

func (*Context) SetFillStyle

func (dc *Context) SetFillStyle(pattern Pattern)

SetFillStyle sets current fill style

func (*Context) SetFontFace

func (dc *Context) SetFontFace(fontFace font.Face)

func (*Context) SetLineCap

func (dc *Context) SetLineCap(lineCap LineCap)

func (*Context) SetLineCapButt

func (dc *Context) SetLineCapButt()

func (*Context) SetLineCapRound

func (dc *Context) SetLineCapRound()

func (*Context) SetLineCapSquare

func (dc *Context) SetLineCapSquare()

func (*Context) SetLineJoin

func (dc *Context) SetLineJoin(lineJoin LineJoin)

func (*Context) SetLineJoinBevel

func (dc *Context) SetLineJoinBevel()

func (*Context) SetLineJoinRound

func (dc *Context) SetLineJoinRound()

func (*Context) SetMask

func (dc *Context) SetMask(mask *image.Alpha) error

SetMask allows you to directly set the *image.Alpha to be used as a clipping mask. It must be the same size as the context, else an error is returned and the mask is unchanged.

func (*Context) SetMatrix

func (dc *Context) SetMatrix(m geom.Matrix)

Überschreibt die aktuelle Transformationsmatrix der Zeichenumgebung mit dem Parameter 'm'.

func (*Context) SetPixel

func (dc *Context) SetPixel(x, y int, c color.Color)

SetPixel sets the color of the specified pixel using the current color.

func (*Context) SetStrokeColor

func (dc *Context) SetStrokeColor(c color.Color)

func (*Context) SetStrokeStyle

func (dc *Context) SetStrokeStyle(pattern Pattern)

SetStrokeStyle sets current stroke style

func (*Context) SetStrokeWidth

func (dc *Context) SetStrokeWidth(lineWidth float64)

Legt die Breite fest, mit der ein Pfad gezeichnet werden soll.

func (*Context) Stroke

func (dc *Context) Stroke()

Stroke strokes the current path with the current color, line width, line cap, line join and dash settings. The path is cleared after this operation.

func (*Context) StrokeFill

func (dc *Context) StrokeFill()

StrokeFill is a convenient functions which does a StrokePreserve first and a Fill afterwards. See also [FillStroke].

func (*Context) StrokePreserve

func (dc *Context) StrokePreserve()

StrokePreserve strokes the current path with the current color, line width, line cap, line join and dash settings. The path is preserved after this operation.

func (*Context) TransformPoint

func (dc *Context) TransformPoint(x, y float64) (tx, ty float64)

Transformiert den Punkt '(x,y)' mit der aktuellen Transformatiomsmatrix und Liefert das Resultat als Zahlenpaar. Translationen werden durchgeführt. Vergleiche dazu auch die Methode [TransformVector].

func (*Context) TransformVector

func (dc *Context) TransformVector(x, y float64) (tx, ty float64)

Transformiert den Punkt '(x,y)' mit der aktuellen Transformatiomsmatrix und Liefert das Resultat als Zahlenpaar. Translationen werden _nicht_ durchgeführt. Vergleiche dazu auch die Methode [TransformPoint].

func (*Context) Translate

func (dc *Context) Translate(tx, ty float64)

Ergänzt die aktuelle Transformation um eine Translation um die angegebenen Werte.

func (*Context) Width

func (dc *Context) Width() int

Width returns the width of the image in pixels.

func (*Context) WordWrap

func (dc *Context) WordWrap(s string, w float64) []string

WordWrap wraps the specified string to the given max width and current font face.

type FillRule

type FillRule int
const (
	FillRuleWinding FillRule = iota
	FillRuleEvenOdd
)

type Gradient

type Gradient interface {
	Pattern
	AddColorStop(offset float64, color color.Color)
}

func NewConicGradient

func NewConicGradient(cx, cy, deg float64) Gradient

func NewLinearGradient

func NewLinearGradient(x0, y0, x1, y1 float64) Gradient

func NewRadialGradient

func NewRadialGradient(x0, y0, r0, x1, y1, r1 float64) Gradient

type LineCap

type LineCap int
const (
	LineCapRound LineCap = iota
	LineCapButt
	LineCapSquare
)

type LineJoin

type LineJoin int
const (
	LineJoinRound LineJoin = iota
	LineJoinBevel
)

type Pattern

type Pattern interface {
	ColorAt(x, y int) color.Color
}

func NewSolidPattern

func NewSolidPattern(color color.Color) Pattern

func NewSurfacePattern

func NewSurfacePattern(im image.Image, op RepeatOp) Pattern

type RepeatOp

type RepeatOp int
const (
	RepeatBoth RepeatOp = iota
	RepeatX
	RepeatY
	RepeatNone
)

Directories

Path Synopsis
Erweiterung des Packages 'image/color' um neue Farbtypen.
Erweiterung des Packages 'image/color' um neue Farbtypen.
Bietet einen einfachen Zugriff auf die Go-Fonts aber auch auf eine Reihe von OpenSource-Schriten.
Bietet einen einfachen Zugriff auf die Go-Fonts aber auch auf eine Reihe von OpenSource-Schriten.
Package mit Typen für grundlegende, geometrische 2D-Operationen.
Package mit Typen für grundlegende, geometrische 2D-Operationen.

Jump to

Keyboard shortcuts

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