]> git.vomp.tv Git - vompclient.git/blob - surface.h
Update for windows
[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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19 */
20
21 #ifndef SURFACE_H
22 #define SURFACE_H
23
24 #include <stdio.h>
25 #include "defines.h"
26 #include "log.h"
27
28 // Font stuff
29
30 typedef struct bogl_font {
31   char *name;     /* Font name. */
32   int height;     /* Height in pixels. */
33   int spacing;     /* Vertical spacing in pixels. */
34   unsigned long *content;   /* 32-bit right-padded bitmap array. */
35   short *offset;      /* 256 offsets into content. */
36   unsigned char *width;   /* 256 character widths. */
37 } osd_font_t;
38
39 extern osd_font_t font_CaslonRoman_1_25;
40 extern osd_font_t font_helvB24;
41 extern osd_font_t font_helvB18;
42
43 class Surface
44 {
45   public:
46     Surface(int id = 0);
47     virtual ~Surface();
48
49     static Surface* getScreen();
50     static int getFontHeight();
51     int getCharWidth(char c);
52
53     int drawText(char* text, int x, int y, ULONG rgba);
54     int drawTextRJ(char* text, int x, int y, ULONG rgba);
55     int drawTextCentre(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     virtual int blt(int fd, unsigned long shandle, int sx, int sy, int width, int height, unsigned long dhandle, int dx, int dy)=0;
69
70     const static int SCREEN = 1;
71     const static int BUFFER = 2;
72
73   protected:
74     static Surface* screen;
75     static osd_font_t* font;
76 };
77
78 #endif