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