addceck for imgprovider
This commit is contained in:
parent
5f12adaa92
commit
f4450e7e3d
@ -2,7 +2,6 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"image"
|
"image"
|
||||||
"strconv"
|
"strconv"
|
||||||
)
|
)
|
||||||
@ -11,11 +10,15 @@ import (
|
|||||||
|
|
||||||
Image {
|
Image {
|
||||||
source: "image://images/`*/
|
source: "image://images/`*/
|
||||||
|
var imgready = false
|
||||||
|
|
||||||
func imgProvider(id string, width, height int) image.Image {
|
func imgProvider(id string, width, height int) image.Image {
|
||||||
var i int
|
if imgready {
|
||||||
fmt.Println("id: ", id)
|
i, _ := strconv.Atoi(id)
|
||||||
i, _ = strconv.Atoi(id)
|
return slides[i].getImage(width, height)
|
||||||
fmt.Println("haha: ", i)
|
|
||||||
return slides[i].getImage(width, height)
|
} else {
|
||||||
|
var img1 image.Image = image.NewRGBA(image.Rect(0, 0, 340, 480))
|
||||||
|
return img1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
13
main.go
13
main.go
@ -55,7 +55,7 @@ func main() {
|
|||||||
func run() error {
|
func run() error {
|
||||||
var mainQml qml.Object
|
var mainQml qml.Object
|
||||||
imagick.Initialize()
|
imagick.Initialize()
|
||||||
defer imagick.Terminate()
|
|
||||||
mw1 = imagick.NewMagickWand()
|
mw1 = imagick.NewMagickWand()
|
||||||
|
|
||||||
err = mw1.ReadImage("logo:")
|
err = mw1.ReadImage("logo:")
|
||||||
@ -89,6 +89,7 @@ func run() error {
|
|||||||
textEdit = window.ObjectByName("textEdit")
|
textEdit = window.ObjectByName("textEdit")
|
||||||
slides.addCell()
|
slides.addCell()
|
||||||
setSignals()
|
setSignals()
|
||||||
|
imgready = true
|
||||||
|
|
||||||
window.Show()
|
window.Show()
|
||||||
qml.RunMain(glInit)
|
qml.RunMain(glInit)
|
||||||
@ -112,6 +113,7 @@ func setupScene() {
|
|||||||
gl.Ortho(-1, 1, -1, 1, 1.0, 10.0)
|
gl.Ortho(-1, 1, -1, 1, 1.0, 10.0)
|
||||||
gl.MatrixMode(gl.MODELVIEW)
|
gl.MatrixMode(gl.MODELVIEW)
|
||||||
gl.LoadIdentity()
|
gl.LoadIdentity()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func drawSlide() {
|
func drawSlide() {
|
||||||
@ -156,6 +158,7 @@ func newTexture(rgba image.RGBA) uint32 {
|
|||||||
gl.Ptr(rgba.Pix))
|
gl.Ptr(rgba.Pix))
|
||||||
|
|
||||||
return texture1
|
return texture1
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkMon() {
|
func checkMon() {
|
||||||
@ -198,6 +201,7 @@ func monitorInfo() {
|
|||||||
fmt.Printf("monitor name: %s\n", mon.GetName())
|
fmt.Printf("monitor name: %s\n", mon.GetName())
|
||||||
i, t := mon.GetPos()
|
i, t := mon.GetPos()
|
||||||
fmt.Printf("position X: %d Y: %d\n", i, t)
|
fmt.Printf("position X: %d Y: %d\n", i, t)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -222,13 +226,14 @@ func glInit() {
|
|||||||
drawSlide()
|
drawSlide()
|
||||||
win.SwapBuffers()
|
win.SwapBuffers()
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
win.Hide()
|
win.Hide()
|
||||||
win.Destroy()
|
win.Destroy()
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func setSignals() {
|
func setSignals() {
|
||||||
@ -285,11 +290,11 @@ func (cl *cell) setSignal() {
|
|||||||
cl.qmlcell.ObjectByName("cellMouse").On("doubleClicked", func() {
|
cl.qmlcell.ObjectByName("cellMouse").On("doubleClicked", func() {
|
||||||
|
|
||||||
textEdit.Set("cell", cl.index)
|
textEdit.Set("cell", cl.index)
|
||||||
textEdit.Set("x", cl.qmlcell.Int("x"))
|
textEdit.Set("x", cl.qmlcell.Int("x"))
|
||||||
textEdit.Set("y", cl.qmlcell.Int("y"))
|
textEdit.Set("y", cl.qmlcell.Int("y"))
|
||||||
textEdit.Set("width", cl.qmlcell.Int("width"))
|
textEdit.Set("width", cl.qmlcell.Int("width"))
|
||||||
textEdit.Set("height", cl.qmlcell.Int("height"))
|
textEdit.Set("height", cl.qmlcell.Int("height"))
|
||||||
textEdit.Set("z", 100)
|
textEdit.Set("z", 100)
|
||||||
textEdit.Set("opacity", 100)
|
textEdit.Set("opacity", 100)
|
||||||
textEdit.Set("visible", true)
|
textEdit.Set("visible", true)
|
||||||
textEdit.ObjectByName("textEdit1").Set("focus", true)
|
textEdit.ObjectByName("textEdit1").Set("focus", true)
|
||||||
|
Loading…
Reference in New Issue
Block a user