ref: 8626465772e8dd47dfc7e5f0319f6458d3be5335
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; /* could be extracted to libdraw */ int eentercolor(char*, ulong*, Mouse*); 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 mdirty; int maxquality; Point mousepos; Mouse lastmouse; }; void setmodedirty(int); void setdrawingdirty(int); Image **reqwin(Rectangle, ulong, void (*f)(Image*)); void unreqwin(Image**); /* 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); void (*initlayer)(Layer*); 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*); int (*savetools)(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*);