summaryrefslogtreecommitdiff
path: root/renderer.h
blob: 3cd456d7d4cee6cf67b1ec0815bda2c6c365d2b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
/**
 *  GraphTFT plugin for the Video Disk Recorder 
 * 
 *  renderer.h - A plugin for the Video Disk Recorder
 *
 *  (c) 2005-2013 Jörg Wendel
 *
 * This code is distributed under the terms and conditions of the
 * GNU GENERAL PUBLIC LICENSE. See the file COPYING for details.
 *
 **/

#ifndef __GTFT_RENDERER_H
#define __GTFT_RENDERER_H

#include <string>

#include <common.h>

using std::string;

//***************************************************************************
// used as base class of the renderes
//***************************************************************************

class Renderer
{
   public:

      Renderer(int x, int y, int width, int height, 
               string cfgPath, int utf, string thmPath);
      virtual ~Renderer();

      virtual void setDevName(const char* _devname);
      virtual void setProperties(int x, int y, 
                                 int width, int height, 
                                 int utf, string thmPath);
      virtual void setBorder(int widthBorder, 
                              int heightBorder);
      virtual void setDisplaySize(int width, int height) { }
      virtual void setFontPath(string fntPath) = 0;
      virtual int init(int lazy) = 0;
      virtual void flushCache() {};
      virtual void deinit() = 0;

      virtual long toJpeg(unsigned char*& buffer, int quality) = 0;

      virtual void refresh(int force = no) = 0;
      virtual void refreshArea(int x, int y, int width, int height) {}
      virtual void clear() = 0;

      virtual int textWidthOf(const char* text, const char* fontName, int fontSize, int& height) = 0;
      virtual int charWidthOf(const char* fontName = 0, 
                              int fontSize = 0) = 0;
      virtual void image(const char* fname, int x, int y, 
                         int width, int height, 
                         bool fit = no, bool aspectRatio = no, 
                         int orientation = 1) = 0;

      virtual void imagePart(const char* fname, int x, int y, 
                             int width, int height) = 0;

      virtual int text(const char *text, const char *font_name, 
                       int size, int align, int x, int y, 
                       p_rgba rgba, // int r, int g, int b, 
                       int width, int height,
                       int lines, int dots = 0, int skipLines = 0) = 0;

      virtual int lineCount(const char* text, const char* font_name, 
                            int size, int width) = 0;

      virtual void rectangle(int x, int y, int width, int height, 
                             p_rgba rgba) = 0;
                         // int r, int g, int b, int alpha) = 0;

      virtual void dumpImage2File(const char* fname, 
                                  int dumpWidth, int dumpHeight, 
                                  const char* aPath = 0) = 0;

      virtual int xPending()                      { return done; }
      virtual int attach(const char* disp = 0)    { return done; }
      virtual int detach()                        { return done; }

   protected:

      string confPath;
      string themePath;
      int utf8;
      int xOffset;
      int yOffset;
      int themeWidth;
      int themeHeight;
      int xBorder;
      int yBorder;

      int dspWidth;
      int dspHeight;
      char* devname;
};

//***************************************************************************
#endif // __GTFT_RENDERER_H