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
135 void screenShot(const char* fileName);
\r
137 Surface * createNewSurface();
\r
138 void BeginPainting();
\r
139 void EndPainting();
\r
143 void updateOrAddSurface(const SurfaceVector *surf,float x,float y,float height,float width,
\r
144 list<SVGCommand>& commands);
\r
145 void removeSurface(const SurfaceVector *surf);
\r
147 virtual float getFontHeight()=0;
\r
148 virtual float getCharWidth(wchar_t c)=0;
\r
150 virtual ImageIndex getJpegRef(const char* fileName, int *width,int *height);
\r
151 virtual ImageIndex getMonoBitmapRef(void *base,int width,int height);
\r
152 virtual ImageIndex getImagePalette(int width,int height,const unsigned char *image_data,const unsigned int*palette_data);
\r
153 virtual void imageUploadLine(ImageIndex index,unsigned int j,unsigned int width,void *data)=0;
\r
154 void removeImageRef(const ImageIndex ref);
\r
155 unsigned int getColorRef(const Colour &c); //internally this is the same as getStyleRef
\r
156 unsigned int getStyleRef(const DrawStyle &c);
\r
157 virtual void removeStyleRef(unsigned int ref);
\r
160 int charSet() {return 2;}; //UTF-8
\r
166 void incImageRef(ImageIndex index);
\r
167 unsigned int getImageRef(ImageIndex index);
\r
168 virtual void destroyImageRef(ImageIndex index)=0;
\r
169 virtual ImageIndex createJpeg(const char* fileName, int *width,int *height)=0;
\r
170 virtual ImageIndex createMonoBitmap(void *base,int width,int height)=0;
\r
171 virtual ImageIndex createImagePalette(int width,int height,const unsigned char *image_data,const unsigned int*palette_data)=0;
\r
173 map<ImageIndex,unsigned int> images_ref;
\r
174 map<void *,ImageIndex> monobitmaps;
\r
175 map<string,ImageIndex> jpegs;
\r
177 void incStyleRef(unsigned int index);
\r
178 unsigned int getStyleRef(ImageIndex index);
\r
179 virtual void destroyStyleRef(unsigned int index)=0;
\r
180 map<pair<Colour*,unsigned int>,unsigned int> styles;
\r
181 map<unsigned int,unsigned int> styles_ref;
\r
182 virtual unsigned int createStyleRef(const DrawStyle &c)=0;
\r
183 virtual unsigned int createColorRef(const Colour &c)=0;
\r
185 void dereferenceSVGCommand(list<SVGCommand>& commands );
\r
186 void referenceSVGCommand(list<SVGCommand>& commands );
\r
187 void cleanupOrphanedRefs();
\r
191 virtual void drawSetTrans(SurfaceCommands & sc)=0;
\r
192 virtual void executeDrawCommand(SVGCommand & command)=0;
\r
197 list<SurfaceCommands> scommands;
\r
199 Mutex surfaces_mutex;
\r
201 void drawSurfaces();
\r