andlabs / ui

Platform-native GUI library for Go.
Other
8.34k stars 647 forks source link

Added missing bindings for matrix #329

Closed 0xDiddi closed 2 years ago

0xDiddi commented 5 years ago
0xDiddi commented 2 years ago

I'm cleaning up my github, and due to complete lack of interest in the past ... checks calendar ... almost three years, I'll be closing this PR and deleting the changed branch.

If, for some reason, anyone else happens to need these changes at some point, the relevant modifications to the draw.go file are given below:

func (m *DrawMatrix) TransformPoint(x float64, y float64) (xout float64, yout float64) {
    cm := m.toLibui()
    cx, cy := C.double(x), C.double(y)
    C.uiDrawMatrixTransformPoint(cm, &cx, &cy)
    C.pkguiFreeMatrix(cm)
    return float64(cx), float64(cy)
}

func (m *DrawMatrix) TransformSize(x float64, y float64) (xout float64, yout float64) {
    cm := m.toLibui()
    cx, cy := C.double(x), C.double(y)
    C.uiDrawMatrixTransformSize(cm, &cx, &cy)
    C.pkguiFreeMatrix(cm)
    return float64(cx), float64(cy)
}

I give no guarantees of any kind that this still works, all I can say is that "it worked on my machine™" 3 years ago.