openvg

package
v0.0.0-...-f136d1b Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2015 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package openvg is a high-level 2D vector graphics library built on OpenVG

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Arc

func Arc(x, y, w, h, sa, aext float32, style ...string)

Arc draws an arc at (x,y) with dimensions (w,h). the arc starts at the angle sa, extended to aext

func Background

func Background(r, g, b uint8)

Background clears the screen with the specified solid background color using RGB triples

func BackgroundColor

func BackgroundColor(s string, alpha ...float32)

BackgroundColor sets the background color

func BackgroundRGB

func BackgroundRGB(r, g, b uint8, alpha float32)

BackgroundRGB clears the screen with the specified background color using a RGBA quad

func Cbezier

func Cbezier(sx, sy, cx, cy, px, py, ex, ey float32, style ...string)

Cbezier draws a cubic bezier curve with extrema (sx, sy) and (ex, ey). Control points at (cx, cy) and (px, py)

func Circle

func Circle(x, y, r float32, style ...string)

Circle draws a circle centered at (x,y), with radius r

func Ellipse

func Ellipse(x, y, w, h float32, style ...string)

Ellipse draws an ellipse at (x,y) with dimensions (w,h)

func End

func End()

End ends the picture

func FillColor

func FillColor(s string, alpha ...float32)

FillColor sets the fill color using names to specify the color, optionally applying alpha.

func FillLinearGradient

func FillLinearGradient(x1, y1, x2, y2 float32, ramp []Offcolor)

FillLinearGradient sets up a linear gradient between (x1,y2) and (x2, y2) using the specified offsets and colors in ramp

func FillRGB

func FillRGB(r, g, b uint8, alpha float32)

FillRGB sets the fill color, using RGB triples and alpha values

func FillRadialGradient

func FillRadialGradient(cx, cy, fx, fy, radius float32, ramp []Offcolor)

FillRadialGradient sets up a radial gradient centered at (cx, cy), radius r, with a focal point at (fx, fy) using the specified offsets and colors in ramp

func Finish

func Finish()

Finish shuts down the graphics subsystem

func Image

func Image(x, y float32, w, h int, s string)

Image places the named image at (x,y) with dimensions (w,h) the derived image dimensions override the specified ones.

func Img

func Img(x, y float32, im image.Image)

Img places an image object at (x,y)

func Init

func Init() (int, int)

Init initializes the graphics subsystem

func Line

func Line(x1, y1, x2, y2 float32, style ...string)

Line draws a line between two points

func Polygon

func Polygon(x, y []float32, style ...string)

Polygon draws a polygon with coordinate in x,y

func Polyline

func Polyline(x, y []float32, style ...string)

Polyline draws a polyline with coordinates in x, y

func Qbezier

func Qbezier(sx, sy, cx, cy, ex, ey float32, style ...string)

Qbezier draws a quadratic bezier curve with extrema (sx, sy) and (ex, ey) Control points are at (cx, cy)

func RawTerm

func RawTerm()

RawTerm sets the terminal to raw mode

func Rect

func Rect(x, y, w, h float32, style ...string)

Rect draws a rectangle at (x,y) with dimesions (w,h)

func RestoreTerm

func RestoreTerm()

RestoreTerm retores terminal settings

func Rotate

func Rotate(r float32)

Rotate rotates the coordinate system around the specifed angle

func Roundrect

func Roundrect(x, y, w, h, rw, rh float32, style ...string)

Roundrect draws a rounded rectangle at (x,y) with dimesions (w,h). the corner radii are at (rw, rh)

func SaveEnd

func SaveEnd(filename string)

SaveEnd ends the picture, saving the raw raster

func SaveTerm

func SaveTerm()

SaveTerm saves terminal settings

func Scale

func Scale(x, y float32)

Scale scales the coordinate system by (x,y)

func Shear

func Shear(x, y float32)

Shear warps the coordinate system by (x,y)

func Start

func Start(w, h int, color ...uint8)

Start begins a picture

func StartColor

func StartColor(w, h int, color string, alpha ...float32)

StartColor begins the picture with the specified color background

func StrokeColor

func StrokeColor(s string, alpha ...float32)

StrokeColor sets the fill color using names to specify the color, optionally applying alpha.

func StrokeRGB

func StrokeRGB(r, g, b uint8, alpha float32)

StrokeRGB sets the stroke color, using RGB triples

func StrokeWidth

func StrokeWidth(w float32)

StrokeWidth sets the stroke width

func Text

func Text(x, y float32, s string, font string, size int, style ...string)

Text draws text whose aligment begins (x,y)

func TextEnd

func TextEnd(x, y float32, s string, font string, size int, style ...string)

TextEnd draws text end-aligned at (x,y)

func TextMid

func TextMid(x, y float32, s string, font string, size int, style ...string)

TextMid draws text centered at (x,y)

func TextWidth

func TextWidth(s string, font string, size int) float32

TextWidth returns the length of text at a specified font and size

func Translate

func Translate(x, y float32)

Translate translates the coordinate system to (x,y)

Types

type Offcolor

type Offcolor struct {
	Offset float32
	RGB
	Alpha float32
}

Offcolor defines the offset, color and alpha values used in gradients the Offset ranges from 0..1, colors as RGB triples, alpha ranges from 0..1

type RGB

type RGB struct {
	Red, Green, Blue uint8
}

RGB defines the red, green, blue triple that makes up colors.

Jump to

Keyboard shortcuts

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