GRASS GIS 8 Programmer's Manual
8.5.0dev(2025)-565e82de51
Main Page
Related Pages
Data Structures
Data Structures
Class Hierarchy
Data Fields
All
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
~
Variables
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Related Functions
Files
File List
Globals
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
Variables
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
w
x
y
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
o
p
r
s
t
u
v
w
y
Enumerations
a
c
d
e
h
i
j
l
m
n
o
p
r
s
t
v
y
Enumerator
_
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
r
s
t
u
v
w
y
Macros
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
•
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
pngdriver/graph_close.c
Go to the documentation of this file.
1
/*!
2
\file lib/pngdriver/graph_close.c
3
4
\brief GRASS png display driver - close graphics processing
5
6
(C) 2003-2014 by Glynn Clements and the GRASS Development Team
7
8
This program is free software under the GNU General Public License
9
(>=v2). Read the file COPYING that comes with GRASS for details.
10
11
\author Per Henrik Johansen (original contributor)
12
\author Glynn Clements
13
*/
14
15
#include <
unistd.h
>
16
#include <
fcntl.h
>
17
#include <sys/types.h>
18
#include <
sys/stat.h
>
19
#ifdef _WIN32
20
#include <windows.h>
21
#else
22
#include <sys/mman.h>
23
#endif
24
25
#include <
grass/gis.h
>
26
#include "
pngdriver.h
"
27
28
static
void
unmap_file(
void
)
29
{
30
size_t
size =
HEADER_SIZE
+
png
.
width
*
png
.
height
*
sizeof
(
unsigned
int);
31
void
*ptr = (
char
*)
png
.
grid
-
HEADER_SIZE
;
32
33
if
(!
png
.
mapped
)
34
return
;
35
36
#ifdef _WIN32
37
UnmapViewOfFile(ptr);
38
CloseHandle(
png
.handle);
39
#else
40
munmap(ptr, size);
41
#endif
42
43
png
.
mapped
= 0;
44
}
45
46
/*!
47
\brief Close down the graphics processing. This gets called only at driver
48
termination time.
49
*/
50
void
PNG_Graph_close
(
void
)
51
{
52
write_image
();
53
54
if
(
png
.
mapped
)
55
unmap_file();
56
else
57
G_free
(
png
.
grid
);
58
}
HEADER_SIZE
#define HEADER_SIZE
Definition:
cairodriver.h:46
G_free
void G_free(void *)
Free allocated memory.
Definition:
gis/alloc.c:150
fcntl.h
Header file for msvc/open.c and msvc/creat.c.
gis.h
PNG_Graph_close
void PNG_Graph_close(void)
Close down the graphics processing. This gets called only at driver termination time.
Definition:
pngdriver/graph_close.c:50
png
struct png_state png
Definition:
pngdriver/graph_set.c:32
pngdriver.h
GRASS png display driver - header file.
write_image
void write_image(void)
Definition:
pngdriver/write.c:22
if
if(!(yy_init))
Definition:
sqlp.yy.c:775
stat.h
png_state::mapped
int mapped
Definition:
pngdriver.h:36
png_state::height
int height
Definition:
pngdriver.h:42
png_state::grid
unsigned int * grid
Definition:
pngdriver.h:43
png_state::width
int width
Definition:
pngdriver.h:42
unistd.h
lib
pngdriver
graph_close.c
Generated on Thu Mar 20 2025 07:33:25 for GRASS GIS 8 Programmer's Manual by
1.9.1