1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
|
.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 BITMAP 6
.SH NAME
bitmap \- external format for bitmaps
.SH SYNOPSIS
.B
#include <libc.h>
.B
#include <libg.h>
.SH DESCRIPTION
Bitmaps are described in
.IR graphics (3).
Fonts and bitmaps are stored in external files
in machine-independent formats.
.PP
Bitmap files are read and written using
.I rdbitmapfile
and
.I wrbitmapfile
(see
.IR balloc (3)).
A bitmap file starts with 5
decimal strings:
.BR ldepth ,
.BR r.min.x ,
.BR r.min.y ,
.BR r.max.x ,
and
.BR r.max.y .
Each number is right-justified and blank padded in 11 characters, followed by a blank.
The rest of the file contains the
.BR r.max.y \- r.min.y
rows of bitmap data.
A
.I row
consists of the byte containing pixel
.B r.min.x
and all the bytes up to and including the byte containing pixel
.B r.max.x\fR\(mi1.
A pixel with x-coordinate =
.I x
in a bitmap with
.B ldepth
=
.I l
will appear as
.if t \fIw\fP = 2\u\s8\fIl\fP\s10\d
.if n w = 2^l
contiguous bits in a byte, with the pixel's high order bit
starting at the byte's bit number
.if t \fIw\fP\(mu((\fIx\fP mod 8)/\fIw\fP),
.if n w*(x mod 8/w),
where bits within a byte are numbered 0 to 7 from the
high order to the low order bit.
If
.I w
is greater than 8, it is a multiple of 8, so
pixel values take up an integral number of bytes.
Rows contain integral number of bytes, so there may be some unused
pixels at either end of a row.
.PP
The
.I rdbitmap
and
.I wrbitmap
functions described in
.IR balloc (3)
also deal with rows in this format, stored in user memory.
.PP
Some small images, in particular 48\(mu48 face files
and 16\(mu16
cursors, are stored textually, suitable for inclusion in C source.
Each line of text represents one scan line as a
comma-separated sequence of hexadecimal
bytes, shorts, or words in C format.
For cursors, each line defines a pair of bytes.
(It takes two images to define a cursor; each must be stored separately.)
Face files of one bit per pixel are stored as a sequence of shorts,
those of larger pixel sizes as a sequence of longs.
Software that reads these files must deduce the image size from
the input; there is no header.
These formats reflect history rather than design.
.SH "SEE ALSO"
.IR graphics (3),
.IR bitblt (3),
.IR balloc (3),
.IR font (6)
|