shithub: blie

ref: 3b862725591bc312572a3e35aab3007712c8b9bf
dir: /editor.txt/

View raw version
Editor functions and properties (blie.h:/^struct Editor)

PROPERTY name

short name of the editor. Works as an identifier, must be unique!


FUNCTION init (*)

Initialize/load static data, like images and brushes.
Will be called exactly once on startup.


FUNCTION composite (*)

param:  Layer*     Layer to work with
param:  Memimage*  Memimage to composite over
return: Memimage*  composited result


FUNCTION raw (tbd)

param:  Layer*     Layer to work with
return: Memimage*  raw image (no duplicate)


FUNCTION mask (tbd)

param:  Layer*     Layer to work with
return: Memimage*  raw mask (no duplicate)


FUNCTION overlay (*)

param:  Layer*     Layer to work with
param:  Image*     editor image to draw on
return: int        whether overlay fills the full drawing

This function is called in two situations:

1. To determine if we need to draw the image underneath
2. To actually draw the overlay

Case 1 is when the editor image is nil. In this case, only the
return value is relevant.

Case 2 is when the editor image is set. In this case, the return
value is ignored.

Case 1 is important to improve performance. There's no need to
composite and draw the drawing when we will overdraw it with
a full overlay image anyway.


FUNCTION toolrect

param:  Layer*     Layer to work with
return: Rectangle  wanted size of the tool window

For the given layer, return the needed size of the tool window.
In general, the tool window should be pretty small in height.


FUNCTION drawtools

param:  Layer*     Layer to work with
param:  Image*     Image to draw the tools on

For the given layer, draw the tools handles into the supplied
image.


FUNCTION drawinput

param:  Layer*     Layer to work with
param:  int        Event type (Emouse, Ekeyboard)
param:  Event      Event structure
return: Redrawwin  Redraw parameters

The mouse xy inside the event structure is normalized to the
(0,0) position of the drawing window.

Use the return parameter to specify which window should be
redrawn.


FUNCTION toolinput

param:  Layer*     Layer to work with
param:  int        Event type (Emouse, Ekeyboard)
param:  Event      Event structure
return: Redrawwin  Redraw parameters

This function is analogous to drawinput, just for the tools
window.


FUNCTION savedata

param:  Layer*     Layer to work with
return: int        1 for success, 0 for fail

If failed, set errstr.