467 lines
23 KiB
HTML
467 lines
23 KiB
HTML
|
|
<head>
|
||
|
|
<title>memdraw(3) - Plan 9 from User Space</title>
|
||
|
|
<meta content="text/html; charset=utf-8" http-equiv=Content-Type>
|
||
|
|
</head>
|
||
|
|
<body bgcolor=#ffffff>
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0 width=100%>
|
||
|
|
<tr height=10><td>
|
||
|
|
<tr><td width=20><td>
|
||
|
|
<tr><td width=20><td><b>MEMDRAW(3)</b><td align=right><b>MEMDRAW(3)</b>
|
||
|
|
<tr><td width=20><td colspan=2>
|
||
|
|
<br>
|
||
|
|
<p><font size=+1><b>NAME </b></font><br>
|
||
|
|
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
|
||
|
|
|
||
|
|
Memimage, Memdata, Memdrawparam, memimageinit, wordaddr, byteaddr,
|
||
|
|
memimagemove, allocmemimage, allocmemimaged, readmemimage, creadmemimage,
|
||
|
|
writememimage, freememimage, memsetchan, loadmemimage, cloadmemimage,
|
||
|
|
unloadmemimage, memfillcolor, memarc, mempoly, memellipse,
|
||
|
|
memfillpoly, memimageline, memimagedraw, drawclip, memlinebbox,
|
||
|
|
memlineendsize, allocmemsubfont, openmemsubfont, freememsubfont,
|
||
|
|
memsubfontwidth, getmemdefont, memimagestring, iprint, hwdraw
|
||
|
|
– drawing routines for memory-resident images<br>
|
||
|
|
|
||
|
|
</table>
|
||
|
|
<p><font size=+1><b>SYNOPSIS </b></font><br>
|
||
|
|
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
|
||
|
|
|
||
|
|
<tt><font size=+1>#include <u.h> <br>
|
||
|
|
#include <u.h> <br>
|
||
|
|
#include <libc.h> <br>
|
||
|
|
#include <draw.h> <br>
|
||
|
|
#include <memdraw.h> <br>
|
||
|
|
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
|
||
|
|
</font></tt>
|
||
|
|
<tt><font size=+1>typedef struct Memdata<br>
|
||
|
|
{<br>
|
||
|
|
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
|
||
|
|
|
||
|
|
ulong *base; /* allocated data pointer */<br>
|
||
|
|
uchar *bdata; /* first byte of actual data; word−aligned */<br>
|
||
|
|
int ref; /* number of Memimages using this data */<br>
|
||
|
|
void* imref; /* last image that pointed at this */<br>
|
||
|
|
int allocd; /* is this malloc'd? */<br>
|
||
|
|
|
||
|
|
</table>
|
||
|
|
} Memdata;<br>
|
||
|
|
enum {<br>
|
||
|
|
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
|
||
|
|
|
||
|
|
Frepl = 1<<0, /* is replicated */<br>
|
||
|
|
Fsimple = 1<<1, /* is 1x1 */<br>
|
||
|
|
Fgrey = 1<<2, /* is grey */<br>
|
||
|
|
Falpha = 1<<3, /* has explicit alpha */<br>
|
||
|
|
Fcmap = 1<<4, /* has cmap channel */<br>
|
||
|
|
Fbytes = 1<<5, /* has only 8−bit channels */<br>
|
||
|
|
|
||
|
|
</table>
|
||
|
|
};<br>
|
||
|
|
typedef struct Memimage<br>
|
||
|
|
{<br>
|
||
|
|
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
|
||
|
|
|
||
|
|
Rectangle r; /* rectangle in data area, local coords */<br>
|
||
|
|
Rectangle clipr; /* clipping region */<br>
|
||
|
|
int depth; /* number of bits of storage per pixel */<br>
|
||
|
|
int nchan; /* number of channels */<br>
|
||
|
|
ulong chan; /* channel descriptions */<br>
|
||
|
|
Memdata *data; /* pointer to data */<br>
|
||
|
|
int zero; /* data−>bdata+zero==&byte containing (0,0) */<br>
|
||
|
|
ulong width; /* width in words of a single scan line */<br>
|
||
|
|
Memlayer *layer; /* nil if not a layer*/<br>
|
||
|
|
ulong flags;<br>
|
||
|
|
|
||
|
|
</table>
|
||
|
|
</font></tt>
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
|
||
|
|
|
||
|
|
<i>...<br>
|
||
|
|
</i>
|
||
|
|
</table>
|
||
|
|
<tt><font size=+1>} Memimage;<br>
|
||
|
|
typedef struct Memdrawparam<br>
|
||
|
|
{<br>
|
||
|
|
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
|
||
|
|
|
||
|
|
Memimage *dst;<br>
|
||
|
|
Rectangle r;<br>
|
||
|
|
Memimage *src;<br>
|
||
|
|
Rectangle sr;<br>
|
||
|
|
Memimage *mask;<br>
|
||
|
|
Rectangle mr;<br>
|
||
|
|
|
||
|
|
</table>
|
||
|
|
</font></tt>
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
|
||
|
|
|
||
|
|
<i>...<br>
|
||
|
|
</i>
|
||
|
|
</table>
|
||
|
|
<tt><font size=+1>} Memdrawparam;<br>
|
||
|
|
int drawdebug;<br>
|
||
|
|
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
|
||
|
|
</font></tt><i>
|
||
|
|
</i><tt><font size=+1>void memimageinit(void)<br>
|
||
|
|
ulong* wordaddr(Memimage *i, Point p)<br>
|
||
|
|
uchar* byteaddr(Memimage *i, Point p)<br>
|
||
|
|
void memimagemove(void *from, void *to)<br>
|
||
|
|
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
|
||
|
|
|
||
|
|
Memimage* allocmemimage(Rectangle r, ulong chan)<br>
|
||
|
|
Memimage* allocmemimaged(Rectangle r, ulong chan, Memdata *data)<br>
|
||
|
|
Memimage* readmemimage(int fd)<br>
|
||
|
|
Memimage* creadmemimage(int fd)<br>
|
||
|
|
int writememimage(int fd, Memimage *i)<br>
|
||
|
|
void freememimage(Memimage *i)<br>
|
||
|
|
int memsetchan(Memimage*, ulong)<br>
|
||
|
|
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
|
||
|
|
|
||
|
|
int loadmemimage(Memimage *i, Rectangle r,<br>
|
||
|
|
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
|
||
|
|
|
||
|
|
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
|
||
|
|
|
||
|
|
uchar *buf, int nbuf)<br>
|
||
|
|
|
||
|
|
</table>
|
||
|
|
|
||
|
|
</table>
|
||
|
|
int cloadmemimage(Memimage *i, Rectangle r,<br>
|
||
|
|
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
|
||
|
|
|
||
|
|
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
|
||
|
|
|
||
|
|
uchar *buf, int nbuf)<br>
|
||
|
|
|
||
|
|
</table>
|
||
|
|
|
||
|
|
</table>
|
||
|
|
int unloadmemimage(Memimage *i, Rectangle r,<br>
|
||
|
|
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
|
||
|
|
|
||
|
|
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
|
||
|
|
|
||
|
|
uchar *buf, int nbuf)<br>
|
||
|
|
|
||
|
|
</table>
|
||
|
|
|
||
|
|
</table>
|
||
|
|
void memfillcolor(Memimage *i, ulong color)<br>
|
||
|
|
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
|
||
|
|
|
||
|
|
void memarc(Memimage *dst, Point c, int a, int b, int thick,<br>
|
||
|
|
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
|
||
|
|
|
||
|
|
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
|
||
|
|
|
||
|
|
Memimage *src, Point sp, int alpha, int phi, Drawop op)<br>
|
||
|
|
|
||
|
|
</table>
|
||
|
|
|
||
|
|
</table>
|
||
|
|
void mempoly(Memimage *dst, Point *p, int np, int end0,<br>
|
||
|
|
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
|
||
|
|
|
||
|
|
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
|
||
|
|
|
||
|
|
int end1, int radius, Memimage *src, Point sp, Drawop op)<br>
|
||
|
|
|
||
|
|
</table>
|
||
|
|
|
||
|
|
</table>
|
||
|
|
void memellipse(Memimage *dst, Point c, int a, int b,<br>
|
||
|
|
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
|
||
|
|
|
||
|
|
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
|
||
|
|
|
||
|
|
int thick, Memimage *src, Point sp, Drawop op)<br>
|
||
|
|
|
||
|
|
</table>
|
||
|
|
|
||
|
|
</table>
|
||
|
|
void memfillpoly(Memimage *dst, Point *p, int np, int wind,<br>
|
||
|
|
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
|
||
|
|
|
||
|
|
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
|
||
|
|
|
||
|
|
Memimage *src, Point sp, Drawop op)<br>
|
||
|
|
|
||
|
|
</table>
|
||
|
|
|
||
|
|
</table>
|
||
|
|
void memimageline(Memimage *dst, Point p0, Point p1, int end0,<br>
|
||
|
|
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
|
||
|
|
|
||
|
|
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
|
||
|
|
|
||
|
|
int end1, int radius, Memimage *src, Point sp, Drawop op)<br>
|
||
|
|
|
||
|
|
</table>
|
||
|
|
|
||
|
|
</table>
|
||
|
|
void memimagedraw(Memimage *dst, Rectangle r, Memimage *src,<br>
|
||
|
|
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
|
||
|
|
|
||
|
|
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
|
||
|
|
|
||
|
|
Point sp, Memimage *mask, Point mp, Drawop op)<br>
|
||
|
|
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
|
||
|
|
|
||
|
|
|
||
|
|
</table>
|
||
|
|
|
||
|
|
</table>
|
||
|
|
int drawclip(Memimage *dst, Rectangle *dr, Memimage *src,<br>
|
||
|
|
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
|
||
|
|
|
||
|
|
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
|
||
|
|
|
||
|
|
Point *sp, Memimage *mask, Point *mp,<br>
|
||
|
|
Rectangle *sr, Rectangle *mr)<br>
|
||
|
|
|
||
|
|
</table>
|
||
|
|
|
||
|
|
</table>
|
||
|
|
Rectangle memlinebbox(Point p0, Point p1, int end0, int end1,<br>
|
||
|
|
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
|
||
|
|
|
||
|
|
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
|
||
|
|
|
||
|
|
int radius)<br>
|
||
|
|
|
||
|
|
</table>
|
||
|
|
|
||
|
|
</table>
|
||
|
|
int memlineendsize(int end)<br>
|
||
|
|
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
|
||
|
|
|
||
|
|
Memsubfont* allocmemsubfont(char *name, int n, int height,<br>
|
||
|
|
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
|
||
|
|
|
||
|
|
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
|
||
|
|
|
||
|
|
int ascent, Fontchar *info, Memimage *i)<br>
|
||
|
|
|
||
|
|
</table>
|
||
|
|
|
||
|
|
</table>
|
||
|
|
Memsubfont* openmemsubfont(char *name)<br>
|
||
|
|
void freememsubfont(Memsubfont *f)<br>
|
||
|
|
Point memsubfontwidth(Memsubfont *f, char *s)<br>
|
||
|
|
Memsubfont* getmemdefont(void)<br>
|
||
|
|
Point memimagestring(Memimage *dst, Point p, Memimage *color,<br>
|
||
|
|
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
|
||
|
|
|
||
|
|
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
|
||
|
|
|
||
|
|
Point cp, Memsubfont *f, char *cs, Drawop op)<br>
|
||
|
|
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
|
||
|
|
|
||
|
|
|
||
|
|
</table>
|
||
|
|
|
||
|
|
</table>
|
||
|
|
int iprint(char *fmt, ...)<br>
|
||
|
|
int hwdraw(Memdrawparam *param)<br>
|
||
|
|
</font></tt>
|
||
|
|
</table>
|
||
|
|
<p><font size=+1><b>DESCRIPTION </b></font><br>
|
||
|
|
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
|
||
|
|
|
||
|
|
The <tt><font size=+1>Memimage</font></tt> type defines memory-resident rectangular pictures
|
||
|
|
and the methods to draw upon them; <tt><font size=+1>Memimage</font></tt>s differ from <tt><font size=+1>Image</font></tt>s
|
||
|
|
(see <a href="../man3/draw.html"><i>draw</i>(3)</a>) in that they are manipulated directly in user memory
|
||
|
|
rather than by RPCs to the <tt><font size=+1>/dev/draw</font></tt> hierarchy. The library is
|
||
|
|
the basis for the kernel <a href="../man3/draw.html"><i>draw</i>(3)</a> driver and also
|
||
|
|
used by a number of programs that must manipulate images without
|
||
|
|
a display.
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
|
||
|
|
|
||
|
|
The <tt><font size=+1>r, clipr</font></tt>, <tt><font size=+1>depth</font></tt>, <tt><font size=+1>nchan</font></tt>, and <tt><font size=+1>chan</font></tt> structure elements are identical
|
||
|
|
to the ones of the same name in the <tt><font size=+1>Image</font></tt> structure.
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
|
||
|
|
|
||
|
|
The <tt><font size=+1>flags</font></tt> element of the <tt><font size=+1>Memimage</font></tt> structure holds a number of
|
||
|
|
bits of information about the image. In particular, it subsumes
|
||
|
|
the purpose of the <tt><font size=+1>repl</font></tt> element of <tt><font size=+1>Image</font></tt> structures.
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
|
||
|
|
|
||
|
|
<i>Memimageinit</i> initializes various static data that the library
|
||
|
|
depends on, as well as the replicated solid color images <tt><font size=+1>memopaque</font></tt>,
|
||
|
|
<tt><font size=+1>memtransparent</font></tt>, <tt><font size=+1>memblack</font></tt>, and <tt><font size=+1>memwhite</font></tt>. It should be called before
|
||
|
|
referring to any of these images and before calling any of the
|
||
|
|
other library functions.
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
|
||
|
|
|
||
|
|
Each <tt><font size=+1>Memimage</font></tt> points at a <tt><font size=+1>Memdata</font></tt> structure that in turn points
|
||
|
|
at the actual pixel data for the image. This allows multiple images
|
||
|
|
to be associated with the same <tt><font size=+1>Memdata</font></tt>. The first word of the
|
||
|
|
data pointed at by the <tt><font size=+1>base</font></tt> element of <tt><font size=+1>Memdata</font></tt> points back at
|
||
|
|
the <tt><font size=+1>Memdata</font></tt> structure, so that in the Plan 9 kernel,
|
||
|
|
the memory allocator (see Plan 9’s <i>pool</i>(3)) can compact image
|
||
|
|
memory using <i>memimagemove</i>.
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
|
||
|
|
|
||
|
|
Because images can have different coordinate systems, the <tt><font size=+1>zero</font></tt>
|
||
|
|
element of the <tt><font size=+1>Memimage</font></tt> structure contains the offset that must
|
||
|
|
be added to the <tt><font size=+1>bdata</font></tt> element of the corresponding <tt><font size=+1>Memdata</font></tt> structure
|
||
|
|
in order to yield a pointer to the data for the pixel (0,0). Adding
|
||
|
|
<tt><font size=+1>width</font></tt> machine words to this pointer moves it
|
||
|
|
down one scan line. The <tt><font size=+1>depth</font></tt> element can be used to determine
|
||
|
|
how to move the pointer horizontally. Note that this method works
|
||
|
|
even for images whose rectangles do not include the origin, although
|
||
|
|
one should only dereference pointers corresponding to pixels within
|
||
|
|
the image rectangle. <i>Wordaddr</i> and
|
||
|
|
<i>byteaddr</i> perform these calculations, returning pointers to the
|
||
|
|
word and byte, respectively, that contain the beginning of the
|
||
|
|
data for a given pixel.
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
|
||
|
|
|
||
|
|
<i>Allocmemimage</i> allocages images with a given rectangle and channel
|
||
|
|
descriptor (see <tt><font size=+1>strtochan</font></tt> in <a href="../man3/graphics.html"><i>graphics</i>(3)</a>), creating a fresh <tt><font size=+1>Memdata</font></tt>
|
||
|
|
structure and associated storage. <i>Allocmemimaged</i> is similar but
|
||
|
|
uses the supplied <i>Memdata</i> structure rather than a new one. The
|
||
|
|
<i>readmemimage</i> function reads an
|
||
|
|
uncompressed bitmap from the given file descriptor, while <i>creadmemimage</i>
|
||
|
|
reads a compressed bitmap. <i>Writememimage</i> writes a compressed representation
|
||
|
|
of <i>i</i> to file descriptor <i>fd</i>. For more on bitmap formats, see <a href="../man7/image.html"><i>image</i>(7)</a>.
|
||
|
|
<i>Freememimage</i> frees images returned by any of these routines. The
|
||
|
|
<tt><font size=+1>Memimage</font></tt> structure
|
||
|
|
contains some tables that are used to store precomputed values
|
||
|
|
depending on the channel descriptor. <i>Memsetchan</i> updates the <tt><font size=+1>chan</font></tt>
|
||
|
|
element of the structure as well as these tables, returning –1
|
||
|
|
if passed a bad channel descriptor.
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
|
||
|
|
|
||
|
|
<i>Loadmemimage</i> and <i>cloadmemimage</i> replace the pixel data for a given
|
||
|
|
rectangle of an image with the given buffer of uncompressed or
|
||
|
|
compressed data, respectively. When calling <i>cloadmemimage</i>, the
|
||
|
|
buffer must contain an integral number of compressed chunks of
|
||
|
|
data that exactly cover the rectangle.
|
||
|
|
<i>Unloadmemimage</i> retrieves the uncompressed pixel data for a given
|
||
|
|
rectangle of an image. All three return the number of bytes consumed
|
||
|
|
on success, and –1 in case of an error.
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
|
||
|
|
|
||
|
|
<i>Memfillcolor</i> fills an image with the given color, a 32-bit number
|
||
|
|
as described in <a href="../man3/color.html"><i>color</i>(3)</a>.
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
|
||
|
|
|
||
|
|
<i>Memarc</i>, <i>mempoly</i>, <i>memellipse</i>, <i>memfillpoly</i>, <i>memimageline</i>, and <i>memimagedraw</i>
|
||
|
|
are identical to the <i>arc</i>, <i>poly</i>, <i>ellipse</i>, <i>fillpoly</i>, <i>line</i>, and <i>gendraw</i>,
|
||
|
|
routines described in <a href="../man3/draw.html"><i>draw</i>(3)</a>, except that they operate on <tt><font size=+1>Memimage</font></tt>s
|
||
|
|
rather than <tt><font size=+1>Image</font></tt>s. Similarly, <i>allocmemsubfont</i>, <i>openmemsubfont</i>,
|
||
|
|
<i>freememsubfont</i>,
|
||
|
|
<i>memsubfontwidth</i>, <i>getmemdefont</i>, and <i>memimagestring</i> are the <tt><font size=+1>Memimage</font></tt>
|
||
|
|
analogues of <i>allocsubfont</i>, <i>openfont</i>, <i>freesubfont</i>, <i>strsubfontwidth</i>,
|
||
|
|
<i>getdefont</i>, and <tt><font size=+1>string</font></tt> (see <a href="../man3/subfont.html"><i>subfont</i>(3)</a> and <a href="../man3/graphics.html"><i>graphics</i>(3)</a>), except
|
||
|
|
that they operate only on <tt><font size=+1>Memsubfont</font></tt>s rather than <tt><font size=+1>Font</font></tt>s.
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
|
||
|
|
|
||
|
|
<i>Drawclip</i> takes the images involved in a draw operation, together
|
||
|
|
with the destination rectangle <tt><font size=+1>dr</font></tt> and source and mask alignment
|
||
|
|
points <tt><font size=+1>sp</font></tt> and <tt><font size=+1>mp</font></tt>, and clips them according to the clipping rectangles
|
||
|
|
of the images involved. It also fills in the rectangles <tt><font size=+1>sr</font></tt> and
|
||
|
|
<tt><font size=+1>mr</font></tt> with rectangles congruent to the returned
|
||
|
|
destination rectangle but translated so the upper left corners
|
||
|
|
are the returned <tt><font size=+1>sp</font></tt> and <tt><font size=+1>mp</font></tt>. <i>Drawclip</i> returns zero when the clipped
|
||
|
|
rectangle is empty. <i>Memlinebbox</i> returns a conservative bounding
|
||
|
|
box containing a line between two points with given end styles
|
||
|
|
and radius. <i>Memlineendsize</i> calculates the extra length
|
||
|
|
added to a line by attaching an end of a given style.
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
|
||
|
|
|
||
|
|
The <i>hwdraw</i> and <i>iprint</i> functions are no-op stubs that may be overridden
|
||
|
|
by clients of the library. <i>Hwdraw</i> is called at each call to <i>memimagedraw</i>
|
||
|
|
with the current request’s parameters. If it can satisfy the request,
|
||
|
|
it should do so and return 1. If it cannot satisfy the request,
|
||
|
|
it should return 0. This allows (for
|
||
|
|
instance) the kernel to take advantage of hardware acceleration.
|
||
|
|
<i>Iprint</i> should format and print its arguments; it is given much
|
||
|
|
debugging output when the global integer variable <tt><font size=+1>drawdebug</font></tt> is
|
||
|
|
non-zero. In the kernel, <i>iprint</i> prints to a serial line rather
|
||
|
|
than the screen, for obvious reasons.
|
||
|
|
|
||
|
|
</table>
|
||
|
|
<p><font size=+1><b>SOURCE </b></font><br>
|
||
|
|
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
|
||
|
|
|
||
|
|
<tt><font size=+1>/usr/local/plan9/src/libdraw<br>
|
||
|
|
</font></tt>
|
||
|
|
</table>
|
||
|
|
<p><font size=+1><b>SEE ALSO </b></font><br>
|
||
|
|
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
|
||
|
|
|
||
|
|
<a href="../man3/addpt.html"><i>addpt</i>(3)</a>, <a href="../man3/color.html"><i>color</i>(3)</a>, <a href="../man3/draw.html"><i>draw</i>(3)</a>, <a href="../man3/graphics.html"><i>graphics</i>(3)</a>, <a href="../man3/memlayer.html"><i>memlayer</i>(3)</a>, <a href="../man3/stringsize.html"><i>stringsize</i>(3)</a>,
|
||
|
|
<a href="../man3/subfont.html"><i>subfont</i>(3)</a>, <a href="../man7/color.html"><i>color</i>(7)</a>, <a href="../man7/utf.html"><i>utf</i>(7)</a><br>
|
||
|
|
|
||
|
|
</table>
|
||
|
|
<p><font size=+1><b>BUGS </b></font><br>
|
||
|
|
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
|
||
|
|
|
||
|
|
<i>Memimagestring</i> is unusual in using a subfont rather than a font,
|
||
|
|
and in having no parameter to align the source.
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
|
||
|
|
|
||
|
|
These functions are archived into <i>libdraw</i>.<br>
|
||
|
|
|
||
|
|
</table>
|
||
|
|
|
||
|
|
<td width=20>
|
||
|
|
<tr height=20><td>
|
||
|
|
</table>
|
||
|
|
<!-- TRAILER -->
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0 width=100%>
|
||
|
|
<tr height=15><td width=10><td><td width=10>
|
||
|
|
<tr><td><td>
|
||
|
|
<center>
|
||
|
|
<a href="../../"><img src="../../dist/spaceglenda100.png" alt="Space Glenda" border=1></a>
|
||
|
|
</center>
|
||
|
|
</table>
|
||
|
|
<!-- TRAILER -->
|
||
|
|
</body></html>
|