]> git.vomp.tv Git - vompclient.git/blob - surface.h
DVB Subtitles
[vompclient.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
27 // Font stuff
28
29 typedef struct bogl_font {
30   char *name;     /* Font name. */
31   int height;     /* Height in pixels. */
32   int spacing;     /* Vertical spacing in pixels. */
33   unsigned long *content;   /* 32-bit right-padded bitmap array. */
34   short *offset;      /* 256 offsets into content. */
35   unsigned char *width;   /* 256 character widths. */
36 } osd_font_t;
37
38 extern osd_font_t font_CaslonRoman_1_25;
39 extern osd_font_t font_helvB24;
40 extern osd_font_t font_helvB18;
41
42 class Bitmap;
43
44 class Surface
45 {
46   public:
47     Surface(int id = 0);
48     virtual ~Surface();
49
50     static Surface* getScreen();
51     static int getFontHeight();
52     int getCharWidth(char c);
53
54     int drawText(const char* text, int x, int y, ULONG rgba);
55     int drawText(const char* text, int x, int y, int width, ULONG rgba);
56     int drawTextRJ(const char* text, int x, int y, ULONG rgba);
57     int drawTextCentre(const char* text, int x, int y, ULONG rgba);
58
59     virtual int create(UINT width, UINT height)=0;
60     virtual void display()=0;
61
62     virtual int fillblt(int x, int y, int width, int height, unsigned int c)=0;
63     virtual void drawPixel(int x, int y, unsigned int c)=0;
64     virtual void drawHorzLine(int x1, int x2, int y, unsigned int c)=0;
65     virtual void drawVertLine(int x, int y1, int y2, unsigned int c)=0;
66     virtual void drawBitmap(int x, int y, const Bitmap& bm)=0;
67     virtual int updateToScreen(int sx, int sy, int w, int h, int dx, int dy)=0;
68     virtual void readPixel(int x, int y, unsigned char* r, unsigned char* g, unsigned char* b)=0;
69     virtual void screenShot(char* fileName)=0;
70
71     /* This is for system which need a locking of the drawing surface to speed up drawing */
72     virtual void startFastDraw() {};
73     virtual void endFastDraw() {};
74   
75
76     virtual int blt(int fd, unsigned long shandle, int sx, int sy, int width, int height, unsigned long dhandle, int dx, int dy)=0;
77
78     const static int SCREEN = 1;
79     const static int BUFFER = 2;
80
81   protected:
82     static Surface* screen;
83     static osd_font_t* font;
84 };
85
86 #endif