github.com/amitbet/vnc2video@v0.0.0-20190616012314-9d50b9dab1d9/encoding_pointer_pos.go (about) 1 package vnc2video 2 3 import ( 4 "image" 5 "image/draw" 6 "github.com/amitbet/vnc2video/logger" 7 ) 8 9 type CursorPosPseudoEncoding struct { 10 prevPosBackup draw.Image 11 prevPositionRect image.Rectangle 12 cursorImage draw.Image 13 Image draw.Image 14 } 15 16 func (*CursorPosPseudoEncoding) Supported(Conn) bool { 17 return true 18 } 19 20 func (enc *CursorPosPseudoEncoding) SetTargetImage(img draw.Image) { 21 enc.Image = img 22 } 23 24 func (enc *CursorPosPseudoEncoding) Reset() error { 25 return nil 26 } 27 28 func (*CursorPosPseudoEncoding) Type() EncodingType { return EncPointerPosPseudo } 29 30 func (enc *CursorPosPseudoEncoding) Read(c Conn, rect *Rectangle) error { 31 logger.Tracef("CursorPosPseudoEncoding: got cursot pos update: %v", rect) 32 canvas := enc.Image.(*VncCanvas) 33 canvas.CursorLocation = &image.Point{X: int(rect.X), Y: int(rect.Y)} 34 return nil 35 } 36 37 func (enc *CursorPosPseudoEncoding) Write(c Conn, rect *Rectangle) error { 38 39 return nil 40 }