GRASS GIS 8 Programmer's Manual  8.5.0dev(2024)-6596d49e63
pngdriver.h File Reference

GRASS png display driver - header file. More...

#include <stdio.h>
#include <grass/config.h>
#include "driver.h"
#include "path.h"
Include dependency graph for pngdriver.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  png_state
 

Macros

#define FILE_NAME   "map.png"
 
#define HEADER_SIZE   64
 

Functions

void read_image (void)
 
void read_ppm (void)
 
void read_pgm (void)
 
void read_bmp (void)
 
void read_png (void)
 
void write_image (void)
 
void write_ppm (void)
 
void write_pgm (void)
 
void write_bmp (void)
 
void write_png (void)
 
void png_init_color_table (void)
 
unsigned int png_get_color (int, int, int, int)
 
void png_get_pixel (unsigned int, int *, int *, int *, int *)
 
void png_draw_line (double, double, double, double)
 
void png_polygon (struct path *)
 Draw polygon. More...
 
const struct driverPNG_Driver (void)
 Initialize display driver. More...
 
void PNG_Box (double, double, double, double)
 Draw a (filled) rectangle. More...
 
void PNG_Client_Close (void)
 
void PNG_Erase (void)
 Erase screen. More...
 
void PNG_Graph_close (void)
 Close down the graphics processing. This gets called only at driver termination time. More...
 
int PNG_Graph_set (void)
 Start up graphics processing. More...
 
const char * PNG_Graph_get_file (void)
 Get render file. More...
 
void PNG_Line_width (double)
 Set line width. More...
 
void PNG_begin_raster (int, int[2][2], double[2][2])
 Start drawing raster. More...
 
int PNG_raster (int, int, const unsigned char *, const unsigned char *, const unsigned char *, const unsigned char *)
 
void PNG_Begin (void)
 
void PNG_Move (double, double)
 
void PNG_Cont (double, double)
 
void PNG_Close (void)
 
void PNG_Stroke (void)
 
void PNG_Fill (void)
 
void PNG_Point (double, double)
 Draw point. More...
 
void PNG_Set_window (double, double, double, double)
 Set window. More...
 
void PNG_color_rgb (int, int, int)
 Identify a color. More...
 
void PNG_draw_bitmap (int, int, int, const unsigned char *)
 Draw bitmap. More...
 

Variables

struct png_state png
 

Detailed Description

GRASS png display driver - header file.

(C) 2007-2014 by Glynn Clements and the GRASS Development Team

This program is free software under the GNU General Public License (>=v2). Read the file COPYING that comes with GRASS for details.

Author
Glynn Clements

Definition in file pngdriver.h.

Macro Definition Documentation

◆ FILE_NAME

#define FILE_NAME   "map.png"

Definition at line 27 of file pngdriver.h.

◆ HEADER_SIZE

#define HEADER_SIZE   64

Definition at line 29 of file pngdriver.h.

Function Documentation

◆ PNG_Begin()

void PNG_Begin ( void  )

Definition at line 21 of file pngdriver/draw.c.

References path_begin().

◆ PNG_begin_raster()

void PNG_begin_raster ( int  mask,
int  s[2][2],
double  fd[2][2] 
)

Start drawing raster.

Parameters
masknon-zero int for mask
ssource (map) extent (left, right, top, bottom)
fddestination (image) extent (left, right, top, bottom)

Definition at line 80 of file pngdriver/raster.c.

◆ PNG_Box()

void PNG_Box ( double  fx1,
double  fy1,
double  fx2,
double  fy2 
)

Draw a (filled) rectangle.

Parameters
fx1,fy1,fx2,fy2rectangle coordinates

Definition at line 24 of file pngdriver/box.c.

Referenced by PNG_Point().

◆ PNG_Client_Close()

void PNG_Client_Close ( void  )

◆ PNG_Close()

void PNG_Close ( void  )

Definition at line 36 of file pngdriver/draw.c.

References path_close().

◆ PNG_color_rgb()

void PNG_color_rgb ( int  r,
int  g,
int  b 
)

Identify a color.

Identify a color that has been set in the reset_color() (found in Reset_clr.c file in this directory). Subsequent graphics calls will use this color.

Called by: Color() in ../lib/Color.c

Parameters
rred color value
ggreen color value
bblue color value

Definition at line 32 of file pngdriver/color.c.

References b, png_state::current_color, g, png, png_get_color(), and r.

◆ PNG_Cont()

void PNG_Cont ( double  x,
double  y 
)

Definition at line 31 of file pngdriver/draw.c.

References path_cont(), and x.

◆ PNG_draw_bitmap()

void PNG_draw_bitmap ( int  ncols,
int  nrows,
int  threshold,
const unsigned char *  buf 
)

Draw bitmap.

Parameters
ncols,nrowsnumber of columns and rows
thresholdthreshold value
bufdata buffer

Definition at line 33 of file pngdriver/draw_bitmap.c.

◆ png_draw_line()

void png_draw_line ( double  x1,
double  y1,
double  x2,
double  y2 
)

Definition at line 68 of file draw_line.c.

Referenced by PNG_Stroke().

◆ PNG_Driver()

const struct driver* PNG_Driver ( void  )

Initialize display driver.

Returns
pointer driver structure

Definition at line 21 of file pngdriver/driver.c.

◆ PNG_Erase()

void PNG_Erase ( void  )

◆ PNG_Fill()

void PNG_Fill ( void  )

Definition at line 46 of file pngdriver/draw.c.

References png_polygon().

◆ png_get_color()

unsigned int png_get_color ( int  r,
int  g,
int  b,
int  a 
)

Definition at line 118 of file color_table.c.

Referenced by PNG_color_rgb(), and PNG_Graph_set().

◆ png_get_pixel()

void png_get_pixel ( unsigned int  pixel,
int *  r,
int *  g,
int *  b,
int *  a 
)

Definition at line 110 of file color_table.c.

◆ PNG_Graph_close()

void PNG_Graph_close ( void  )

Close down the graphics processing. This gets called only at driver termination time.

Definition at line 50 of file pngdriver/graph_close.c.

References png_state::mapped, png, and write_image().

◆ PNG_Graph_get_file()

const char* PNG_Graph_get_file ( void  )

Get render file.

Returns
file name

Definition at line 179 of file pngdriver/graph_set.c.

References png_state::file_name, and png.

◆ PNG_Graph_set()

int PNG_Graph_set ( void  )

Start up graphics processing.

Anything that needs to be assigned, set up, started-up, or otherwise initialized happens here. This is called only at the startup of the graphics driver.

The external variables define the pixle limits of the graphics surface. The coordinate system used by the applications programs has the (0,0) origin in the upper left-hand corner. Hence, screen_left < screen_right screen_top < screen_bottom

Definition at line 81 of file pngdriver/graph_set.c.

References _, png_state::background, png_state::clip_bot, png_state::clip_left, png_state::clip_rite, png_state::clip_top, DEFAULT_FG_COLOR, FILE_NAME, png_state::file_name, G_debug(), G_gisinit, G_str_to_color(), G_strcasecmp(), G_verbose_message(), png_state::has_alpha, png_state::height, png, png_get_color(), png_init_color_table(), screen_height, screen_width, png_state::true_color, and png_state::width.

◆ png_init_color_table()

void png_init_color_table ( void  )

Definition at line 72 of file color_table.c.

References png, and png_state::true_color.

Referenced by PNG_Graph_set().

◆ PNG_Line_width()

void PNG_Line_width ( double  width)

Set line width.

Parameters
widthline width (double precision)

Definition at line 23 of file pngdriver/line_width.c.

◆ PNG_Move()

void PNG_Move ( double  x,
double  y 
)

Definition at line 26 of file pngdriver/draw.c.

References path_move(), and x.

◆ PNG_Point()

void PNG_Point ( double  x,
double  y 
)

Draw point.

Definition at line 20 of file point.c.

References PNG_Box(), and x.

◆ png_polygon()

void png_polygon ( struct path p)

Draw polygon.

Definition at line 135 of file pngdriver/polygon.c.

References path::count, vertex::mode, P_CLOSE, path_close(), and path::vertices.

Referenced by PNG_Fill().

◆ PNG_raster()

int PNG_raster ( int  ,
int  ,
const unsigned char *  ,
const unsigned char *  ,
const unsigned char *  ,
const unsigned char *   
)

◆ PNG_Set_window()

void PNG_Set_window ( double  t,
double  b,
double  l,
double  r 
)

Set window.

Parameters
t,b,l,rtop, bottom, left, right

Definition at line 23 of file pngdriver/set_window.c.

References b, png_state::clip_bot, png_state::clip_left, png_state::clip_rite, png_state::clip_top, png_state::height, l, png, r, t, and png_state::width.

◆ PNG_Stroke()

void PNG_Stroke ( void  )

Definition at line 41 of file pngdriver/draw.c.

References path_stroke(), and png_draw_line().

◆ read_bmp()

void read_bmp ( void  )

Definition at line 79 of file pngdriver/read_bmp.c.

References HEADER_SIZE.

Referenced by read_image().

◆ read_image()

◆ read_pgm()

void read_pgm ( void  )

Definition at line 68 of file pngdriver/read_ppm.c.

References png_state::file_name, G_store(), and png.

Referenced by read_image().

◆ read_png()

void read_png ( void  )

Definition at line 45 of file read_png.c.

Referenced by read_image().

◆ read_ppm()

void read_ppm ( void  )

Definition at line 21 of file pngdriver/read_ppm.c.

Referenced by read_image().

◆ write_bmp()

void write_bmp ( void  )

Definition at line 63 of file pngdriver/write_bmp.c.

References png_state::file_name, G_fatal_error(), HEADER_SIZE, output(), png, and x.

Referenced by write_image().

◆ write_image()

◆ write_pgm()

void write_pgm ( void  )

◆ write_png()

void write_png ( void  )

Definition at line 55 of file write_png.c.

References output(), and x.

Referenced by write_image().

◆ write_ppm()

void write_ppm ( void  )

Variable Documentation

◆ png