vncproxy/encodings/enc-rre.go
amit bezalel 66c322c164 added a vnc server and the required client messages parsers.
now I should get to tying up the proxying connections and checking what should be written to the file. (server init?)
2017-06-21 00:42:06 +03:00

28 lines
718 B
Go

package encodings
import "vncproxy/common"
type RREEncoding struct {
//Colors []Color
}
func (z *RREEncoding) Type() int32 {
return 2
}
func (z *RREEncoding) Read(pixelFmt *common.PixelFormat, rect *common.Rectangle, r *common.RfbReadHelper) (common.Encoding, error) {
//conn := common.RfbReadHelper{Reader:r}
bytesPerPixel := int(pixelFmt.BPP / 8)
numOfSubrectangles, _ := r.ReadUint32()
//read whole rect background color
r.ReadBytes(bytesPerPixel)
//read all individual rects (color=bytesPerPixel + x=16b + y=16b + w=16b + h=16b)
_, err := r.ReadBytes(int(numOfSubrectangles) * (bytesPerPixel + 8)) // x+y+w+h=8 bytes
if err != nil {
return nil, err
}
return z, nil
}