ref: a3477b9d29227db6e78cede76fdd9d6b83f5ea76
dir: /blie.h/
typedef struct Layer Layer; typedef struct Editor Editor; typedef struct Vdata Vdata; typedef struct Vstate Vstate; extern Vdata vdata; extern Vstate vstate; extern int bliedebug; extern int headless; struct Layer { char *name; char *label; Drawop op; Editor *editor; Memimage *composited; int num; void *data; }; enum { UP, DOWN }; void addlayer(char *name); void movelayer(Layer*, int); void savelayermeta(Layer*); void dirtylayer(Layer*); void redrawlayers(Image*, Layer*); void clicklayer(Mouse, void (*f)(Layer*)); int foreachlayer(void (*f)(Layer*, int, int, void*), void*); void changecursor(Cursor*, Image*, Point); struct Vdata { int layerwinwidth; /* width of layers window */ int fontheight; /* height of font */ int keyoffset; /* offset on key input */ float keyzoom; /* zoom change */ Image *gray; }; enum { Dpan = 1, Dzoom = 2, Dcontent = Dpan|Dzoom, }; struct Vstate { Point offset; float zoom; int dirty; int maxquality; }; void setdrawingdirty(int); /* writes memimage to drawing image, considering pan and zoom using dirty flags */ void sampleview(Image*, Memimage*, int quality); typedef enum { Rnil = 0, Rdrawing = 1, Rtools = 2, } Redrawwin; struct Editor { char *name; void (*init)(void); Memimage *(*composite)(Layer*, Memimage*); Memimage *(*raw)(Layer*); Memimage *(*mask)(Layer*); int (*overlay)(Layer*, Image*); Rectangle (*toolrect)(Layer*); void (*drawtools)(Layer*, Image*); Redrawwin (*drawinput)(Layer*, int, Event); Redrawwin (*toolinput)(Layer*, int, Event); int (*savedata)(Layer*); }; extern Editor p9image; void loadeditors(void); int addeditor(Editor*); Editor *geteditor(char*); /* generic composite of layer (using raw) and the composited image * from the previous layer */ Memimage* ecomposite(Layer*, Memimage*); Point scalepos(Point); Memimage* gencomposite(Memimage*, Memimage*, Memimage*, Drawop); Memimage* gencanvas(Memimage*); Memimage* dupmemimage(Memimage*);