/*  FreeJ
 *  (c) Copyright 2001 Denis Roio aka jaromil <jaromil@dyne.org>
 */

#ifndef __LAYER_H__
#define __LAYER_H__

#include <inttypes.h>
#include <SDL.h>

#include <filter.h>
#include <jsync.h>

class Context;

class Layer: public Entry, public JSyncThread {
 private:
  char _name[5];
  char filename[256];

  int _blit_algo;
  void blit(void *offset);
  int blit_x, blit_y;
  int blit_width, blit_height;
  int blit_offset;
  /* small vars used in blits */
  int chan, c, cc;
  uint32_t *scr, *pscr, *off, *poff;
  Uint8 *alpha;


  void *offset;
  void *bgmatte;

 public:

  Layer();
  ~Layer();

  void run();
  void _init(Context *screen, int wdt, int hgt, int bpp=0);
  void set_filename(char *f);
  char *get_filename() { return filename; };
  void set_position(int x, int y);

  virtual void close() { };

  /* these has to be defined into layer instances
     (pure virtual functions) */
  virtual void *feed() = 0; /* feeds in the image source */
  void *get_buffer() { return buffer; }; /* returns a pointer to the image source */

  void set_blit(int b);
  char *get_blit();

  void crop();

  bool add_filter(Filter *newfilt);
  bool del_filter(int sel);
  void clear_filters();
  bool moveup_filter(int sel);
  bool movedown_filter(int sel);
  Filter *active_filter(int sel);
  Filter *listen_filter(int sel);
  virtual bool keypress(SDL_keysym *keysym) { return(false); };

  void setname(char *s);
  char *getname();


  bool cafudda();

  Linklist filters;

  Context *screen;

  ScreenGeometry geo;

  bool alpha_blit;
  bool active;
  bool quit;
  bool running;
  bool hidden;
  int bgcolor;

 protected:
  void *buffer;
};

#endif


Select source code:
back to 'READ ME' (main page)
'layer.cpp'(code that handles the printing on the screen)
'linklist.cpp'(code that keeps layers and effects inside dynamic arrays)
'v4l_layer.cpp'(code that feeds the video image of the person standing in front of the screen to the layer)