blob: 26d579630fbdacac0cf7acf62e1767a638b526fc [file] [log] [blame]
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +00001/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
DRCb4a83232011-08-19 04:57:18 +00002 * Copyright (C) 2011 D. R. Commander. All Rights Reserved.
Pierre Ossman316a3242014-01-15 12:40:20 +01003 * Copyright 2014 Pierre Ossman for Cendio AB
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +00004 *
5 * This is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This software is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this software; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
18 * USA.
19 */
20#ifndef __RFB_ENCODER_H__
21#define __RFB_ENCODER_H__
22
23#include <rfb/Rect.h>
Pierre Ossman316a3242014-01-15 12:40:20 +010024#include <rfb/TransImageGetter.h>
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000025
26namespace rfb {
27 class SMsgWriter;
Pierre Ossman456b2c22014-01-15 13:22:03 +010028 class TransImageGetter;
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000029
30 class Encoder {
31 public:
32 virtual ~Encoder();
33
34 virtual void setCompressLevel(int level) {};
35 virtual void setQualityLevel(int level) {};
Pierre Ossmanb948a912014-01-15 13:23:43 +010036 virtual void setFineQualityLevel(int quality, int subsampling) {};
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000037 virtual int getNumRects(const Rect &r) { return 1; }
38
39 // writeRect() tries to write the given rectangle. If it is unable to
40 // write the whole rectangle it returns false and sets actual to the actual
41 // rectangle which was updated.
DRCffe09d62011-08-17 02:27:59 +000042 virtual bool writeRect(const Rect& r, TransImageGetter* ig,
43 Rect* actual)=0;
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000044
Peter Åstrand98fe98c2010-02-10 07:43:02 +000045 static bool supported(int encoding);
46 static Encoder* createEncoder(int encoding, SMsgWriter* writer);
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000047 };
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000048}
49
50#endif