Added missing bindings for matrix

- .TransformPoint(...) has been proven to work on mac
- .TransformSize(...) should therefore work as well as it's basically the same
- vs code also ran go fmt so there's that
This commit is contained in:
Marvin Musold 2018-10-24 10:12:08 +02:00
parent 867a9e5a49
commit 19f15f34d1
1 changed files with 57 additions and 43 deletions

22
draw.go
View File

@ -44,6 +44,7 @@ type DrawPath struct {
//
// TODO disclaimer
type DrawFillMode uint
const (
DrawFillModeWinding DrawFillMode = iota
DrawFillModeAlternate
@ -161,6 +162,7 @@ type DrawContext struct {
//
// TODO disclaimer
type DrawBrushType int
const (
DrawBrushTypeSolid DrawBrushType = iota
DrawBrushTypeLinearGradient
@ -173,6 +175,7 @@ const (
// TODO disclaimer
// TODO rename these to put LineCap at the beginning? or just Cap?
type DrawLineCap int
const (
DrawLineCapFlat DrawLineCap = iota
DrawLineCapRound
@ -183,6 +186,7 @@ const (
//
// TODO disclaimer
type DrawLineJoin int
const (
DrawLineJoinMiter DrawLineJoin = iota
DrawLineJoinRound
@ -421,14 +425,24 @@ func (m *DrawMatrix) Invert() bool {
return tobool(res)
}
// TODO unimplemented
// TODO
//
// Transforms a point by this matrix
func (m *DrawMatrix) TransformPoint(x float64, y float64) (xout float64, yout float64) {
panic("TODO")
cm := m.toLibui()
cx, cy := C.double(x), C.double(y)
C.uiDrawMatrixTransformPoint(cm, &cx, &cy)
C.pkguiFreeMatrix(cm)
return float64(cx), float64(cy)
}
// TODO unimplemented
// TODO
func (m *DrawMatrix) TransformSize(x float64, y float64) (xout float64, yout float64) {
panic("TODO")
cm := m.toLibui()
cx, cy := C.double(x), C.double(y)
C.uiDrawMatrixTransformSize(cm, &cx, &cy)
C.pkguiFreeMatrix(cm)
return float64(cx), float64(cy)
}
// TODO