Normalized names in draw.go; started migrating zz_histogram.go to boot.

This commit is contained in:
Pietro Gagliardi 2018-08-26 14:42:43 -04:00
parent c90187046a
commit ba8f53fe3e
2 changed files with 121 additions and 115 deletions

View File

@ -31,7 +31,7 @@ const (
// helper to quickly set a brush color // helper to quickly set a brush color
func mkSolidBrush(color uint32, alpha float64) *ui.Brush { func mkSolidBrush(color uint32, alpha float64) *ui.Brush {
brush := new(ui.Brush) brush := new(ui.Brush)
brush.Type = ui.BrushTypeSolid brush.Type = ui.DrawBrushTypeSolid
component := uint8((color >> 16) & 0xFF) component := uint8((color >> 16) & 0xFF)
brush.R = float64(component) / 255 brush.R = float64(component) / 255
component = uint8((color >> 8) & 0xFF) component = uint8((color >> 8) & 0xFF)
@ -66,7 +66,7 @@ func pointLocations(width, height float64) (xs, ys [10]float64) {
func constructGraph(width, height float64, extend bool) *ui.Path { func constructGraph(width, height float64, extend bool) *ui.Path {
xs, ys := pointLocations(width, height) xs, ys := pointLocations(width, height)
path := ui.NewPath(ui.Winding) path := ui.NewPath(ui.DrawFillModeWinding)
path.NewFigure(xs[0], ys[0]) path.NewFigure(xs[0], ys[0])
for i := 1; i < 10; i++ { for i := 1; i < 10; i++ {
@ -93,7 +93,7 @@ type areaHandler struct{}
func (areaHandler) Draw(a *ui.Area, p *ui.AreaDrawParams) { func (areaHandler) Draw(a *ui.Area, p *ui.AreaDrawParams) {
// fill the area with white // fill the area with white
brush := mkSolidBrush(colorWhite, 1.0) brush := mkSolidBrush(colorWhite, 1.0)
path := ui.NewPath(ui.Winding) path := ui.NewPath(ui.DrawFillModeWinding)
path.AddRectangle(0, 0, p.AreaWidth, p.AreaHeight) path.AddRectangle(0, 0, p.AreaWidth, p.AreaHeight)
path.End() path.End()
p.Context.Fill(path, brush) p.Context.Fill(path, brush)
@ -110,7 +110,7 @@ func (areaHandler) Draw(a *ui.Area, p *ui.AreaDrawParams) {
// draw the axes // draw the axes
brush = mkSolidBrush(colorBlack, 1.0) brush = mkSolidBrush(colorBlack, 1.0)
path = ui.NewPath(ui.Winding) path = ui.NewPath(ui.DrawFillModeWinding)
path.NewFigure(xoffLeft, yoffTop) path.NewFigure(xoffLeft, yoffTop)
path.LineTo(xoffLeft, yoffTop + graphHeight) path.LineTo(xoffLeft, yoffTop + graphHeight)
path.LineTo(xoffLeft + graphWidth, yoffTop + graphHeight) path.LineTo(xoffLeft + graphWidth, yoffTop + graphHeight)
@ -125,7 +125,7 @@ func (areaHandler) Draw(a *ui.Area, p *ui.AreaDrawParams) {
// now get the color for the graph itself and set up the brush // now get the color for the graph itself and set up the brush
graphR, graphG, graphB, graphA := colorButton.Color() graphR, graphG, graphB, graphA := colorButton.Color()
brush.Type = ui.BrushTypeSolid brush.Type = ui.DrawBrushTypeSolid
brush.R = graphR brush.R = graphR
brush.G = graphG brush.G = graphG
brush.B = graphB brush.B = graphB
@ -146,7 +146,7 @@ func (areaHandler) Draw(a *ui.Area, p *ui.AreaDrawParams) {
// now draw the point being hovered over // now draw the point being hovered over
if currentPoint != -1 { if currentPoint != -1 {
xs, ys := pointLocations(graphWidth, graphHeight) xs, ys := pointLocations(graphWidth, graphHeight)
path = ui.NewPath(ui.Winding) path = ui.NewPath(ui.DrawFillModeWinding)
path.NewFigureWithArc( path.NewFigureWithArc(
xs[currentPoint], ys[currentPoint], xs[currentPoint], ys[currentPoint],
pointRadius, pointRadius,

224
draw.go
View File

@ -5,7 +5,7 @@ package ui
// #include "pkgui.h" // #include "pkgui.h"
import "C" import "C"
// Path represents a geometric path in a drawing context. // DrawPath represents a geometric path in a drawing context.
// This is the basic unit of drawing: all drawing operations consist of // This is the basic unit of drawing: all drawing operations consist of
// forming a path, then stroking, filling, or clipping to that path. // forming a path, then stroking, filling, or clipping to that path.
// A path is an OS resource; you must explicitly free it when finished. // A path is an OS resource; you must explicitly free it when finished.
@ -15,7 +15,7 @@ import "C"
// TODO rewrite all that // TODO rewrite all that
// //
// Or more visually, the lifecycle of a Path is // Or more visually, the lifecycle of a Path is
// p := NewPath() // p := DrawNewPath()
// for every figure { // for every figure {
// p.NewFigure(...) // or NewFigureWithArc // p.NewFigure(...) // or NewFigureWithArc
// p.LineTo(...) // any number of these in any order // p.LineTo(...) // any number of these in any order
@ -33,54 +33,56 @@ import "C"
// // ... // // ...
// p.Free() // when done with the path // p.Free() // when done with the path
// //
// A Path also defines its fill mode. (This should ideally be a fill // A DrawPath also defines its fill mode. (This should ideally be a fill
// parameter, but some implementations prevent it.) // parameter, but some implementations prevent it.)
// TODO talk about fill modes // TODO talk about fill modes
type Path struct { type DrawPath struct {
p *C.uiDrawPath p *C.uiDrawPath
} }
// TODO // TODO
// //
// TODO disclaimer // TODO disclaimer
type FillMode uint type DrawFillMode uint
const ( const (
Winding FillMode = iota DrawFillModeWinding DrawFillMode = iota
Alternate DrawFillModeAlternate
) )
// NewPath creates a new Path with the given fill mode. // DrawNewPath creates a new DrawPath with the given fill mode.
func NewPath(fillMode FillMode) *Path { func DrawNewPath(fillMode DrawFillMode) *DrawPath {
var fm C.uiDrawFillMode var fm C.uiDrawFillMode
switch fillMode { switch fillMode {
case Winding: case DrawFillModeWinding:
fm = C.uiDrawFillModeWinding fm = C.uiDrawFillModeWinding
case Alternate: case DrawFillModeAlternate:
fm = C.uiDrawFillModeAlternate fm = C.uiDrawFillModeAlternate
default: default:
panic("invalid fill mode passed to ui.NewPath()") panic("invalid fill mode passed to ui.NewPath()")
} }
return &Path{ return &DrawPath{
p: C.uiDrawNewPath(fm), p: C.uiDrawNewPath(fm),
} }
} }
// Free destroys a Path. After calling Free the Path cannot be used. // Free destroys a DrawPath. After calling Free the DrawPath cannot
func (p *Path) Free() { // be used.
func (p *DrawPath) Free() {
C.uiDrawFreePath(p.p) C.uiDrawFreePath(p.p)
} }
// NewFigure starts a new figure in the Path. The current point // NewFigure starts a new figure in the DrawPath. The current point
// is set to the given point. // is set to the given point.
func (p *Path) NewFigure(x float64, y float64) { func (p *DrawPath) NewFigure(x float64, y float64) {
C.uiDrawPathNewFigure(p.p, C.double(x), C.double(y)) C.uiDrawPathNewFigure(p.p, C.double(x), C.double(y))
} }
// NewFigureWithArc starts a new figure in the Path and adds an arc // NewFigureWithArc starts a new figure in the DrawPath and adds
// as the first element of the figure. Unlike ArcTo, NewFigureWithArc // an arc as the first element of the figure. Unlike ArcTo,
// does not draw an initial line segment. Otherwise, see ArcTo. // NewFigureWithArc does not draw an initial line segment.
func (p *Path) NewFigureWithArc(xCenter float64, yCenter float64, radius float64, startAngle float64, sweep float64, isNegative bool) { // Otherwise, see ArcTo.
func (p *DrawPath) NewFigureWithArc(xCenter float64, yCenter float64, radius float64, startAngle float64, sweep float64, isNegative bool) {
C.uiDrawPathNewFigureWithArc(p.p, C.uiDrawPathNewFigureWithArc(p.p,
C.double(xCenter), C.double(yCenter), C.double(xCenter), C.double(yCenter),
C.double(radius), C.double(radius),
@ -88,20 +90,20 @@ func (p *Path) NewFigureWithArc(xCenter float64, yCenter float64, radius float64
frombool(isNegative)) frombool(isNegative))
} }
// LineTo adds a line to the current figure of the Path starting from // LineTo adds a line to the current figure of the DrawPath starting
// the current point and ending at the given point. The current point // from the current point and ending at the given point. The current
// is set to the ending point. // point is set to the ending point.
func (p *Path) LineTo(x float64, y float64) { func (p *DrawPath) LineTo(x float64, y float64) {
C.uiDrawPathLineTo(p.p, C.double(x), C.double(y)) C.uiDrawPathLineTo(p.p, C.double(x), C.double(y))
} }
// ArcTo adds a circular arc to the current figure of the Path. // ArcTo adds a circular arc to the current figure of the DrawPath.
// You pass it the center of the arc, its radius in radians, the starting // You pass it the center of the arc, its radius in radians, the starting
// angle (couterclockwise) in radians, and the number of radians the // angle (couterclockwise) in radians, and the number of radians the
// arc should sweep (counterclockwise). A line segment is drawn from // arc should sweep (counterclockwise). A line segment is drawn from
// the current point to the start of the arc. The current point is set to // the current point to the start of the arc. The current point is set to
// the end of the arc. // the end of the arc.
func (p *Path) ArcTo(xCenter float64, yCenter float64, radius float64, startAngle float64, sweep float64, isNegative bool) { func (p *DrawPath) ArcTo(xCenter float64, yCenter float64, radius float64, startAngle float64, sweep float64, isNegative bool) {
C.uiDrawPathArcTo(p.p, C.uiDrawPathArcTo(p.p,
C.double(xCenter), C.double(yCenter), C.double(xCenter), C.double(yCenter),
C.double(radius), C.double(radius),
@ -109,11 +111,12 @@ func (p *Path) ArcTo(xCenter float64, yCenter float64, radius float64, startAngl
frombool(isNegative)) frombool(isNegative))
} }
// BezierTo adds a cubic Bezier curve to the current figure of the Path. // BezierTo adds a cubic Bezier curve to the current figure of the
// Its start point is the current point. c1x and c1y are the first control // DrawPath. Its start point is the current point. c1x and c1y are the
// point. c2x and c2y are the second control point. endX and endY // first control point. c2x and c2y are the second control point. endX
// are the end point. The current point is set to the end point. // and endY are the end point. The current point is set to the end
func (p *Path) BezierTo(c1x float64, c1y float64, c2x float64, c2y float64, endX float64, endY float64) { // point.
func (p *DrawPath) BezierTo(c1x float64, c1y float64, c2x float64, c2y float64, endX float64, endY float64) {
C.uiDrawPathBezierTo(p.p, C.uiDrawPathBezierTo(p.p,
C.double(c1x), C.double(c1y), C.double(c1x), C.double(c1y),
C.double(c2x), C.double(c2y), C.double(c2x), C.double(c2y),
@ -121,26 +124,29 @@ func (p *Path) BezierTo(c1x float64, c1y float64, c2x float64, c2y float64, endX
} }
// CloseFigure draws a line segment from the current point of the // CloseFigure draws a line segment from the current point of the
// current figure of the Path back to its initial point. After calling this, // current figure of the DrawPath back to its initial point. After calling
// the current figure is over and you must either start a new figure // this, the current figure is over and you must either start a new
// or end the Path. If this is not called and you start a new figure or // figure or end the DrawPath. If this is not called and you start a
// end the Path, then the current figure will not have this closing line // new figure or end the DrawPath, then the current figure will not
// segment added to it (but the figure will still be over). // have this closing line segment added to it (but the figure will still
func (p *Path) CloseFigure() { // be over).
func (p *DrawPath) CloseFigure() {
C.uiDrawPathCloseFigure(p.p) C.uiDrawPathCloseFigure(p.p)
} }
// AddRectangle creates a new figure in the Path that consists entirely // AddRectangle creates a new figure in the DrawPath that consists
// of a rectangle whose top-left corner is at the given point and whose // entirely of a rectangle whose top-left corner is at the given point
// size is the given size. The rectangle is a closed figure; you must // and whose size is the given size. The rectangle is a closed figure;
// either start a new figure or end the Path after calling this method. // you must either start a new figure or end the Path after calling
func (p *Path) AddRectangle(x float64, y float64, width float64, height float64) { // this method.
func (p *DrawPath) AddRectangle(x float64, y float64, width float64, height float64) {
C.uiDrawPathAddRectangle(p.p, C.double(x), C.double(y), C.double(width), C.double(height)) C.uiDrawPathAddRectangle(p.p, C.double(x), C.double(y), C.double(width), C.double(height))
} }
// End ends the current Path. You cannot add figures to a Path that has // End ends the current DrawPath. You cannot add figures to a
// been ended. You cannot draw with a Path that has not been ended. // DrawPath that has been ended. You cannot draw with a
func (p *Path) End() { // DrawPath that has not been ended.
func (p *DrawPath) End() {
C.uiDrawPathEnd(p.p) C.uiDrawPathEnd(p.p)
} }
@ -151,44 +157,44 @@ type DrawContext struct {
c *C.uiDrawContext c *C.uiDrawContext
} }
// BrushType defines the various types of brushes. // DrawBrushType defines the various types of brushes.
// //
// TODO disclaimer // TODO disclaimer
type BrushType int type DrawBrushType int
const ( const (
BrushTypeSolid BrushType = iota DrawBrushTypeSolid DrawBrushType = iota
BrushTypeLinearGradient DrawBrushTypeLinearGradient
BrushTypeRadialGradient DrawBrushTypeRadialGradient
BrushTypeImage // presently unimplemented DrawBrushTypeImage // presently unimplemented
) )
// TODO // TODO
// //
// TODO disclaimer // TODO disclaimer
// TODO rename these to put LineCap at the beginning? or just Cap? // TODO rename these to put LineCap at the beginning? or just Cap?
type LineCap int type DrawLineCap int
const ( const (
FlatCap LineCap = iota DrawLineCapFlat DrawLineCap = iota
RoundCap DrawLineCapRound
SquareCap DrawLineCapSquare
) )
// TODO // TODO
// //
// TODO disclaimer // TODO disclaimer
type LineJoin int type DrawLineJoin int
const ( const (
MiterJoin LineJoin = iota DrawLineJoinMiter DrawLineJoin = iota
RoundJoin DrawLineJoinRound
BevelJoin DrawLineJoinBevel
) )
// TODO document // TODO document
const DefaultMiterLimit = 10.0 const DefaultMiterLimit = 10.0
// TODO // TODO
type Brush struct { type DrawBrush struct {
Type BrushType Type DrawBrushType
// If Type is Solid. // If Type is Solid.
// TODO // TODO
@ -204,11 +210,11 @@ type Brush struct {
X1 float64 // linear: end point; radial: circle center X1 float64 // linear: end point; radial: circle center
Y1 float64 Y1 float64
OuterRadius float64 // for radial gradients only OuterRadius float64 // for radial gradients only
Stops []GradientStop Stops []DrawGradientStop
} }
// TODO // TODO
type GradientStop struct { type DrawGradientStop struct {
Pos float64 // between 0 and 1 inclusive Pos float64 // between 0 and 1 inclusive
R float64 R float64
G float64 G float64
@ -216,16 +222,16 @@ type GradientStop struct {
A float64 A float64
} }
func (b *Brush) toC() *C.uiDrawBrush { func (b *DrawBrush) toLibui() *C.uiDrawBrush {
cb := C.pkguiAllocBrush() cb := C.pkguiAllocBrush()
cb.Type = C.uiDrawBrushType(b.Type) cb.Type = C.uiDrawBrushType(b.Type)
switch b.Type { switch b.Type {
case BrushTypeSolid: case DrawBrushTypeSolid:
cb.R = C.double(b.R) cb.R = C.double(b.R)
cb.G = C.double(b.G) cb.G = C.double(b.G)
cb.B = C.double(b.B) cb.B = C.double(b.B)
cb.A = C.double(b.A) cb.A = C.double(b.A)
case BrushTypeLinearGradient, BrushTypeRadialGradient: case DrawBrushTypeLinearGradient, DrawBrushTypeRadialGradient:
cb.X0 = C.double(b.X0) cb.X0 = C.double(b.X0)
cb.Y0 = C.double(b.Y0) cb.Y0 = C.double(b.Y0)
cb.X1 = C.double(b.X1) cb.X1 = C.double(b.X1)
@ -241,10 +247,10 @@ func (b *Brush) toC() *C.uiDrawBrush {
C.double(s.B), C.double(s.B),
C.double(s.A)) C.double(s.A))
} }
case BrushTypeImage: case DrawBrushTypeImage:
panic("unimplemented") panic("unimplemented")
default: default:
panic("invalid brush type in Brush.toC()") panic("invalid brush type in Brush.toLibui()")
} }
return cb return cb
} }
@ -257,16 +263,16 @@ func freeBrush(cb *C.uiDrawBrush) {
} }
// TODO // TODO
type StrokeParams struct { type DrawStrokeParams struct {
Cap LineCap Cap DrawLineCap
Join LineJoin Join DrawLineJoin
Thickness float64 Thickness float64
MiterLimit float64 MiterLimit float64
Dashes []float64 Dashes []float64
DashPhase float64 DashPhase float64
} }
func (sp *StrokeParams) toC() *C.uiDrawStrokeParams { func (sp *DrawStrokeParams) toLibui() *C.uiDrawStrokeParams {
csp := C.pkguiAllocStrokeParams() csp := C.pkguiAllocStrokeParams()
csp.Cap = C.uiDrawLineCap(sp.Cap) csp.Cap = C.uiDrawLineCap(sp.Cap)
csp.Join = C.uiDrawLineJoin(sp.Join) csp.Join = C.uiDrawLineJoin(sp.Join)
@ -292,24 +298,24 @@ func freeStrokeParams(csp *C.uiDrawStrokeParams) {
} }
// TODO // TODO
func (c *DrawContext) Stroke(p *Path, b *Brush, sp *StrokeParams) { func (c *DrawContext) Stroke(p *DrawPath, b *DrawBrush, sp *DrawStrokeParams) {
cb := b.toC() cb := b.toLibui()
defer freeBrush(cb) defer freeBrush(cb)
csp := sp.toC() csp := sp.toLibui()
defer freeStrokeParams(csp) defer freeStrokeParams(csp)
C.uiDrawStroke(c.c, p.p, cb, csp) C.uiDrawStroke(c.c, p.p, cb, csp)
} }
// TODO // TODO
func (c *DrawContext) Fill(p *Path, b *Brush) { func (c *DrawContext) Fill(p *DrawPath, b *DrawBrush) {
cb := b.toC() cb := b.toLibui()
defer freeBrush(cb) defer freeBrush(cb)
C.uiDrawFill(c.c, p.p, cb) C.uiDrawFill(c.c, p.p, cb)
} }
// TODO // TODO
// TODO should the methods of these return self for chaining? // TODO should the methods of these return self for chaining?
type Matrix struct { type DrawMatrix struct {
M11 float64 M11 float64
M12 float64 M12 float64
M21 float64 M21 float64
@ -319,14 +325,14 @@ type Matrix struct {
} }
// TODO identity matrix // TODO identity matrix
func NewMatrix() *Matrix { func DrawNewMatrix() *DrawMatrix {
m := new(Matrix) m := new(DrawMatrix)
m.SetIdentity() m.SetIdentity()
return m return m
} }
// TODO // TODO
func (m *Matrix) SetIdentity() { func (m *DrawMatrix) SetIdentity() {
m.M11 = 1 m.M11 = 1
m.M12 = 0 m.M12 = 0
m.M21 = 0 m.M21 = 0
@ -335,7 +341,7 @@ func (m *Matrix) SetIdentity() {
m.M32 = 0 m.M32 = 0
} }
func (m *Matrix) toC() *C.uiDrawMatrix { func (m *DrawMatrix) toLibui() *C.uiDrawMatrix {
cm := C.pkguiAllocMatrix() cm := C.pkguiAllocMatrix()
cm.M11 = C.double(m.M11) cm.M11 = C.double(m.M11)
cm.M12 = C.double(m.M12) cm.M12 = C.double(m.M12)
@ -346,7 +352,7 @@ func (m *Matrix) toC() *C.uiDrawMatrix {
return cm return cm
} }
func (m *Matrix) fromC(cm *C.uiDrawMatrix) { func (m *DrawMatrix) fromLibui(cm *C.uiDrawMatrix) {
m.M11 = float64(cm.M11) m.M11 = float64(cm.M11)
m.M12 = float64(cm.M12) m.M12 = float64(cm.M12)
m.M21 = float64(cm.M21) m.M21 = float64(cm.M21)
@ -357,49 +363,49 @@ func (m *Matrix) fromC(cm *C.uiDrawMatrix) {
} }
// TODO // TODO
func (m *Matrix) Translate(x float64, y float64) { func (m *DrawMatrix) Translate(x float64, y float64) {
cm := m.toC() cm := m.toLibui()
C.uiDrawMatrixTranslate(cm, C.double(x), C.double(y)) C.uiDrawMatrixTranslate(cm, C.double(x), C.double(y))
m.fromC(cm) m.fromLibui(cm)
} }
// TODO // TODO
func (m *Matrix) Scale(xCenter float64, yCenter float64, x float64, y float64) { func (m *DrawMatrix) Scale(xCenter float64, yCenter float64, x float64, y float64) {
cm := m.toC() cm := m.toLibui()
C.uiDrawMatrixScale(cm, C.uiDrawMatrixScale(cm,
C.double(xCenter), C.double(yCenter), C.double(xCenter), C.double(yCenter),
C.double(x), C.double(y)) C.double(x), C.double(y))
m.fromC(cm) m.fromLibui(cm)
} }
// TODO // TODO
func (m *Matrix) Rotate(x float64, y float64, amount float64) { func (m *DrawMatrix) Rotate(x float64, y float64, amount float64) {
cm := m.toC() cm := m.toLibui()
C.uiDrawMatrixRotate(cm, C.double(x), C.double(y), C.double(amount)) C.uiDrawMatrixRotate(cm, C.double(x), C.double(y), C.double(amount))
m.fromC(cm) m.fromLibui(cm)
} }
// TODO // TODO
func (m *Matrix) Skew(x float64, y float64, xamount float64, yamount float64) { func (m *DrawMatrix) Skew(x float64, y float64, xamount float64, yamount float64) {
cm := m.toC() cm := m.toLibui()
C.uiDrawMatrixSkew(cm, C.uiDrawMatrixSkew(cm,
C.double(x), C.double(y), C.double(x), C.double(y),
C.double(xamount), C.double(yamount)) C.double(xamount), C.double(yamount))
m.fromC(cm) m.fromLibui(cm)
} }
// TODO // TODO
func (m *Matrix) Multiply(m2 *Matrix) { func (m *DrawMatrix) Multiply(m2 *DrawMatrix) {
cm := m.toC() cm := m.toLibui()
cm2 := m2.toC() cm2 := m2.toLibui()
C.uiDrawMatrixMultiply(cm, cm2) C.uiDrawMatrixMultiply(cm, cm2)
C.pkguiFreeMatrix(cm2) C.pkguiFreeMatrix(cm2)
m.fromC(cm) m.fromLibui(cm)
} }
// TODO // TODO
func (m *Matrix) Invertible() bool { func (m *DrawMatrix) Invertible() bool {
cm := m.toC() cm := m.toLibui()
res := C.uiDrawMatrixInvertible(cm) res := C.uiDrawMatrixInvertible(cm)
C.pkguiFreeMatrix(cm) C.pkguiFreeMatrix(cm)
return tobool(res) return tobool(res)
@ -408,32 +414,32 @@ func (m *Matrix) Invertible() bool {
// TODO // TODO
// //
// If m is not invertible, false is returned and m is left unchanged. // If m is not invertible, false is returned and m is left unchanged.
func (m *Matrix) Invert() bool { func (m *DrawMatrix) Invert() bool {
cm := m.toC() cm := m.toLibui()
res := C.uiDrawMatrixInvert(cm) res := C.uiDrawMatrixInvert(cm)
m.fromC(cm) m.fromLibui(cm)
return tobool(res) return tobool(res)
} }
// TODO unimplemented // TODO unimplemented
func (m *Matrix) TransformPoint(x float64, y float64) (xout float64, yout float64) { func (m *DrawMatrix) TransformPoint(x float64, y float64) (xout float64, yout float64) {
panic("TODO") panic("TODO")
} }
// TODO unimplemented // TODO unimplemented
func (m *Matrix) TransformSize(x float64, y float64) (xout float64, yout float64) { func (m *DrawMatrix) TransformSize(x float64, y float64) (xout float64, yout float64) {
panic("TODO") panic("TODO")
} }
// TODO // TODO
func (c *DrawContext) Transform(m *Matrix) { func (c *DrawContext) Transform(m *DrawMatrix) {
cm := m.toC() cm := m.toLibui()
C.uiDrawTransform(c.c, cm) C.uiDrawTransform(c.c, cm)
C.pkguiFreeMatrix(cm) C.pkguiFreeMatrix(cm)
} }
// TODO // TODO
func (c *DrawContext) Clip(p *Path) { func (c *DrawContext) Clip(p *DrawPath) {
C.uiDrawClip(c.c, p.p) C.uiDrawClip(c.c, p.p)
} }