]> git.vomp.tv Git - vompclient.git/blob - surface.h
Remove pixel based apis, preparation for vector based osd
[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 \r
47 \r
48 \r
49 class Surface\r
50 {\r
51   friend class Wwss;\r
52   public:\r
53     Surface(int id = 0);\r
54     virtual ~Surface();\r
55 \r
56     static Surface* getScreen();\r
57     virtual int getFontHeight();\r
58     virtual int getCharWidth(char c);\r
59 \r
60     virtual int drawText(const char* text, int x, int y, ULONG rgba);\r
61     virtual int drawText(const char* text, int x, int y, int width, ULONG rgba);\r
62     virtual int drawTextRJ(const char* text, int x, int y, ULONG rgba);\r
63     virtual int drawTextCentre(const char* text, int x, int y, ULONG rgba);\r
64 \r
65     virtual void drawJpeg(const char *fileName,int x, int y,int *width, int *height) {}\r
66 \r
67     virtual int create(UINT width, UINT height)=0;\r
68     virtual void display()=0;\r
69 \r
70     virtual int fillblt(int x, int y, int width, int height, unsigned int c)=0;\r
71     virtual void drawHorzLine(int x1, int x2, int y, unsigned int c)=0;\r
72     virtual void drawVertLine(int x, int y1, int y2, unsigned int c)=0;\r
73     virtual void drawBitmap(int x, int y, const Bitmap& bm)=0;\r
74     virtual void drawPoint(int x, int y, Colour& c, bool fastdraw=false); // This draws a point, must not be a pixel\r
75     virtual void drawMonoBitmap(UCHAR* base, int dx, int dy, unsigned int height,unsigned int width, Colour& nextColour);\r
76     virtual int updateToScreen(int sx, int sy, int w, int h, int dx, int dy)=0;\r
77     virtual void readPixel(int x, int y, unsigned char* r, unsigned char* g, unsigned char* b)=0;\r
78     virtual void screenShot(const char* fileName)=0;\r
79 \r
80     /* This is for system which need a locking of the drawing surface to speed up drawing */\r
81     virtual void startFastDraw() {};\r
82     virtual void endFastDraw() {};\r
83 \r
84 \r
85     virtual void drawTTChar(int ox, int oy,int x, int y, cTeletextChar c);\r
86 \r
87 \r
88   \r
89 \r
90    // 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
91 \r
92     const static int SCREEN = 1;\r
93     const static int BUFFER = 2;\r
94 \r
95   protected:\r
96     static Surface* screen;\r
97     static osd_font_t* font;\r
98     Colour enumTeletextColorToCoulour(enumTeletextColor ttcol);\r
99 \r
100     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
101     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
102 \r
103 };\r
104 \r
105 #endif\r