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
|
|
|
)
|
|
|
|
|
|
|
|
type GraphicContext interface {
|
2015-04-29 12:33:32 +00:00
|
|
|
PathBuilder
|
2015-04-29 16:09:07 +00:00
|
|
|
// BeginPath creates a new path
|
2012-04-17 09:03:56 +00:00
|
|
|
BeginPath()
|
2015-04-29 16:09:07 +00:00
|
|
|
// GetMatrixTransform returns the current transformation matrix
|
2015-04-30 12:11:23 +00:00
|
|
|
GetMatrixTransform() Matrix
|
2015-04-29 16:09:07 +00:00
|
|
|
// SetMatrixTransform sets the current transformation matrix
|
2015-04-30 12:11:23 +00:00
|
|
|
SetMatrixTransform(tr Matrix)
|
2015-04-29 16:09:07 +00:00
|
|
|
// ComposeMatrixTransform composes the current transformation matrix with tr
|
2015-04-30 12:11:23 +00:00
|
|
|
ComposeMatrixTransform(tr Matrix)
|
2015-04-29 16:09:07 +00:00
|
|
|
// Rotate applies a rotation to the current transformation matrix. angle is in radian.
|
2011-04-27 08:06:14 +00:00
|
|
|
Rotate(angle float64)
|
2015-04-29 16:09:07 +00:00
|
|
|
// Translate applies a translation to the current transformation matrix.
|
2011-04-27 08:06:14 +00:00
|
|
|
Translate(tx, ty float64)
|
2015-04-29 16:09:07 +00:00
|
|
|
// Scale applies a scale to the current transformation matrix.
|
2011-04-27 08:06:14 +00:00
|
|
|
Scale(sx, sy float64)
|
2015-04-29 16:09:07 +00:00
|
|
|
// SetStrokeColor sets the current stroke color
|
2012-01-13 09:14:12 +00:00
|
|
|
SetStrokeColor(c color.Color)
|
2015-04-29 16:09:07 +00:00
|
|
|
// SetStrokeColor sets the current fill color
|
2012-01-13 09:14:12 +00:00
|
|
|
SetFillColor(c color.Color)
|
2015-04-29 16:09:07 +00:00
|
|
|
// SetFillRule sets the current fill rule
|
2011-04-27 08:06:14 +00:00
|
|
|
SetFillRule(f FillRule)
|
2015-04-29 16:09:07 +00:00
|
|
|
// SetLineWidth sets the current line width
|
2011-04-27 08:06:14 +00:00
|
|
|
SetLineWidth(lineWidth float64)
|
2015-04-29 16:09:07 +00:00
|
|
|
// SetLineCap sets the current line cap
|
2015-04-29 12:33:32 +00:00
|
|
|
SetLineCap(cap LineCap)
|
2015-04-29 16:09:07 +00:00
|
|
|
// SetLineJoin sets the current line join
|
2015-04-29 12:33:32 +00:00
|
|
|
SetLineJoin(join LineJoin)
|
2015-04-29 16:09:07 +00:00
|
|
|
// SetLineJoin sets the current dash
|
2011-04-27 08:06:14 +00:00
|
|
|
SetLineDash(dash []float64, dashOffset float64)
|
2015-04-29 16:09:07 +00:00
|
|
|
// SetFontSize
|
2011-04-27 08:06:14 +00:00
|
|
|
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)
|
2013-05-27 18:53:53 +00:00
|
|
|
StrokeString(text string) (cursor float64)
|
2013-05-27 19:09:57 +00:00
|
|
|
StrokeStringAt(text string, x, y float64) (cursor float64)
|
2015-04-29 12:33:32 +00:00
|
|
|
Stroke(paths ...*Path)
|
|
|
|
Fill(paths ...*Path)
|
|
|
|
FillStroke(paths ...*Path)
|
2011-04-27 08:06:14 +00:00
|
|
|
}
|