summaryrefslogtreecommitdiff
path: root/imlibrenderer/imlibrenderer.h
blob: 5ef79abcc0941b768ec95d8f73eb6bf4fdfd72e1 (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
/**
 *  GraphTFT plugin for the Video Disk Recorder 
 * 
 *  imlibrenderer.h
 *
 *  (c) 2004 Lars Tegeler, Sascha Volkenandt
 *  (c) 2006-2014 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_IMLIBRENDERER_HPP
#define __GTFT_IMLIBRENDERER_HPP

#include "renderer.h"

#ifndef WITH_X
#  define X_DISPLAY_MISSING
#endif

#include <Imlib2.h>

#undef Status

//***************************************************************************
// Class ImlibRenderer
//***************************************************************************

class ImlibRenderer : public Renderer
{
	public:

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

      int init(int lazy);
      void deinit();
      void flushCache();
      void setFontPath(string fntPath);

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

		virtual void refresh(int force = no);
		virtual void clear();

      int textWidthOf(const char* text, const char* fontName, int fontSize, int& height);
      int charWidthOf(const char* fontName = 0, int fontSize = 0);

		void image(const char* fname, int x, int y, 
                 int coverwidth, int coverheight, 
                 bool fit = no, bool aspectRatio = no, 
                 int orientation = 1);
      void imagePart(const char* fname, int x, int y, int width, int height);

		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);

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

      void rectangle(int x, int y, int width, int height, p_rgba rgba);

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

   protected:

		Imlib_Image _cur_image;               // the image you're working on
		Imlib_Image _render_image;            // the image buffer for scaling
		Imlib_Image* pImageToDisplay;         // pointer to the image for displaying
};

//***************************************************************************
#endif // __GTFT_IMLIBRENDERER_H