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