GRASS GIS 8 Programmer's Manual  8.2.2dev(2023)-3d2c704037
display/raster.c File Reference

Display Driver - draw raster data. More...

#include <stdio.h>
#include <stdlib.h>
#include <grass/gis.h>
#include <grass/raster.h>
#include <grass/display.h>
#include "driver.h"
Include dependency graph for display/raster.c:

Go to the source code of this file.

Functions

int D_draw_raster (int A_row, const void *array, struct Colors *colors, RASTER_MAP_TYPE data_type)
 Draw raster row. More...
 
int D_draw_d_raster (int A_row, const DCELL *darray, struct Colors *colors)
 Draw raster row (DCELL) More...
 
int D_draw_f_raster (int A_row, const FCELL *farray, struct Colors *colors)
 Draw raster row (FCELL) More...
 
int D_draw_c_raster (int A_row, const CELL *carray, struct Colors *colors)
 Draw raster row (CELL) More...
 
void D_raster_draw_begin (void)
 Prepare for raster graphic. More...
 
int D_draw_raster_RGB (int A_row, const void *r_raster, const void *g_raster, const void *b_raster, struct Colors *r_colors, struct Colors *g_colors, struct Colors *b_colors, RASTER_MAP_TYPE r_type, RASTER_MAP_TYPE g_type, RASTER_MAP_TYPE b_type)
 Draw raster row in RGB mode. More...
 
void D_raster_draw_end (void)
 Finish raster rendering. More...
 

Variables

int D__overlay_mode
 

Detailed Description

Display Driver - draw raster data.

(C) 2006-2011 by 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 <glynn gclements.plus.com> (original contributor)
Huidae Cho <grass4u gmail.com>

Definition in file display/raster.c.

Function Documentation

◆ D_draw_c_raster()

int D_draw_c_raster ( int  A_row,
const CELL carray,
struct Colors colors 
)

Draw raster row (CELL)

The row gives the map array row. The carray array provides the categories for each raster value in that row. This routine is called consecutively with the information necessary to draw a raster image from north to south. No rows can be skipped. All screen pixel rows which represent the current map array row are rendered. The routine returns the map array row which is needed to draw the next screen pixel row.

Parameters
A_rowrow number (starts at 0)
carraydata buffer
colorspointer to Colors structure
Returns
row number needed for next pixel row
-1 nothing to draw (on error or end of raster)

Definition at line 105 of file display/raster.c.

◆ D_draw_d_raster()

int D_draw_d_raster ( int  A_row,
const DCELL darray,
struct Colors colors 
)

Draw raster row (DCELL)

Parameters
A_rowrow number (starts at 0)
darraydata buffer
colorspointer to Colors structure
Returns

Definition at line 67 of file display/raster.c.

◆ D_draw_f_raster()

int D_draw_f_raster ( int  A_row,
const FCELL farray,
struct Colors colors 
)

Draw raster row (FCELL)

Parameters
A_rowrow number (starts at 0)
farraydata buffer
colorspointer to Colors structure
Returns
row number needed for next pixel row
-1 nothing to draw (on error or end of raster)

Definition at line 82 of file display/raster.c.

◆ D_draw_raster()

int D_draw_raster ( int  A_row,
const void *  array,
struct Colors colors,
RASTER_MAP_TYPE  data_type 
)

Draw raster row.

  • determine which pixel row gets the data
  • resamples the data to create a pixel array
  • determines best way to draw the array a - for single cat array, a move and a draw b - otherwise, a call to D_raster()

Presumes the map is drawn from north to south.

If overlay mode is desired, then call D_set_overlay_mode() first.

Parameters
A_rowrow number (starts at 0)
arraydata buffer
colorspointer to Colors structure
data_typeraster type (CELL, FCELL, DCELL)
Returns
row number needed for next pixel row
-1 nothing to draw (on error or end of raster)

Definition at line 51 of file display/raster.c.

◆ D_draw_raster_RGB()

int D_draw_raster_RGB ( int  A_row,
const void *  r_raster,
const void *  g_raster,
const void *  b_raster,
struct Colors r_colors,
struct Colors g_colors,
struct Colors b_colors,
RASTER_MAP_TYPE  r_type,
RASTER_MAP_TYPE  g_type,
RASTER_MAP_TYPE  b_type 
)

Draw raster row in RGB mode.

Parameters
A_rowrow number (starts at 0)
r_rasterred data buffer
g_rastergreen data buffer
b_rasterblue data buffer
r_colorscolors used for red channel
g_colorscolors used for green channel
b_colorscolors used for blue channel
r_typeraster type used for red channel
g_typeraster type used for red channel
b_typeraster type used for red channel
Returns
row number needed for next pixel row
-1 nothing to draw (on error or end of raster)

Definition at line 177 of file display/raster.c.

◆ D_raster_draw_begin()

void D_raster_draw_begin ( void  )

Prepare for raster graphic.

The raster display subsystem establishes conversion parameters based on the screen extent defined by top, bottom, left, and right, all of which are obtainable from D_get_dst() for the current frame.

Definition at line 152 of file display/raster.c.

References D_get_a().

◆ D_raster_draw_end()

void D_raster_draw_end ( void  )

Finish raster rendering.

Definition at line 231 of file display/raster.c.

References COM_end_raster().

Variable Documentation

◆ D__overlay_mode

int D__overlay_mode

Definition at line 36 of file raster2.c.

Referenced by D_set_overlay_mode().