|
|
1.1 root 1: .TH ADDR 3R "630 MTG"
2: .XE "addr()"
3: .SH NAME
4: addr \- return the Word address of a Point in a Bitmap
5: .SH SYNOPSIS
6: \f3#include <dmd.h>\f1
7: .sp
8: \f3Word \(**addr (b, p)\f1
9: .br
10: .B Bitmap \(**b;
11: .br
12: .B Point p;\fR
13: .SH DESCRIPTION
14: The
15: .I addr
16: function
17: returns the address of the Word containing the bit
18: corresponding to the Point
19: .I p
20: in the Bitmap
21: .I b.
22: .SH EXAMPLE
23: The following subroutine can be used to determine whether a Point
24: .I p
25: in a Bitmap
26: .I b
27: is on or off (returning 1 or 0, respectively).
28: .PP
29: .RS 3
30: .nf
31: .ft CM
32: #include <dmd.h>
33: Word *addr();
34:
35: pixel (b, p)
36: Bitmap *b;
37: Point p;
38: {
39: Word *w;
40: UWord bit;
41:
42: w = addr (b, p);
43: bit = FIRSTBIT >> (p.x%WORDSIZE);
44: return (*w&bit)==bit;
45: }
46: .fi
47: .ft R
48: .RE
49: .PP
50: This routine is implemented differently in \f2rol\f1(3L).
51: .SH SEE ALSO
52: rol(3L), structure(3R).
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.