00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00025 #ifndef __LAYER_H__
00026 #define __LAYER_H__
00027
00028 #include <inttypes.h>
00029 #include <geometry.h>
00030 #include <filter.h>
00031 #include <screen.h>
00032 #include <jsync.h>
00033
00034
00035 class Context;
00036 class AudioCollector;
00037 class Iterator;
00038 class Blitter;
00039 class Blit;
00040 class ViewPort;
00041
00042
00043 class JSContext;
00044
00045
00081 class Layer: public Entry, public JSyncThread {
00082 friend class Blitter;
00083 friend class Context;
00084 friend class JSyncThread;
00085 friend class ViewPort;
00086
00087 public:
00088
00089 enum Type {
00090 UNKNOWN,
00091 TEXT,
00092 GENERATOR,
00093 #if defined HAVE_DARWIN && defined WITH_COCOA
00094 GL_COCOA
00095 #endif
00096 };
00097
00098 Layer();
00099 virtual ~Layer();
00100
00101
00102
00106 virtual int start() { return JSyncThread::start(); }
00107
00108 Type type;
00109
00110
00111
00116 virtual bool open(const char *file) =0;
00117
00118
00119 virtual bool init(int w = 0, int h = 0, int bpp = 0);
00121
00122 virtual void close() =0;
00123
00124 virtual bool set_parameter(int idx);
00125
00126 char *get_name() { return name; };
00127 char *get_filename() { return filename; };
00129
00136 virtual void set_position(int x, int y);
00138
00145 virtual void set_zoom(double x, double y);
00146
00150 virtual void set_rotate(double angle);
00151
00152 bool antialias;
00153 bool zooming;
00154 bool rotating;
00155 double zoom_x;
00156 double zoom_y;
00157 double rotate;
00158
00159 virtual void fit(bool maintain_aspect_ratio = true);
00160
00161
00162 Linklist<Parameter> *parameters;
00164
00165 Linklist<FilterInstance> filters;
00167 virtual void *do_filters(void *tmp_buf);
00168
00169 Geometry geo;
00171 Geometry geo_rotozoom;
00173
00174 Linklist<Iterator> iterators;
00176 int do_iterators();
00177
00178
00179 bool active;
00180 bool hidden;
00181 bool fade;
00182 bool use_audio;
00183 bool opened;
00184 bool need_crop;
00185 int bgcolor;
00186 int null_feeds;
00187 int max_null_feeds;
00188
00190 Blitter *blitter;
00191 Blit *current_blit;
00192 virtual char *get_blit();
00193 virtual bool set_blit(const char *bname);
00194
00195 virtual void blit();
00196
00197 void *get_data();
00198 void set_data(void *data);
00199
00200 ViewPort *screen;
00201
00202
00203 AudioCollector *audio;
00204
00206 void *buffer;
00207
00208
00209 void *js_constructor(Context *env, JSContext *cx,
00210 JSObject *obj, int argc, void *aargv, char *err_msg);
00212
00213
00214 unsigned int textureID;
00215
00216 int frame_rate;
00217
00218 protected:
00219
00224 virtual bool _init() = 0;
00225
00226 void set_filename(const char *f);
00227 char filename[256];
00228
00229
00230 bool is_native_sdl_surface;
00231 void *priv_data;
00232
00233 private:
00234
00235 void _set_position(int x, int y);
00236 void _set_zoom(double x, double y);
00237 void _set_rotate(double angle);
00238 void _fit(bool maintain_aspect_ratio);
00239
00240 char alphastr[5];
00241
00242 void thread_setup();
00243 void thread_loop();
00244 void thread_teardown();
00245
00246 virtual void *feed() = 0;
00247
00248 bool cafudda();
00249
00250
00251 int res;
00252 Iterator *iter;
00253 Iterator *itertmp;
00254
00255 uint8_t colorkey_r;
00256 uint8_t colorkey_g;
00257 uint8_t colorkey_b;
00258
00259 };
00260
00261
00262 #endif