vncproxy/encodings/enc-copy-rect.go
Yoan Blanc 11b1d45ce9
global: make the whole package go mod ready
Signed-off-by: Yoan Blanc <yoan.blanc@exoscale.ch>
2018-11-30 09:40:45 +01:00

37 lines
749 B
Go

package encodings
import (
"encoding/binary"
"io"
"github.com/amitbet/vncproxy/common"
)
type CopyRectEncoding struct {
//Colors []Color
copyRectSrcX uint16
copyRectSrcY uint16
}
func (z *CopyRectEncoding) Type() int32 {
return 1
}
func (z *CopyRectEncoding) WriteTo(w io.Writer) (n int, err error) {
binary.Write(w, binary.BigEndian, z.copyRectSrcX)
if err != nil {
return 0, err
}
binary.Write(w, binary.BigEndian, z.copyRectSrcY)
if err != nil {
return 0, err
}
return 4, nil
}
func (z *CopyRectEncoding) Read(pixelFmt *common.PixelFormat, rect *common.Rectangle, r *common.RfbReadHelper) (common.IEncoding, error) {
z.copyRectSrcX, _ = r.ReadUint16()
z.copyRectSrcY, _ = r.ReadUint16()
return z, nil
}
//////////