DRAW(2)DRAW(2)
NAME
Image, draw, gendraw, drawreplxy, drawrepl, replclipr, line, poly, fillpoly, bezier, bezspline, fillbezier, fillbezspline, ellipse, fillellipse, arc, fillarc, icossin, icossin2, border, string, stringn, runestring, runestringn, stringbg, stringnbg, runestringbg, runestringnbg, _string, ARROW, drawsetdebug – graphics functions
unhandled troff command .de
unhandled troff command ..
SYNOPSIS
unhandled troff command .de
unhandled troff command ..
unhandled troff command .PB
#include <u.h> #include <libc.h> #include <draw.h>
unhandled troff command .PB
typedef struct Image { Display *display; /* display holding data */ int id; /* id of system-held Image */ Rectangle r; /* rectangle in data area, local coords */ Rectangle clipr; /* clipping region */ ulong chan; /* pixel channel format descriptor */ int depth; /* number of bits per pixel */ int repl; /* flag: data replicates to tile clipr */ Screen *screen; /* 0 if not a window */ Image *next; /* next in list of windows */ } Image;
unhandled troff command .PB
typedef enum { /* Porter-Duff compositing operators */ Clear = 0,
unhandled troff command .sp
SinD = 8, DinS = 4, SoutD = 2, DoutS = 1,
unhandled troff command .sp
S = SinD|SoutD, SoverD = SinD|SoutD|DoutS, SatopD = SinD|DoutS, SxorD = SoutD|DoutS,
unhandled troff command .sp
D = DinS|DoutS, DoverS = DinS|DoutS|SoutD, DatopS = DinS|SoutD, DxorS = DoutS|SoutD, /* == SxorD */
unhandled troff command .sp
Ncomp = 12, } Drawop;
unhandled troff command .PB
void draw(Image *dst, Rectangle r, Image *src, Image *mask, Point p)
unhandled troff command .PB
void drawop(Image *dst, Rectangle r, Image *src, Image *mask, Point p, Drawop op)
unhandled troff command .PB
void gendraw(Image *dst, Rectangle r, Image *src, Point sp, Image *mask, Point mp)
unhandled troff command .PB
void gendrawop(Image *dst, Rectangle r, Image *src, Point sp, Image *mask, Point mp, Drawop op)
unhandled troff command .PB
int drawreplxy(int min, int max, int x)
unhandled troff command .PB
Point drawrepl(Rectangle r, Point p)
unhandled troff command .PB
void replclipr(Image *i, int repl, Rectangle clipr)
unhandled troff command .PB
void line(Image *dst, Point p0, Point p1, int end0, int end1, int radius, Image *src, Point sp)
unhandled troff command .PB
void lineop(Image *dst, Point p0, Point p1, int end0, int end1, int radius, Image *src, Point sp, Drawop op)
unhandled troff command .PB
void poly(Image *dst, Point *p, int np, int end0, int end1, int radius, Image *src, Point sp)
unhandled troff command .PB
void polyop(Image *dst, Point *p, int np, int end0, int end1, int radius, Image *src, Point sp, Drawop op)
unhandled troff command .PB
void fillpoly(Image *dst, Point *p, int np, int wind, Image *src, Point sp)
unhandled troff command .PB
void fillpolyop(Image *dst, Point *p, int np, int wind, Image *src, Point sp, Drawop op)
unhandled troff command .PB
int bezier(Image *dst, Point p0, Point p1, Point p2, Point p3, int end0, int end1, int radius, Image *src, Point sp)
unhandled troff command .PB
int bezierop(Image *dst, Point p0, Point p1, Point p2, Point p3, int end0, int end1, int radius, Image *src, Point sp, Drawop op)
unhandled troff command .PB
int bezspline(Image *dst, Point *pt, int npt, int end0, int end1, int radius, Image *src, Point sp)
unhandled troff command .PB
int bezsplineop(Image *dst, Point *pt, int npt, int end0, int end1, int radius, Image *src, Point sp, Drawop op)
unhandled troff command .PB
int bezsplinepts(Point *pt, int npt, Point **pp)
unhandled troff command .PB
int fillbezier(Image *dst, Point p0, Point p1, Point p2, Point p3, int w, Image *src, Point sp)
unhandled troff command .PB
int fillbezierop(Image *dst, Point p0, Point p1, Point p2, Point p3, int w, Image *src, Point sp, Drawop op)
unhandled troff command .PB
int fillbezspline(Image *dst, Point *pt, int npt, int w, Image *src, Point sp)
unhandled troff command .PB
int fillbezsplineop(Image *dst, Point *pt, int npt, int w, Image *src, Point sp, Drawop op)
unhandled troff command .PB
void ellipse(Image *dst, Point c, int a, int b, int thick, Image *src, Point sp)
unhandled troff command .PB
void ellipseop(Image *dst, Point c, int a, int b, int thick, Image *src, Point sp, Drawop op)
unhandled troff command .PB
void fillellipse(Image *dst, Point c, int a, int b, Image *src, Point sp)
unhandled troff command .PB
void fillellipseop(Image *dst, Point c, int a, int b, Image *src, Point sp, Drawop op)
unhandled troff command .PB
void arc(Image *dst, Point c, int a, int b, int thick, Image *src, Point sp, int alpha, int phi)
unhandled troff command .PB
void arcop(Image *dst, Point c, int a, int b, int thick, Image *src, Point sp, int alpha, int phi, Drawop op)
unhandled troff command .PB
void fillarc(Image *dst, Point c, int a, int b, Image *src, Point sp, int alpha, int phi)
unhandled troff command .PB
void fillarcop(Image *dst, Point c, int a, int b, Image *src, Point sp, int alpha, int phi, Drawop op)
unhandled troff command .PB
void icossin(int deg, int *cosp, int *sinp)
unhandled troff command .PB
void icossin2(int x, int y, int *cosp, int *sinp)
unhandled troff command .PB
void border(Image *dst, Rectangle r, int i, Image *color, Point sp)
unhandled troff command .PB
void borderop(Image *dst, Rectangle r, int i, Image *color, Point sp,
Drawop op)
unhandled troff command .PB
Point string(Image *dst, Point p, Image *src, Point sp, Font *f, char *s)
unhandled troff command .PB
Point stringop(Image *dst, Point p, Image *src, Point sp, Font *f, char *s, Drawop op)
unhandled troff command .PB
Point stringn(Image *dst, Point p, Image *src, Point sp, Font *f, char *s, int len)
unhandled troff command .PB
Point stringnop(Image *dst, Point p, Image *src, Point sp, Font *f, char *s, int len, Drawop op)
unhandled troff command .PB
Point runestring(Image *dst, Point p, Image *src, Point sp, Font *f, Rune *r)
unhandled troff command .PB
Point runestringop(Image *dst, Point p, Image *src, Point sp, Font *f, Rune *r, Drawop op)
unhandled troff command .PB
Point runestringn(Image *dst, Point p, Image *src, Point sp, Font *f, Rune *r, int len)
unhandled troff command .PB
Point runestringnop(Image *dst, Point p, Image *src, Point sp, Font *f, Rune *r, int len, Drawop op)
unhandled troff command .PB
Point stringbg(Image *dst, Point p, Image *src, Point sp, Font *f, char *s, Image *bg, Point bgp)
unhandled troff command .PB
Point stringbgop(Image *dst, Point p, Image *src, Point sp, Font *f, char *s, Image *bg, Point bgp, Drawop op)
unhandled troff command .PB
Point stringnbg(Image *dst, Point p, Image *src, Point sp, Font *f, char *s, int len, Image *bg, Point bgp)
unhandled troff command .PB
Point stringnbgop(Image *dst, Point p, Image *src, Point sp, Font *f, char *s, int len, Image *bg, Point bgp, Drawop op)
unhandled troff command .PB
Point runestringbg(Image *dst, Point p, Image *src, Point sp, Font *f, Rune *r, Image *bg, Point bgp)
unhandled troff command .PB
Point runestringbgop(Image *dst, Point p, Image *src, Point sp, Font *f, Rune *r, Image *bg, Point bgp, Drawop op)
unhandled troff command .PB
Point runestringnbg(Image *dst, Point p, Image *src, Point sp, Font *f, Rune *r, int len, Image *bg, Point bgp)
unhandled troff command .PB
Point runestringnbgop(Image *dst, Point p, Image *src, Point sp, Font *f, Rune *r, int len, Image *bg, Point bgp, Drawop op)
unhandled troff command .PB
Point _string(Image *dst, Point p, Image *src, Point sp, Font *f, char *s, Rune *r, int len, Rectangle clipr, Image *bg, Point bgp, Drawop op)
unhandled troff command .PB
void drawsetdebug(int on)
unhandled troff command .PB
enum { /* line ends */ Endsquare = 0, Enddisc = 1, Endarrow = 2, Endmask = 0x1F };
unhandled troff command .PB
#define ARROW(a, b, c) (Endarrow|((a)<<5)|((b)<<14)|((c)<<23))
DESCRIPTION
The
The coordinates of the rectangle in the plane for which the
The clipping rectangle: operations that read or write
the image will not access pixels outside
The pixel channel format descriptor, as described in
The
number of bits per pixel in the picture;
it is identically
A boolean value specifying whether the image is tiled to cover
the plane when used as a source for a drawing operation.
If
For example, a replicated image with
Most of the drawing functions come in two forms:
a basic form, and an extended form that takes an extra
If
Translate
Set
Intersect
Intersect
For each location in
The various pixel channel formats involved need not be identical. If the channels involved are smaller than 8-bits, they will be promoted before the calculation by replicating the extant bits; after the calculation, they will be truncated to their proper sizes.
Similar to
Clips
Clips the point p to be within the rectangle r by translating the point horizontally by an integer multiple of rectangle width and vertically by the height.
Because the image data is stored on the server, local modifications to the
Line
draws in
The macro
For characters with undefined or zero-width images in the font, the character at font position 0 (NUL) is drawn.
The other string routines are variants of this basic form, and
have names that encode their variant behavior.
Routines whose names contain
The routine
Turns on or off debugging output (usually
to a serial line) according to whether
SOURCE
SEE
T. Porter, T. Duff.
“Compositing Digital Images”,
DIAGNOSTICS
These routines call the graphics error function on fatal errors.
BUGS
Anti-aliased characters can be drawn by defining a font with multiple bits per pixel, but there are no anti-aliasing geometric primitives.