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