Loading...
Searching...
No Matches
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 | write_image (void)
void | write_ppm (void)
void | write_pgm (void)
void | write_bmp (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.
const struct driver * | PNG_Driver (void)
| Initialize display driver.
void | PNG_Box (double, double, double, double)
| Draw a (filled) rectangle.
void | PNG_Client_Close (void)
void | PNG_Erase (void)
| Erase screen.
void | PNG_Graph_close (void)
| Close down the graphics processing. This gets called only at driver termination time.
int | PNG_Graph_set (void)
| Start up graphics processing.
const char * | PNG_Graph_get_file (void)
| Get render file.
void | PNG_Line_width (double)
| Set line width.
void | PNG_begin_raster (int, int[2][2], double[2][2])
| Start drawing raster.
int | PNG_raster (int, int, const unsigned char *, const unsigned char *, const unsigned char *, const unsigned char *)
| Draw raster row.
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.
void | PNG_Set_window (double, double, double, double)
| Set window.
void | PNG_color_rgb (int, int, int)
| Identify a color.
void | PNG_draw_bitmap (int, int, int, const unsigned char *)
| Draw bitmap.

## 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 |  | ) |

extern

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

References path_begin().

Referenced by PNG_Driver().

## PNG_begin_raster()

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

extern

Start drawing raster.

Parameters

  mask | non-zero int for mask
  s | source (map) extent (left, right, top, bottom)
  fd | destination (image) extent (left, right, top, bottom)

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

Referenced by PNG_Driver().

## PNG_Box()

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

extern

Draw a (filled) rectangle.

Parameters

  fx1,fy1,fx2,fy2 | rectangle coordinates

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

References png, and x.

Referenced by PNG_Driver(), and PNG_Point().

## PNG_Client_Close()

void PNG_Client_Close | ( | void |  | ) |

extern

## PNG_Close()

void PNG_Close | ( | void |  | ) |

extern

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

References path_close().

Referenced by PNG_Driver().

## PNG_color_rgb()

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

extern

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

  r | red color value
  g | green color value
  b | blue color value

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

References b, g, png, png_get_color(), and r.

Referenced by PNG_Driver().

## PNG_Cont()

void PNG_Cont | ( | double | x,
|  | double | y )

extern

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

References path_cont(), and x.

Referenced by PNG_Driver().

## PNG_draw_bitmap()

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

extern

Draw bitmap.

Parameters

  ncols,nrows | number of columns and rows
  threshold | threshold value
  buf | data buffer

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

References b, cur_x, cur_y, g, max, min, png, png_get_color(), png_get_pixel(), r, and x.

Referenced by PNG_Driver().

## png_draw_line()

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

extern

Definition at line 68 of file draw_line.c.

References path::alloc, path::count, path_close(), path_cont(), path_move(), png, png_polygon(), path::start, and path::vertices.

Referenced by PNG_Stroke().

## PNG_Driver()

const struct driver * PNG_Driver | ( | void |  | ) |

extern

Initialize display driver.

Returns
  pointer driver structure

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

References driver::Begin, driver::Begin_raster, driver::Bitmap, driver::Box, driver::Close, driver::Color, driver::Cont, driver::End_raster, driver::Erase, driver::Fill, driver::Font_info, driver::Font_list, driver::Graph_close, driver::Graph_get_file, driver::Graph_set, driver::Line_width, driver::Move, driver::name, NULL, PNG_Begin(), PNG_begin_raster(), PNG_Box(), PNG_Close(), PNG_color_rgb(), PNG_Cont(), PNG_draw_bitmap(), PNG_Erase(), PNG_Fill(), PNG_Graph_close(), PNG_Graph_get_file(), PNG_Graph_set(), PNG_Line_width(), PNG_Move(), PNG_Point(), PNG_raster(), PNG_Set_window(), PNG_Stroke(), driver::Point, driver::Raster, driver::Set_font, driver::Set_window, driver::Stroke, driver::Text, and driver::Text_box.

## PNG_Erase()

void PNG_Erase | ( | void |  | ) |

extern

Erase screen.

Definition at line 20 of file pngdriver/erase.c.

References png.

Referenced by PNG_Driver(), and PNG_Graph_set().

## PNG_Fill()

void PNG_Fill | ( | void |  | ) |

extern

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

References png_polygon().

Referenced by PNG_Driver().

## png_get_color()

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

extern

Definition at line 118 of file color_table.c.

References b, g, png, and r.

Referenced by PNG_color_rgb(), PNG_draw_bitmap(), PNG_Graph_set(), PNG_raster(), read_bmp(), read_pgm(), read_png(), and read_ppm().

## png_get_pixel()

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

extern

Definition at line 110 of file color_table.c.

References b, g, png, and r.

Referenced by PNG_draw_bitmap(), write_bmp(), write_pgm(), write_png(), and write_ppm().

## PNG_Graph_close()

void PNG_Graph_close | ( | void |  | ) |

extern

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

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

References G_free(), png, and write_image().

Referenced by PNG_Driver().

## PNG_Graph_get_file()

const char * PNG_Graph_get_file | ( | void |  | ) |

extern

Get render file.

Returns
  file name

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

References png.

Referenced by PNG_Driver().

## PNG_Graph_set()

int PNG_Graph_set | ( | void |  | ) |

extern

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 pixel 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 86 of file pngdriver/graph_set.c.

References FILE_NAME, G_debug(), G_str_to_color(), G_strcasecmp(), G_verbose_message(), png, PNG_Erase(), png_get_color(), png_init_color_table(), read_image(), screen_height, screen_width, and write_image().

Referenced by PNG_Driver().

## png_init_color_table()

void png_init_color_table | ( | void |  | ) |

extern

Definition at line 72 of file color_table.c.

References png.

Referenced by PNG_Graph_set().

## PNG_Line_width()

void PNG_Line_width | ( | double | width | ) |

extern

Set line width.

Parameters

  width | line width (double precision)

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

References png.

Referenced by PNG_Driver().

## PNG_Move()

void PNG_Move | ( | double | x,
|  | double | y )

extern

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

References path_move(), and x.

Referenced by PNG_Driver().

## PNG_Point()

void PNG_Point | ( | double | x,
|  | double | y )

extern

Draw point.

Definition at line 20 of file point.c.

References PNG_Box(), and x.

Referenced by PNG_Driver().

## png_polygon()

void png_polygon | ( | struct path * | p | ) |

extern

Draw polygon.

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

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

Referenced by png_draw_line(), and PNG_Fill().

## PNG_raster()

int PNG_raster | ( | int | n,
|  | int | row,
|  | const unsigned char * | red,
|  | const unsigned char * | grn,
|  | const unsigned char * | blu,
|  | const unsigned char * | nul )

extern

Draw raster row.

Parameters

  n | number of cells
  row | raster row (starts at 0)
  red,grn,blu,nul | red,green,blue and null value

Returns
  next row

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

References max, min, png, png_get_color(), and x.

Referenced by PNG_Driver().

## PNG_Set_window()

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

extern

Set window.

Parameters

  t,b,l,r | top, bottom, left, right

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

References b, l, png, r, and t.

Referenced by PNG_Driver().

## PNG_Stroke()

void PNG_Stroke | ( | void |  | ) |

extern

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

References path_stroke(), and png_draw_line().

Referenced by PNG_Driver().

## read_bmp()

void read_bmp | ( | void |  | ) |

extern

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

References b, g, G_fatal_error(), HEADER_SIZE, png, png_get_color(), r, and x.

Referenced by read_image().

## read_image()

void read_image | ( | void |  | ) |

extern

Definition at line 22 of file pngdriver/read.c.

References G_fatal_error(), G_strcasecmp(), png, read_bmp(), read_pgm(), read_png(), and read_ppm().

Referenced by PNG_Graph_set().

## read_pgm()

void read_pgm | ( | void |  | ) |

extern

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

References G_fatal_error(), G_free(), G_store(), png, png_get_color(), and x.

Referenced by read_image().

## read_ppm()

void read_ppm | ( | void |  | ) |

extern

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

References b, g, G_fatal_error(), png, png_get_color(), r, and x.

Referenced by read_image().

## write_bmp()

void write_bmp | ( | void |  | ) |

extern

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

References b, g, G_fatal_error(), HEADER_SIZE, output(), png, png_get_pixel(), r, and x.

Referenced by write_image().

## write_image()

void write_image | ( | void |  | ) |

extern

Definition at line 22 of file pngdriver/write.c.

References G_fatal_error(), G_strcasecmp(), png, write_bmp(), write_pgm(), write_png(), and write_ppm().

Referenced by PNG_Graph_close(), and PNG_Graph_set().

## write_pgm()

void write_pgm | ( | void |  | ) |

extern

Definition at line 49 of file pngdriver/write_ppm.c.

References b, g, G_fatal_error(), G_free(), G_store(), output(), png, png_get_pixel(), r, and x.

Referenced by write_image().

## write_ppm()

void write_ppm | ( | void |  | ) |

extern

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

References b, g, G_fatal_error(), output(), png, png_get_pixel(), r, and x.

Referenced by write_image().

## Variable Documentation

## png

struct png_state png

extern

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

Referenced by PNG_Box(), PNG_color_rgb(), PNG_draw_bitmap(), png_draw_line(), PNG_draw_point(), PNG_Erase(), png_get_color(), png_get_pixel(), PNG_Graph_close(), PNG_Graph_get_file(), PNG_Graph_set(), png_init_color_table(), PNG_Line_width(), png_polygon(), PNG_raster(), PNG_Set_window(), read_bmp(), read_image(), read_pgm(), read_png(), read_ppm(), write_bmp(), write_image(), write_pgm(), write_png(), and write_ppm().