]> git.vomp.tv Git - vompclient.git/blob - surfacevector.h
Convert PlayerRadioRec to std::thread
[vompclient.git] / surfacevector.h
1 /*
2     Copyright 2012 Marten Richter
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, see <https://www.gnu.org/licenses/>.
18 */
19
20 #ifndef SURFACEVECTOR_H
21 #define SURFACEVECTOR_H
22
23 #include <mutex>
24 #include <vector>
25
26 #include "surface.h"
27 #include "osdvector.h"
28
29 class SurfaceVector : public Surface
30 {
31   public:
32     SurfaceVector(OsdVector* vosd);
33     virtual ~SurfaceVector();
34
35     int getFontHeight();
36     float getCharWidth(wchar_t c);
37
38     int drawText(const char* text, int x, int y, const DrawStyle& c);
39     int drawText(const char* text, int x, int y, int width, const DrawStyle& c);
40     int drawTextRJ(const char* text, int x, int y, const DrawStyle& c);
41     int drawTextCentre(const char* text, int x, int y, const DrawStyle& c);
42
43     void drawJpeg(const char* fileName, int x, int y, int* width, int* height);
44     // set width and height to zero, if the original size is wanted, if one index is non zero,
45     // the images is scaled with correct aspect ratio, if both are non zero both are scaled
46     void drawTVMedia(TVMediaInfo & tvmedia,float x, float y, float  width, float height, Corner corner = TopLeft);
47     // set w and h to 0, for unsetting clipping, use correct x and y parameter so that cleanup of commands works
48     void drawClippingRectangle(float x, float y, float w, float h);
49
50     int create(UINT width, UINT height);
51     void display();
52
53     int fillblt(int x, int y, int width, int height, const DrawStyle& c);
54     void drawHorzLine(int x1, int x2, int y, const DrawStyle& c);
55     void drawVertLine(int x, int y1, int y2, const DrawStyle& c);
56     void drawBitmap(int x, int y, const Bitmap& bm, const DisplayRegion& region);
57     void drawPoint(int x, int y, DrawStyle& c, bool fastdraw = false); // This draws a point, must not be a pixel
58     void drawMonoBitmap(UCHAR* base, int dx, int dy, unsigned int height, unsigned int width, DrawStyle& nextColour);
59     int updateToScreen(int sx, int sy, int w, int h, int dx, int dy);
60
61     /* This is for system which need a locking of the drawing surface to speed up drawing */
62     void startFastDraw();
63     void endFastDraw();
64
65     void drawTTChar(int ox, int oy,int x, int y, cTeletextChar c);
66
67     void readPixel(int /* x */, int /* y */, unsigned char* /* r */, unsigned char* /* g */, unsigned char* /* b */) {};
68     void screenShot(const char* /* fileName */) {};
69
70   protected:
71
72     int removeCommands(float x, float y, float width, float height);
73
74     std::vector<SVGCommand> commands;
75     int swidth, sheight;
76     std::mutex command_mutex;
77     OsdVector* osd;
78
79     void drawPixel(int /* x */, int /* y */, unsigned int /* c */, bool /* fastdraw */){}; // these are not supported!
80     void drawPixel(int /* x */, int /* y */, Colour& /* c */, bool /* fastdraw */){};
81 };
82
83 #endif