]> git.vomp.tv Git - vompclient.git/blob - surface.h
Preparations for dynamic mode switching
[vompclient.git] / surface.h
1 /*\r
2     Copyright 2004-2005 Chris Tallon\r
3 \r
4     This file is part of VOMP.\r
5 \r
6     VOMP is free software; you can redistribute it and/or modify\r
7     it under the terms of the GNU General Public License as published by\r
8     the Free Software Foundation; either version 2 of the License, or\r
9     (at your option) any later version.\r
10 \r
11     VOMP is distributed in the hope that it will be useful,\r
12     but WITHOUT ANY WARRANTY; without even the implied warranty of\r
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
14     GNU General Public License for more details.\r
15 \r
16     You should have received a copy of the GNU General Public License\r
17     along with VOMP; if not, write to the Free Software\r
18     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.\r
19 */\r
20 \r
21 #ifndef SURFACE_H\r
22 #define SURFACE_H\r
23 \r
24 #include <stdio.h>\r
25 #include "defines.h"\r
26 #include "colour.h"\r
27 \r
28 #include "teletextdecodervbiebu.h"\r
29 \r
30 // Font stuff\r
31 \r
32 typedef struct bogl_font {\r
33   char *name;     /* Font name. */\r
34   int height;     /* Height in pixels. */\r
35   int spacing;     /* Vertical spacing in pixels. */\r
36   unsigned long *content;   /* 32-bit right-padded bitmap array. */\r
37   short *offset;      /* 256 offsets into content. */\r
38   unsigned char *width;   /* 256 character widths. */\r
39 } osd_font_t;\r
40 \r
41 //extern osd_font_t font_CaslonRoman_1_25;\r
42 //extern osd_font_t font_helvB24;\r
43 extern osd_font_t font_helvB18;\r
44 \r
45 class Bitmap;\r
46 class DisplayRegion;\r
47 \r
48 \r
49 \r
50 class Surface\r
51 {\r
52   friend class Wwss; // classes that need surface access, their usage is forbidden for vector based\r
53   friend class WJpegComplex;// implementations of osd\r
54   friend class VColourTuner;
55   public:\r
56     Surface(int id = 0);\r
57     virtual ~Surface();\r
58 \r
59     static Surface* getScreen();\r
60     virtual int getFontHeight();\r
61     virtual float getCharWidth(wchar_t c);\r
62     virtual wchar_t getWChar(const char* str, unsigned int *length);\r
63 \r
64     virtual int drawText(const char* text, int x, int y, const DrawStyle& c);\r
65     virtual int drawText(const char* text, int x, int y, int width, const DrawStyle& c);\r
66     virtual int drawTextRJ(const char* text, int x, int y, const DrawStyle& c);\r
67     virtual int drawTextCentre(const char* text, int x, int y, const DrawStyle& c);\r
68 \r
69     virtual void drawJpeg(const char *fileName,int x, int y,int *width, int *height) {}\r
70 \r
71     virtual int create(UINT width, UINT height)=0;\r
72     virtual void display()=0;\r
73 \r
74     virtual int fillblt(int x, int y, int width, int height, const DrawStyle& c)=0;\r
75     virtual void drawHorzLine(int x1, int x2, int y, const DrawStyle& c)=0;\r
76     virtual void drawVertLine(int x, int y1, int y2, const DrawStyle& c)=0;\r
77     virtual void drawBitmap(int x, int y, const Bitmap& bm,const DisplayRegion & region)=0;\r
78     virtual void drawPoint(int x, int y, DrawStyle& c, bool fastdraw=false); // This draws a point, must not be a pixel\r
79     virtual void drawMonoBitmap(UCHAR* base, int dx, int dy, unsigned int height,unsigned int width, Colour& nextColour);\r
80     virtual int updateToScreen(int sx, int sy, int w, int h, int dx, int dy)=0;\r
81     virtual void readPixel(int x, int y, unsigned char* r, unsigned char* g, unsigned char* b)=0;\r
82     virtual void screenShot(const char* fileName)=0;\r
83 \r
84     /* This is for system which need a locking of the drawing surface to speed up drawing */\r
85     virtual void startFastDraw() {};\r
86     virtual void endFastDraw() {};\r
87 \r
88 \r
89     virtual void drawTTChar(int ox, int oy,int x, int y, cTeletextChar c);\r
90     static Colour enumTeletextColorToCoulour(enumTeletextColor ttcol);\r
91 \r
92 \r
93   \r
94 \r
95    // virtual int blt(int fd, unsigned long shandle, int sx, int sy, int width, int height, unsigned long dhandle, int dx, int dy)=0;\r
96 \r
97     const static int SCREEN = 1;\r
98     const static int BUFFER = 2;\r
99 \r
100   protected:\r
101     static Surface* screen;\r
102     static osd_font_t* font;\r
103 \r
104 \r
105     virtual void drawPixel(int x, int y, unsigned int c, bool fastdraw=false)=0; // deprecated preparation for vector based drawing, only allowed to be called inside implementation\r
106     virtual void drawPixel(int x, int y, Colour& c, bool fastdraw=false)=0; // deprecated preparation for vector based drawing, only allowed to be called inside implementation\r
107 \r
108 };\r
109 \r
110 #endif\r