GRASS GIS 8 Programmer's Manual
8.3.2(2024)-exported
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
}
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:232
psdriver.h
psdriver
draw_bitmap.c
Generated on Sat Nov 9 2024 17:44:25 for GRASS GIS 8 Programmer's Manual by
1.12.0