]> git.vomp.tv Git - vompclient.git/blob - surface.h
Sleep timer
[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 Surface
43 {
44   public:
45     Surface(int id = 0);
46     virtual ~Surface();
47
48     static Surface* getScreen();
49     static int getFontHeight();
50     int getCharWidth(char c);
51
52     int drawText(const char* text, int x, int y, ULONG rgba);
53     int drawText(const char* text, int x, int y, int width, ULONG rgba);
54     int drawTextRJ(const char* text, int x, int y, ULONG rgba);
55     int drawTextCentre(const char* text, int x, int y, ULONG rgba);
56
57     virtual int create(UINT width, UINT height)=0;
58     virtual void display()=0;
59
60     virtual int fillblt(int x, int y, int width, int height, unsigned int c)=0;
61     virtual void drawPixel(int x, int y, unsigned int c)=0;
62     virtual void drawHorzLine(int x1, int x2, int y, unsigned int c)=0;
63     virtual void drawVertLine(int x, int y1, int y2, unsigned int c)=0;
64     virtual int updateToScreen(int sx, int sy, int w, int h, int dx, int dy)=0;
65     virtual void readPixel(int x, int y, unsigned char* r, unsigned char* g, unsigned char* b)=0;
66     virtual void screenShot(char* fileName)=0;
67
68     /* This is for system which need a locking of the drawing surface to speed up drawing */
69     virtual void startFastDraw() {};
70     virtual void endFastDraw() {};
71   
72
73     virtual int blt(int fd, unsigned long shandle, int sx, int sy, int width, int height, unsigned long dhandle, int dx, int dy)=0;
74
75     const static int SCREEN = 1;
76     const static int BUFFER = 2;
77
78   protected:
79     static Surface* screen;
80     static osd_font_t* font;
81 };
82
83 #endif