]> git.vomp.tv Git - vompclient.git/blob - surfacewin.h
Preparations for dynamic mode switching
[vompclient.git] / surfacewin.h
1 /*\r
2     Copyright 2006 Marten Richter\r
3 \r
4     This file is part of VOMP.\r
5 \r
6     VOMP is free software; you can redistribute it and/or modify\r
7     it under the terms of the GNU General Public License as published by\r
8     the Free Software Foundation; either version 2 of the License, or\r
9     (at your option) any later version.\r
10 \r
11     VOMP is distributed in the hope that it will be useful,\r
12     but WITHOUT ANY WARRANTY; without even the implied warranty of\r
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
14     GNU General Public License for more details.\r
15 \r
16     You should have received a copy of the GNU General Public License\r
17     along with VOMP; if not, write to the Free Software\r
18     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.\r
19 */\r
20 \r
21 #ifndef SURFACEWIN_H\r
22 #define SURFACEWIN_H\r
23 \r
24 #include "defines.h"\r
25 #include "surface.h"\r
26 #include <winsock2.h>\r
27 #include <d3d9.h>\r
28 \r
29 class SurfaceWin : public Surface\r
30 {\r
31   public:\r
32     SurfaceWin(int id = 0);\r
33     ~SurfaceWin();\r
34 \r
35     int create(UINT width, UINT height);\r
36     void display();\r
37 \r
38     void startFastDraw();\r
39     void endFastDraw();\r
40 \r
41     int fillblt(int x, int y, int width, int height, const DrawStyle& c);\r
42     void drawHorzLine(int x1, int x2, int y, const DrawStyle& c);\r
43     void drawVertLine(int x, int y1, int y2, const DrawStyle& c);\r
44     void drawBitmap(int x, int y, const Bitmap& bm);\r
45     int updateToScreen(int sx, int sy, int w, int h, int dx, int dy);\r
46     void readPixel(int x, int y, unsigned char* r, unsigned char* g, unsigned char* b);\r
47     void screenShot(const char* fileName);\r
48   void ReleaseSurface();\r
49     int blt(int fd, unsigned long shandle, int sx, int sy, int width, int height, unsigned long dhandle, int dx, int dy);\r
50   void drawJpeg(const char *fileName,int x, int y,int *width, int *height);\r
51 /*  void drawJpeg(char *buffer,ULONG buflength,DWORD x, DWORD y,DWORD *width, DWORD *height);*/\r
52   LPDIRECT3DSURFACE9 getD3dsurface() {WaitForSingleObject(event,INFINITE);\r
53     return d3dsurface;};\r
54   LPDIRECT3DTEXTURE9 getD3dtexture() {return d3dtexture;};\r
55   private:\r
56     LPDIRECT3DSURFACE9 d3dsurface;\r
57     LPDIRECT3DTEXTURE9 d3dtexture;\r
58     D3DLOCKED_RECT lockrect;\r
59     UINT sheight,swidth;\r
60     HANDLE event;\r
61   protected:\r
62     void drawPixel(int x, int y, Colour& c, bool fastdraw=false);\r
63     void drawPixel(int x, int y, unsigned int c, bool fastdraw=false);\r
64 };\r
65 \r
66 #endif\r