2 Copyright 2004-2005 Chris Tallon, 2006,2011-2012 Marten Richter
\r
4 This file is part of VOMP.
\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
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
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
30 #include "teletextdecodervbiebu.h"
\r
32 enum SVGCommandInstr {
\r
45 typedef unsigned int ImageIndex;
\r
50 SVGCommand(float ix, float iy,float iw,float ih,PathIndex path,unsigned int ref)
\r
57 target.path_index=path;
\r
60 SVGCommand(float ix, float iy,float iw,float ih,ImageIndex image_in,unsigned int ref)
\r
67 target.image=image_in;
\r
70 SVGCommand(float ix, float iy,float iw,float ih,unsigned int ttchar_in)
\r
78 target.ttchar=ttchar_in;
\r
80 SVGCommand(float ix, float iy,wchar_t char_in,unsigned int ref)
\r
88 target.textchar=char_in;
\r
91 bool Test(float tx,float ty,float tw, float th)
\r
93 return (x>=tx) && (y>=ty) && ((x+w)<=(tx+tw)) && ((y+h)<=(ty+th));
\r
95 bool TTTest(float tox,float toy,float tx, float ty)
\r
97 return (x==tox) && (toy==y) && (w==tx) && (h==ty);
\r
99 unsigned int getRef(){return reference;};
\r
100 ImageIndex getImageIndex() {
\r
101 if (instr!=DrawImage) return 0;
\r
102 else return target.image;
\r
104 SVGCommandInstr instr;
\r
106 unsigned int reference;
\r
108 PathIndex path_index; //path_index
\r
111 unsigned int ttchar;
\r
115 class SurfaceVector;
\r
117 struct SurfaceCommands{
\r
118 const SurfaceVector* surf;
\r
119 list<SVGCommand> commands;
\r
124 class OsdVector : public Osd
\r
128 virtual ~OsdVector();
\r
133 void screenShot(const char* fileName);
\r
135 Surface * createNewSurface();
\r
136 void BeginPainting();
\r
137 void EndPainting();
\r
141 void updateOrAddSurface(const SurfaceVector *surf,float x,float y,float height,float width,
\r
142 list<SVGCommand>& commands);
\r
143 void removeSurface(const SurfaceVector *surf);
\r
145 virtual float getFontHeight()=0;
\r
146 virtual float getCharWidth(wchar_t c)=0;
\r
148 virtual ImageIndex getJpegRef(const char* fileName, int *width,int *height);
\r
149 virtual ImageIndex getMonoBitmapRef(void *base,int width,int height);
\r
150 virtual ImageIndex getImagePalette(int width,int height,const unsigned char *image_data,const unsigned int*palette_data);
\r
151 virtual void imageUploadLine(ImageIndex index,unsigned int j,unsigned int width,void *data)=0;
\r
152 void removeImageRef(const ImageIndex ref);
\r
153 unsigned int getColorRef(const Colour &c); //internally this is the same as getStyleRef
\r
154 unsigned int getStyleRef(const DrawStyle &c);
\r
155 virtual void removeStyleRef(unsigned int ref);
\r
158 int charSet() {return 2;}; //UTF-8
\r
164 void incImageRef(ImageIndex index);
\r
165 unsigned int getImageRef(ImageIndex index);
\r
166 virtual void destroyImageRef(ImageIndex index)=0;
\r
167 virtual ImageIndex createJpeg(const char* fileName, int *width,int *height)=0;
\r
168 virtual ImageIndex createMonoBitmap(void *base,int width,int height)=0;
\r
169 virtual ImageIndex createImagePalette(int width,int height,const unsigned char *image_data,const unsigned int*palette_data)=0;
\r
171 map<ImageIndex,unsigned int> images_ref;
\r
172 map<void *,ImageIndex> monobitmaps;
\r
173 map<string,ImageIndex> jpegs;
\r
175 void incStyleRef(unsigned int index);
\r
176 unsigned int getStyleRef(ImageIndex index);
\r
177 virtual void destroyStyleRef(unsigned int index)=0;
\r
178 map<pair<Colour*,unsigned int>,unsigned int> styles;
\r
179 map<unsigned int,unsigned int> styles_ref;
\r
180 virtual unsigned int createStyleRef(const DrawStyle &c)=0;
\r
181 virtual unsigned int createColorRef(const Colour &c)=0;
\r
183 void dereferenceSVGCommand(list<SVGCommand>& commands );
\r
184 void referenceSVGCommand(list<SVGCommand>& commands );
\r
185 void cleanupOrphanedRefs();
\r
189 virtual void drawSetTrans(SurfaceCommands & sc)=0;
\r
190 virtual void executeDrawCommand(SVGCommand & command)=0;
\r
195 list<SurfaceCommands> scommands;
\r
197 Mutex surfaces_mutex;
\r
199 void drawSurfaces();
\r