API Documentation
Loading...
Searching...
No Matches
TightDecoder.h
Go to the documentation of this file.
1#pragma once
2#ifndef TIGHT_VNC
3#define TIGHT_VNC
5#include <QRect>
6#include <QImage>
7struct z_stream_s;
8class QTcpSocket;
9namespace NDEVR
10{
11 struct PixelFormat;
12 // Compression control
14 {
15 public:
17 : underlying(0)
18 , zs(NULL)
19 {
20 init();
21 }
22
24 {
25 deinit();
26 }
27
28 void setUnderlying(const uint01* is, size_t bytesIn_)
29 {
30 underlying.addAll(is, bytesIn_);
31 }
32
34 {
35 setUnderlying(NULL, 0);
36 }
37
38 void reset()
39 {
40 underlying.clear();
41 deinit();
42 init();
43 }
44
45 void init();
46
47 void deinit();
48 bool readBytes(uint01* data, size_t length);
49 private:
50 Buffer<uint01> underlying;
51 z_stream_s* zs;
52 //size_t bytesIn;
53
54 };
55 /**--------------------------------------------------------------------------------------------------
56 \brief Decodes a VNC stream from TightVNC
57 **/
59 {
60
61 public:
63 {
64
65 }
66 virtual ~TightDecoder()
67 {
68
69 }
70 static void ReadAll(QTcpSocket* is, uint01* os, uint04 size);
71 static void CopyToBuffer(uint01*& buffer, void* value, uint04 size, uint04& total_size)
72 {
73 memcpy(buffer, value, size);
74 buffer += size;
75 total_size += size;
76 }
77 static bool ReadRect(const QRect& r, QTcpSocket* is, const PixelFormat& pf, QImage& pb);
78
79
80 private:
81 static uint04 ReadCompact(QTcpSocket* is);
82 static void FilterGradient(const uint01* inbuf, const PixelFormat& pf, uint04* outbuf, int stride, const QRect& r);
83
84 static void FilterPalette(const uint01* palette, uint04 palSize, const uint01* inbuf, uint01* outbuf, int stride, const QRect& r, uint04 pixel_size);
85
86 private:
87 static ZlibInStream zis[4];
88 };
89}
90#endif
The equivelent of std::vector but with a bit more control. The basic array unit of the library.
Definition Buffer.hpp:56
void addAll(const Buffer< t_type, t_other_index_type, t_other_memory_allocator, t_other_memory_manager > &buffer)
Definition Buffer.hpp:243
void clear()
Definition Buffer.hpp:422
Decodes a VNC stream from TightVNC.
Definition TightDecoder.h:59
static void CopyToBuffer(uint01 *&buffer, void *value, uint04 size, uint04 &total_size)
Definition TightDecoder.h:71
TightDecoder()
Definition TightDecoder.h:62
virtual ~TightDecoder()
Definition TightDecoder.h:66
static bool ReadRect(const QRect &r, QTcpSocket *is, const PixelFormat &pf, QImage &pb)
static void ReadAll(QTcpSocket *is, uint01 *os, uint04 size)
Definition TightDecoder.h:14
void flushUnderlying()
Definition TightDecoder.h:33
ZlibInStream()
Definition TightDecoder.h:16
~ZlibInStream()
Definition TightDecoder.h:23
bool readBytes(uint01 *data, size_t length)
void setUnderlying(const uint01 *is, size_t bytesIn_)
Definition TightDecoder.h:28
void reset()
Definition TightDecoder.h:38
Definition ACIColor.h:37
uint8_t uint01
-Defines an alias representing a 1 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:80
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:96