.de F .B .if !"\\$1"" \&\\$1 \\$2 \\$3 \\$4 \\$5 \\$6 .. .de L .B .if !"\\$1"" \&\\$1 \\$2 \\$3 \\$4 \\$5 \\$6 .. .de FR .BR "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" .. .de LR .BR "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" .. .de CW .ft B .. .\" This is gross but it avoids relying on internal implementation details .\" of the -man macros. .de TF .IP "" \w'\fB\\$1\ \ \fP'u .PD0 .. .de EX .CW .nf .. .de EE .fi .. .\" delete above this point if your system has F, L, FR, LR, CW and TF macros .TH BITBLT 3G .SH NAME bitblt, bitbltclip, copymasked, clipline, point, segment, polysegment, arc, circle, disc, ellipse, texture, border, string, strsize, strwidth, Fcode \- graphics functions .SH SYNOPSIS .nf .B #include .B #include .PP .ta \w'\fLPoint 'u .B void bitblt(Bitmap *db, Point dp, Bitmap *sb, .B Rectangle sr, Fcode f) .PP .B int bitbltclip(void *) .PP .B void copymasked(Bitmap *db, Point dp, Bitmap *sb, Bitmap *mb, Rectangle sr) .PP .B int clipline(Rectangle r, Point *p0, Point *p1); .PP .B void point(Bitmap *b, Point p, int v, Fcode f); .PP .B void segment(Bitmap *b, Point p, Point q, int v, Fcode f) .PP .B void polysegment(Bitmap *b, int n, Point *pp, int v, Fcode f) .PP .B void circle(Bitmap *b, Point p, int r, int v, Fcode f); .PP .B void arc(Bitmap *b, Point p0, Point p1, Point p2, int v, Fcode f); .PP .B void disc(Bitmap *b, Point p, int r, int v, Fcode f); .PP .B void ellipse(Bitmap *b, Point p, int a, int b, int v, Fcode f); .PP .B void texture(Bitmap *b, Rectangle r, Bitmap *t, Fcode f) .PP .B void border(Bitmap *b, Rectangle r, int w, Fcode f) .PP .B Point string(Bitmap *b, Point p, Font *ft, char *s, Fcode f) .PP .B Point strsize(Font *ft, char *s) .PP .B long strwidth(Font *ft, char *s) .PP .ft L .ta 8n +\w'xxxxxxxxxx'u +\w'xxxxxxxxxx'u +\w'xxxxxxxxxx'u +\w'xxxxxxxxxx'u enum Fcode { Zero, DnorS, DandnotS, notS, notDandS, notD, DxorS, DnandS, DandS, DxnorS, D, DornotS, S, notDorS, DorS, F } Fcode; .ft P .fi .SH DESCRIPTION .I Bitblt (bit-block transfer) takes bits from rectangle .I sr in the .I source Bitmap, .IR sb, and overlays them on a congruent rectangle with the .B min corner at point .B dp in the .I destination bitmap, .IR db . The .I f parameter says how to compute each destination pixel as a function of the source and destination pixels. The first sixteen codes in .B Fcode give all possible boolean operations on the source, .B S and destination .BR D . The code values have been arranged so that they may be expressed as boolean operations on the values .B S and .BR D. So, for example, .B D|S computes the result as the logical .I or of the destination pixel's old value and the overlaying source pixel's value. If pixels are more than one bit deep, the operations are bitwise. The .B Zero and .B F codes result in new pixel values that are all zeros or all ones, respectively. .PP If the source and destination bitmaps have different depths, the source rectangle is first converted to have the same depth as the destination, as follows: conversion to a smaller number of bits per pixel is accomplished by taking the desired number of high order bits; conversion to a larger number of bits per pixel is accomplished by putting the small value into the high order bits, and replicating it as many times as necessary to fill the lower order bits. .PP .I Copymasked copies rectangle .I sr in the source bitmap .I sb to the congruent rectangle with the .B min corner at point .B dp in the destination bitmap .IR db , masked by bitmap .I mb . This means that .I mb is overlayed on the destination rectangle, and only pixels corresponding to 1 bits in the mask are changed. .I Mb must be a 1-bit-deep bitmap with origin (0,0) and congruent to .IR sr . Bitmaps .I sb and .I db must have the same depth. .PP All of the drawing graphics functions clip the rectangle against the source and destination bitmaps, so that only pixels within the destination bitmap are changed, and none are changed that would have come from areas outside the source bitmap. .I Bitbltclip takes a pointer to the first argument of a .I bitblt argument list, and modifies .I dp and .I sr so that no more clipping is needed. .PP .I Point changes the value of the destination point .I p in bitmap .I b according to function code .IR f . The source is a pixel with value .IR v . It is useful to use .B "~0" when the maximum pixel value is desired for the source. .PP .IR Segment , .IR circle , .IR disc , and .I ellipse all draw in bitmap .I b with function code .I f and a source pixel with value .IR v . .I Arc draws a circular arc centered on .IR p0 , traveling clockwise from .I p1 to .I p2 or a point on the circle near .IR p2 . .I Segment draws a line segment in bitmap .I b from point .I p to .IR q . The segment is half-open: .I p is the first point of the segment and .I q is the first point beyond the segment, so adjacent segments sharing endpoints abut. .PP .I Polysegment draws the .IR n \-1 segments joining the .I n points in the array pointed to by .I pp. .I Clipline clips the line segment from .RI * p0 to .RI * p1 .RI ( p0 is closed, .I p1 is open) to rectangle .IR r , adjusting .I p0 and .I p1 so that the segment is within the rectangle and .RI * p1 is closed. It returns 0 if none of the segment is in the rectangle, 1 otherwise. .PP .I Circle draws a circle with radius .I r and center at point .IR p . .I Disc is the same except that it fills the circle. .I Ellipse draws an ellipse with horizontal semi-axis .I a and vertical semi-axis .IR b. .PP .I Border draws, with function .I f in bitmap .IR b , the rectangular outline with lines of width .IR w , fitting just inside rectangle .IR r . .PP .I Texture draws, with function .I f in bitmap .IR b , a texture using the bitmap specified by .IR t . The texture bitmap is aligned on .IR b 's coordinate system so that (0,0) in both coordinate systems coincide, and then .I t is replicated to form a tiling of .IR b . The tiling is clipped to rectangle .I r in .IR b , and then transferred to .I b using the specified function. .PP .I String draws the text characters given by the null-terminated (UTF encoded) string .I s into bitmap .IR b , using font .IR ft. The upper left corner of the first character (i.e., a point that is .IB ft ->ascent above the baseline) is placed at point .IR p , and subsequent characters are placed on the same baseline, displaced to the right by the previous character's .BR width . The individual characters are .IR bitblt 'ed into the destination, using drawing function .IR f . .I String returns the point in the destination bitmap after the final character of .I s (or where the final character would be drawn, assuming no clipping; the returned value might be outside the destination bitmap). .PP The bounding box for text to be drawn with .I string in font .I ft can be found with .IR strsize ; it returns the .B max point of the bounding box, assuming a .B min point of (0,0). .I Strwidth returns the .IR x -component of the .B max point. .SH SEE ALSO .IR graphics (3), .IT utf (4).