include	"draw.m";
draw := load Draw Draw->PATH;
# compositing operators
SinD:   con 1<<3;
DinS:   con 1<<2;
SoutD:  con 1<<1;
DoutS:  con 1<<0;
S:      con SinD|SoutD;
SoverD: con SinD|SoutD|DoutS;
SatopD: con SinD|DoutS;
SxorD:  con SoutD|DoutS;
D:      con DinS|DoutS;
DoverS: con DinS|DoutS|SoutD;
DatopS: con DinS|SoutD;
DxorS:  con DoutS|SoutD;
Clear:  con 0;
Image: adt
{
    r:          Rect;
    clipr:      Rect;
    chans:      Chans;
    depth:      int;
    repl:       int;
    display:    ref Display;
    screen:     ref Screen;
    draw:       fn(dst: self ref Image, r: Rect, src: ref Image,
                   mask: ref Image, p: Point);
    drawop:       fn(dst: self ref Image, r: Rect, src: ref Image,
                   mask: ref Image, p: Point, op: int);
    gendraw:    fn(dst: self ref Image, r: Rect, src: ref Image,
                   p0: Point, mask: ref Image, p1: Point);
    gendrawop:    fn(dst: self ref Image, r: Rect, src: ref Image,
                   p0: Point, mask: ref Image, p1: Point, op: int);
    line:       fn(dst: self ref Image, p0,p1: Point,
                   end0,end1,thick: int,
                   src: ref Image, sp: Point);
    lineop:       fn(dst: self ref Image, p0,p1: Point,
                   end0,end1,thick: int,
                   src: ref Image, sp: Point, op: int);
    poly:       fn(dst: self ref Image, p: array of Point,
                   end0,end1,thick: int,
                   src: ref Image, sp: Point);
    polyop:       fn(dst: self ref Image, p: array of Point,
                   end0,end1,thick: int,
                   src: ref Image, sp: Point, op: int);
    bezspline:  fn(dst: self ref Image, p: array of Point,
                   end0,end1,thick: int,
                   src: ref Image, sp: Point);
    bezsplineop:  fn(dst: self ref Image, p: array of Point,
                   end0,end1,thick: int,
                   src: ref Image, sp: Point, op: int);
    fillpoly:   fn(dst: self ref Image, p: array of Point,
                   wind: int, src: ref Image, sp: Point);
    fillpolyop:   fn(dst: self ref Image, p: array of Point,
                   wind: int, src: ref Image, sp: Point, op: int);
    fillbezspline: fn(dst: self ref Image, p: array of Point,
                   wind: int, src: ref Image, sp: Point);
    fillbezsplineop: fn(dst: self ref Image, p: array of Point,
                   wind: int, src: ref Image, sp: Point, op: int);
    ellipse:    fn(dst: self ref Image, c: Point, a, b,
                   thick: int, src: ref Image, sp: Point);
    ellipseop:    fn(dst: self ref Image, c: Point, a, b,
                   thick: int, src: ref Image, sp: Point, op: int);
    fillellipse:fn(dst: self ref Image, c: Point, a, b: int,
                   src: ref Image, sp: Point);
    fillellipseop:fn(dst: self ref Image, c: Point, a, b: int,
                   src: ref Image, sp: Point, op: int);
    arc:        fn(dst: self ref Image, c: Point, a, b, thick: int,
                   src: ref Image, sp: Point, alpha, phi: int);
    arcop:      fn(dst: self ref Image, c: Point, a, b, thick: int,
                   src: ref Image, sp: Point,
                   alpha, phi: int, op: int);
    fillarc:    fn(dst: self ref Image, c: Point, a, b: int,
                   src: ref Image, sp: Point, alpha, phi: int);
    fillarcop:  fn(dst: self ref Image, c: Point, a, b: int,
                   src: ref Image, sp: Point,
                   alpha, phi: int, op: int);
    bezier:     fn(dst: self ref Image, a,b,c,d: Point,
                   end0,end1,thick: int,
                   src: ref Image, sp: Point);
    bezierop:     fn(dst: self ref Image, a,b,c,d: Point,
                   end0,end1,thick: int,
                   src: ref Image, sp: Point, op: int);
    fillbezier: fn(dst: self ref Image, a,b,c,d: Point, wind:int,
                   src: ref Image, sp: Point);
    fillbezierop: fn(dst: self ref Image, a,b,c,d: Point, wind:int,
                   src: ref Image, sp: Point, op: int);
    arrow:      fn(a,b,c: int): int;
    text:       fn(dst: self ref Image, p: Point, src: ref Image,
                   sp: Point, font: ref Font, str: string): Point;
    textop:       fn(dst: self ref Image, p: Point, src: ref Image,
                   sp: Point, font: ref Font, str: string,
                   op: int): Point;
    textbg:     fn(dst: self ref Image, p: Point, src: ref Image,
                   sp: Point, font: ref Font, str: string,
                   bg: ref Image, bgp: Point): Point;
    textbgop:     fn(dst: self ref Image, p: Point, src: ref Image,
                   sp: Point, font: ref Font, str: string,
                   bg: ref Image, bgp: Point, op: int): Point;
    border:     fn(dst: self ref Image, r: Rect, i: int,
                   src: ref Image, sp: Point);
    borderop:     fn(dst: self ref Image, r: Rect, i: int,
                   src: ref Image, sp: Point, op: int);
    readpixels: fn(src: self ref Image, r: Rect,
                   data: array of byte): int;
    writepixels:fn(dst: self ref Image, r: Rect,
                   data: array of byte): int;
    name:       fn(im: self ref Image, s: string, in: int): int;
    top:        fn(win: self ref Image);
    bottom:     fn(win: self ref Image);
    flush:      fn(win: self ref Image, func: int);
    origin:     fn(win: self ref Image, log, scr: Point): int;
};
An Image has a pixel channel structure as described in colour(6), represented by a value of the Chans adt, defined in draw-display(2). The channel structure of an image is fixed when the image is allocated.
Image has the following components:
T. Porter, T. Duff. ``Compositing Digital Images'', Computer Graphics (Proc. SIGGRAPH), 18:3, pp. 253-259, 1984.
| DRAW-IMAGE(2 ) | Rev: Tue Mar 31 02:42:38 GMT 2015 |