draw2d/gc.go

60 lines
1.6 KiB
Go
Raw Normal View History

2011-04-27 08:06:14 +00:00
// Copyright 2010 The draw2d Authors. All rights reserved.
// created: 21/11/2010 by Laurent Le Goff
2012-04-17 09:03:56 +00:00
2011-04-27 08:06:14 +00:00
package draw2d
import (
"image"
2012-01-13 09:14:12 +00:00
"image/color"
2011-04-27 08:06:14 +00:00
)
2015-07-07 22:42:00 +00:00
// FillRule defines the type for fill rules
2011-04-27 08:06:14 +00:00
type FillRule int
const (
2015-07-07 22:42:00 +00:00
// FillRuleEvenOdd defines the even odd filling rule
2011-04-27 08:06:14 +00:00
FillRuleEvenOdd FillRule = iota
2015-07-07 22:42:00 +00:00
// FillRuleWinding defines the non zero winding rule
2011-04-27 08:06:14 +00:00
FillRuleWinding
)
2015-07-07 22:42:00 +00:00
// GraphicContext describes the interface for the various backends (images, pdf, opengl, ...)
2011-04-27 08:06:14 +00:00
type GraphicContext interface {
Path
2012-04-17 09:03:56 +00:00
// Create a new path
BeginPath()
2011-04-27 08:06:14 +00:00
GetMatrixTransform() MatrixTransform
SetMatrixTransform(tr MatrixTransform)
ComposeMatrixTransform(tr MatrixTransform)
Rotate(angle float64)
Translate(tx, ty float64)
Scale(sx, sy float64)
2012-01-13 09:14:12 +00:00
SetStrokeColor(c color.Color)
SetFillColor(c color.Color)
2011-04-27 08:06:14 +00:00
SetFillRule(f FillRule)
SetLineWidth(lineWidth float64)
SetLineCap(cap Cap)
SetLineJoin(join Join)
SetLineDash(dash []float64, dashOffset float64)
SetFontSize(fontSize float64)
GetFontSize() float64
SetFontData(fontData FontData)
GetFontData() FontData
DrawImage(image image.Image)
Save()
Restore()
Clear()
ClearRect(x1, y1, x2, y2 int)
SetDPI(dpi int)
GetDPI() int
2013-05-29 02:48:35 +00:00
GetStringBounds(s string) (left, top, right, bottom float64)
2013-05-27 19:09:57 +00:00
CreateStringPath(text string, x, y float64) (cursor float64)
2011-04-27 08:06:14 +00:00
FillString(text string) (cursor float64)
2013-05-27 19:09:57 +00:00
FillStringAt(text string, x, y float64) (cursor float64)
StrokeString(text string) (cursor float64)
2013-05-27 19:09:57 +00:00
StrokeStringAt(text string, x, y float64) (cursor float64)
2011-04-27 08:06:14 +00:00
Stroke(paths ...*PathStorage)
Fill(paths ...*PathStorage)
FillStroke(paths ...*PathStorage)
}