GRASS GIS 7 Programmer's Manual
7.8.2(2019)-exported
psdriver/draw_bitmap.c
Go to the documentation of this file.
1
2
#include "
psdriver.h
"
3
4
void
PS_Bitmap
(
int
ncols,
int
nrows,
int
threshold,
5
const
unsigned
char
*buf)
6
{
7
int
i, j;
8
9
output
(
"%d %d %d %d BITMAP\n"
,
cur_x
,
cur_y
, ncols, nrows);
10
11
for
(j = 0; j < nrows; j++) {
12
unsigned
int
bit = 0x80;
13
unsigned
int
acc = 0;
14
15
for
(i = 0; i < ncols; i++) {
16
unsigned
int
k = buf[j * ncols + i];
17
18
if
(k > threshold)
19
acc |= bit;
20
21
bit >>= 1;
22
23
if
(!bit) {
24
output
(
"%02X"
, acc);
25
bit = 0x80;
26
acc = 0;
27
}
28
}
29
30
if
(bit != 0x80)
31
output
(
"%02X"
, acc);
32
33
output
(
"\n"
);
34
}
35
}
output
void output(const char *fmt,...)
Definition:
psdriver/graph_set.c:233
PS_Bitmap
void PS_Bitmap(int ncols, int nrows, int threshold, const unsigned char *buf)
Definition:
psdriver/draw_bitmap.c:4
cur_x
double cur_x
Definition:
driver/init.c:32
psdriver.h
cur_y
double cur_y
Definition:
driver/init.c:33
psdriver
draw_bitmap.c
Generated on Sat Jan 25 2020 17:06:53 for GRASS GIS 7 Programmer's Manual by
1.8.16