forked from deluan/vnc2video
-
Notifications
You must be signed in to change notification settings - Fork 0
/
encoding_pointer_pos.go
41 lines (31 loc) · 972 Bytes
/
encoding_pointer_pos.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package vnc2video
import (
"image"
"image/draw"
"github.com/andrewheberle/vnc2video/logger"
)
type CursorPosPseudoEncoding struct {
prevPosBackup draw.Image
prevPositionRect image.Rectangle
cursorImage draw.Image
Image draw.Image
}
func (*CursorPosPseudoEncoding) Supported(Conn) bool {
return true
}
func (enc *CursorPosPseudoEncoding) SetTargetImage(img draw.Image) {
enc.Image = img
}
func (enc *CursorPosPseudoEncoding) Reset() error {
return nil
}
func (*CursorPosPseudoEncoding) Type() EncodingType { return EncPointerPosPseudo }
func (enc *CursorPosPseudoEncoding) Read(c Conn, rect *Rectangle) error {
logger.Tracef("CursorPosPseudoEncoding: got cursot pos update: %v", rect)
canvas := enc.Image.(*VncCanvas)
canvas.CursorLocation = &image.Point{X: int(rect.X), Y: int(rect.Y)}
return nil
}
func (enc *CursorPosPseudoEncoding) Write(c Conn, rect *Rectangle) error {
return nil
}