GRASS 8 Programmer's Manual
8.6.0dev(2026)-1d1e47ad9d
Loading...
Searching...
No Matches
psdriver/draw_bitmap.c
Go to the documentation of this file.
1
#include "
psdriver.h
"
2
3
void
PS_Bitmap
(
int
ncols,
int
nrows,
int
threshold
,
const
unsigned
char
*buf)
4
{
5
int
i,
j
;
6
7
output
(
"%d %d %d %d BITMAP\n"
,
cur_x
,
cur_y
, ncols, nrows);
8
9
for
(
j
= 0;
j
< nrows;
j
++) {
10
unsigned
int
bit
= 0x80;
11
unsigned
int
acc
= 0;
12
13
for
(i = 0; i < ncols; i++) {
14
unsigned
int
k = buf[
j
* ncols + i];
15
16
if
(k > (
unsigned
int
)
threshold
)
17
acc
|=
bit
;
18
19
bit
>>= 1;
20
21
if
(!
bit
) {
22
output
(
"%02X"
,
acc
);
23
bit
= 0x80;
24
acc
= 0;
25
}
26
}
27
28
if
(
bit
!= 0x80)
29
output
(
"%02X"
,
acc
);
30
31
output
(
"\n"
);
32
}
33
}
AMI_STREAM
Definition
ami_stream.h:153
cur_x
double cur_x
Definition
driver/init.c:32
cur_y
double cur_y
Definition
driver/init.c:33
PS_Bitmap
void PS_Bitmap(int ncols, int nrows, int threshold, const unsigned char *buf)
Definition
psdriver/draw_bitmap.c:3
output
void output(const char *fmt,...)
Definition
psdriver/graph_set.c:233
psdriver.h
lib
psdriver
draw_bitmap.c
Generated on Fri Apr 3 2026 06:59:55 for GRASS 8 Programmer's Manual by
1.9.8