|
GRASS 8 Programmer's Manual 8.6.0dev(2026)-ddeab64dbf
|

Go to the source code of this file.
Erase display (internal use only)
Definition at line 186 of file r_raster.c.
References COM_Erase().
array to screen (column)
Returns an x value in the screen coordinate system when provided the corresponding column value in the array coordinate system.
| A_col | column |
Definition at line 486 of file cnversions.c.
References D.
array to screen (row)
Returns a y value in the screen coordinate system when provided the corresponding row value in the array coordinate system.
| A_row | row |
Definition at line 471 of file cnversions.c.
References D.
array to earth (column)
Returns an x value in the earth coordinate system when provided the corresponding column value in the array coordinate system.
| A_col | column |
Definition at line 457 of file cnversions.c.
array to earth (row)
Returns a y value in the earth coordinate system when provided the corresponding row value in the array coordinate system.
| A_row | row |
Definition at line 442 of file cnversions.c.
Definition at line 292 of file draw2.c.
References path_begin().
Referenced by D_box_abs(), and D_line_abs().
Definition at line 409 of file draw2.c.
References D_begin(), D_close(), D_cont_abs(), D_end(), D_fill(), and D_move_abs().
Referenced by D_box_rel().
Definition at line 486 of file draw2.c.
References D_box_abs().
Definition at line 71 of file raster2.c.
References CELL_TYPE, and D_color_of_type().
Referenced by D_color().
set clipping window to map window
Sets the clipping window to the pixel window that corresponds to the current database region. This is the default.
| ~ |
Definition at line 168 of file draw2.c.
References b, D_get_src(), D_set_clip(), l, r, and t.
Referenced by D_dots().
Definition at line 319 of file draw2.c.
References path_close().
Referenced by D_box_abs(), D_polygon_abs(), and D_polygon_rel().
Close display driver.
If GRASS_NOTIFY is defined, run notifier.
Definition at line 163 of file r_raster.c.
References _, COM_Graph_close(), and G_warning().
this routine modifies the hardware colormap provided that we are not using fixed mode colors.
For use by programs such as d.colors.
| cat | |
| colors |
Definition at line 65 of file raster2.c.
References D_c_color().
get RGB values from color number
Translates the color number provided by D_parse_color into 0-255 RGB values.
Returns 1 if color can be used to draw (is good and isn't 'none'), 0 otherwise.
| color | The color number provided by D_parse_color to convert into 0-255 RGB values. |
| r | Pointer to an integer where the red component will be stored. |
| g | Pointer to an integer where the green component will be stored. |
| b | Pointer to an integer where the blue component will be stored. |
Definition at line 179 of file tran_colr.c.
References color_rgb::b, b, color_rgb::g, g, G_num_standard_colors(), G_standard_color_rgb(), color_rgb::r, and r.
If the data_type is CELL_TYPE, calls D_color((CELL *value, colors); If the data_type is FCELL_TYPE, calls D_f_color((FCELL *value, colors); If the data_type is DCELL_TYPE, calls D_d_color((DCELL *value, colors);.
| raster | |
| colors | |
| data_type |
Definition at line 124 of file raster2.c.
References b, D_RGB_color(), g, r, and Rast_get_color().
Referenced by D_c_color(), D_d_color(), and D_f_color().
Definition at line 311 of file draw2.c.
References path_cont(), vertex::x, and vertex::y.
Referenced by D_box_abs(), D_cont_rel(), and D_line_abs().
Definition at line 445 of file draw2.c.
References D_cont_abs(), and x.
select color for line drawing
Same functionality as D_color() except that the value is type DCELL. This implies that the floating-point interfaces to the colors are used by this routine.
| val | Value |
| colors |
Definition at line 87 of file raster2.c.
References D_color_of_type(), and DCELL_TYPE.
screen to array (x)
Returns a column value in the array coordinate system when provided the corresponding x value in the screen coordinate system.
| D_col | x |
Definition at line 400 of file cnversions.c.
References D.
screen to array (y)
Returns a row value in the array coordinate system when provided the corresponding y value in the screen coordinate system.
| D_row | y |
Definition at line 386 of file cnversions.c.
References D.
screen to earth (x)
Returns an east value in the earth coordinate system when provided the corresponding x value in the screen coordinate system.
| D_col | x |
Definition at line 428 of file cnversions.c.
References D.
Referenced by D_get_text_box().
screen to earth (y)
Returns a north value in the earth coordinate system when provided the corresponding y value in the screen coordinate system.
| D_row | y |
Definition at line 414 of file cnversions.c.
References D.
Referenced by D_get_text_box().
initialize conversions
The relationship between the earth region and the top, bottom, left, and right screen coordinates is established, which then allows conversions between all three coordinate systems to be performed. Note this routine is called by D_setup.
| window | region |
| t | top |
| b | bottom |
| l | left |
| r | right |
Definition at line 143 of file cnversions.c.
References b, D_fit_d_to_u(), D_set_dst(), D_set_region(), D_show_conversions(), D_update_conversions(), l, r, and t.
Referenced by D_setup().
Definition at line 336 of file draw2.c.
References COM_Point(), path::count, D_clip_to_map(), D_is_lat_lon(), D_u_to_d_col(), D_u_to_d_row(), M_NONE, clip::top, path::vertices, vertex::x, and vertex::y.
Referenced by D_polydots_abs(), and D_polydots_rel().
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.
| A_row | row number (starts at 0) |
| carray | data buffer |
| colors | pointer to Colors structure |
Definition at line 104 of file display/raster.c.
References CELL_TYPE.
Draw raster row (DCELL)
| A_row | row number (starts at 0) |
| darray | data buffer |
| colors | pointer to Colors structure |
Definition at line 66 of file display/raster.c.
References DCELL_TYPE.
Draw raster row (FCELL)
| A_row | row number (starts at 0) |
| farray | data buffer |
| colors | pointer to Colors structure |
Definition at line 81 of file display/raster.c.
References FCELL_TYPE.
| int D_draw_raster | ( | int | A_row, |
| const void * | array, | ||
| struct Colors * | colors, | ||
| RASTER_MAP_TYPE | data_type | ||
| ) |
Draw raster row.
Presumes the map is drawn from north to south.
If overlay mode is desired, then call D_set_overlay_mode() first.
| A_row | row number (starts at 0) |
| array | data buffer |
| colors | pointer to Colors structure |
| data_type | raster type (CELL, FCELL, DCELL) |
Definition at line 51 of file display/raster.c.
| 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.
| A_row | row number (starts at 0) |
| r_raster | red data buffer |
| g_raster | green data buffer |
| b_raster | blue data buffer |
| r_colors | colors used for red channel |
| g_colors | colors used for green channel |
| b_colors | colors used for blue channel |
| r_type | raster type used for red channel |
| g_type | raster type used for red channel |
| b_type | raster type used for red channel |
Definition at line 173 of file display/raster.c.
References COM_raster(), D__overlay_mode, G_incr_void_ptr, G_realloc, NULL, Rast_cell_size(), Rast_is_null_value(), and Rast_lookup_colors().
Set encoding.
| name | encoding name |
Definition at line 242 of file r_raster.c.
References COM_Set_encoding(), and name.
Definition at line 297 of file draw2.c.
Referenced by D_box_abs(), and D_line_abs().
Definition at line 12 of file display/window.c.
References b, COM_Begin(), COM_Close(), COM_Cont(), COM_Fill(), COM_Move(), D_get_dst(), D_parse_color(), D_use_color(), l, r, and t.
Referenced by D_setup(), D_setup2(), and D_setup_unity().
select color for line drawing
Same functionality as D_color() except that the value is type FCELL. This implies that the floating-point interfaces to the colors are used by this routine.
| val | |
| colors |
Definition at line 104 of file raster2.c.
References D_color_of_type(), and FCELL_TYPE.
Definition at line 330 of file draw2.c.
References COM_Fill().
Referenced by D_box_abs(), D_polygon_abs(), and D_polygon_rel().
Definition at line 97 of file cnversions.c.
References D.
Referenced by D_do_conversions(), and D_setup2().
Definition at line 102 of file cnversions.c.
References D.
Choose font.
Set current font to font name.
| name | font name |
Definition at line 232 of file r_raster.c.
References COM_Set_font(), and name.
Get font info.
| [out] | list | list of font info |
| [out] | count | of items in the list |
Definition at line 264 of file r_raster.c.
References COM_Font_info(), and count.
Get font list.
| [out] | list | list of font names |
| [out] | count | of items in the list |
Definition at line 253 of file r_raster.c.
References COM_Font_list(), and count.
Definition at line 239 of file cnversions.c.
Definition at line 243 of file cnversions.c.
Definition at line 247 of file cnversions.c.
Definition at line 184 of file cnversions.c.
Definition at line 188 of file cnversions.c.
Definition at line 176 of file cnversions.c.
Referenced by D_get_ew_resolution().
Definition at line 180 of file cnversions.c.
Referenced by D_get_ns_resolution().
Definition at line 235 of file cnversions.c.
get graphical clipping window
Queries the graphical clipping window (origin is top right)
| [out] | t | top edge of clip window |
| [out] | b | bottom edge of clip window |
| [out] | l | left edge of clip window |
| [out] | r | right edge of clip window |
Definition at line 280 of file r_raster.c.
References b, COM_Get_window(), l, r, and t.
Definition at line 369 of file cnversions.c.
Referenced by D_raster_draw_begin().
Definition at line 256 of file cnversions.c.
References D.
Referenced by D_set_clip_window_to_map_window().
Definition at line 260 of file cnversions.c.
References D.
Referenced by D_set_clip_window_to_map_window().
Definition at line 264 of file cnversions.c.
References D.
Referenced by D_set_clip_window_to_map_window().
Definition at line 160 of file cnversions.c.
Definition at line 164 of file cnversions.c.
Definition at line 168 of file cnversions.c.
Definition at line 172 of file cnversions.c.
Definition at line 252 of file cnversions.c.
References D.
Referenced by D_set_clip_window_to_map_window().
returns frame bounds in destination coordinate system
D_get_dst() returns the frame bounds in the destination coordinate system (used by R_* commands). The various D_setup() commands all set the destination coordinate system to the current frame reported by R_get_window().
| t | top |
| b | bottom |
| l | left |
| r | right |
Definition at line 345 of file cnversions.c.
Referenced by D_erase().
Definition at line 213 of file cnversions.c.
References D_get_a_to_u_xconv().
Get driver output file.
Definition at line 141 of file display/setup.c.
References COM_Graph_get_file().
get graphical window (frame)
Queries the graphical frame (origin is top right)
| [out] | t | top edge of frame |
| [out] | b | bottom edge of frame |
| [out] | l | left edge of frame |
| [out] | r | right edge of frame |
Definition at line 322 of file r_raster.c.
Referenced by D_setup(), D_setup2(), and D_setup_unity().
Definition at line 209 of file cnversions.c.
References D_get_a_to_u_yconv().
returns frame bounds in source coordinate system
D_get_src() returns the frame bounds in the source coordinate system (used by D_* functions)
| t | top |
| b | bottom |
| l | left |
| r | right |
Definition at line 297 of file cnversions.c.
Referenced by D_clip_to_map().
Definition at line 191 of file draw2.c.
References b, COM_Get_text_box(), D_d_to_u_col(), D_d_to_u_row(), l, r, and t.
Definition at line 353 of file cnversions.c.
References x.
Definition at line 222 of file cnversions.c.
Definition at line 226 of file cnversions.c.
Definition at line 230 of file cnversions.c.
Definition at line 200 of file cnversions.c.
Definition at line 204 of file cnversions.c.
Definition at line 192 of file cnversions.c.
Definition at line 196 of file cnversions.c.
Definition at line 218 of file cnversions.c.
Definition at line 155 of file cnversions.c.
Referenced by D_dots().
Definition at line 400 of file draw2.c.
References D_begin(), D_cont_abs(), D_end(), D_move_abs(), and D_stroke().
Referenced by D_line_rel().
Definition at line 469 of file draw2.c.
References D_line_abs().
Definition at line 186 of file draw2.c.
References COM_Line_width().
Definition at line 303 of file draw2.c.
References path_move(), vertex::x, and vertex::y.
Referenced by D_box_abs(), D_line_abs(), and D_move_rel().
Definition at line 440 of file draw2.c.
References D_move_abs(), and x.
Open display driver.
Default display driver is Cairo, if not available PNG is used.
Definition at line 82 of file r_raster.c.
References _, Cairo_Driver(), G_debug(), G_fatal_error(), G_file_name(), G_free(), G_getenv_nofatal(), G_mapset(), G_recreate_command(), G_spawn_ex(), G_strcasecmp(), G_temp_element(), G_verbose_message(), G_warning(), GPATH_MAX, HTML_Driver(), init(), LIB_init(), AMI_STREAM< T >::name(), NULL, PNG_Driver(), and PS_Driver().
color option text to usable color number
Converts or looks up the color provided in the string. Returns a color number usable by D_use_color. If the color does not exist exits with a fatal error and message. If the color is none and none_acceptable is not true exits with a fatal error and message.
| str | Color name or color code, as a string |
| none_acceptable |
Definition at line 103 of file tran_colr.c.
References _, and G_fatal_error().
Referenced by D_erase(), and D_translate_color().
Plot icon.
Supported types:
| xc,yc | icon coordinates |
| type | icon type |
| angle | rotation angle [rad] |
| scale | scale factor |
Definition at line 43 of file icon.c.
References _, G_debug(), G_ICON_ARROW, G_ICON_BOX, G_ICON_CROSS, and G_warning().
Definition at line 381 of file draw2.c.
References D_stroke(), vertex::x, and vertex::y.
Definition at line 456 of file draw2.c.
References D_stroke(), and x.
Definition at line 220 of file draw2.c.
References COM_Pos_abs(), D_u_to_d_col(), D_u_to_d_row(), vertex::x, and vertex::y.
Referenced by D_pos_rel().
Definition at line 231 of file draw2.c.
References D_pos_abs(), vertex::x, and vertex::y.
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 148 of file display/raster.c.
References COM_begin_raster(), D__overlay_mode, D_get_a(), and D_get_d().
Finish raster rendering.
Definition at line 225 of file display/raster.c.
References COM_end_raster().
Definition at line 213 of file tran_colr.c.
References COM_Color_RGB().
Referenced by D_color_of_type(), and D_use_color().
Append command to the cmd file (unused)
Definition at line 178 of file r_raster.c.
Definition at line 176 of file draw2.c.
References vertex::mode.
set graphical clipping window
Sets the graphical clipping window to the specified rectangle (origin is top right)
| t | top edge of clip window |
| b | bottom edge of clip window |
| l | left edge of clip window |
| r | right edge of clip window |
Definition at line 297 of file r_raster.c.
References b, COM_Set_window(), l, r, and t.
Referenced by D_set_clip_window_to_map_window().
set graphical clipping window to map window
Sets the graphical clipping window to the pixel window that corresponds to the current database region.
| ~ |
Definition at line 358 of file r_raster.c.
References D_get_d_east(), D_get_d_north(), D_get_d_south(), D_get_d_west(), and D_set_clip_window().
Referenced by D_setup(), D_setup2(), and D_setup_unity().
set clipping window to screen window
Sets the clipping window to the pixel window that corresponds to the full screen window. Off screen rendering is still clipped.
| ~ |
Definition at line 373 of file r_raster.c.
References COM_Set_window().
Referenced by D_setup(), D_setup2(), and D_setup_unity().
Definition at line 322 of file cnversions.c.
Referenced by D_do_conversions(), D_setup2(), and D_setup_unity().
Definition at line 305 of file cnversions.c.
Referenced by D_set_region().
Configure raster overlay mode.
This routine determines if D_draw_raster() draws in overlay mode (locations with category 0 are left untouched) or not (colored with the color for category 0).
| n | 1 (TRUE) for overlay mode; 0 (FALSE) otherwise |
Definition at line 48 of file raster2.c.
References D__overlay_mode.
Definition at line 269 of file cnversions.c.
References Cell_head::cols, D_set_grid(), D_set_src(), Cell_head::east, Cell_head::north, Cell_head::proj, PROJECTION_LL, Cell_head::rows, Cell_head::south, and Cell_head::west.
Referenced by D_do_conversions().
Definition at line 276 of file cnversions.c.
Referenced by D_set_region(), D_setup2(), and D_setup_unity().
Graphics frame setup.
This is a high level D call. It does a full setup for the current graphics frame.
Note: Connection to driver must already be made.
Sets the source coordinate system to the current region, and adjusts the destination coordinate system to preserve the aspect ratio.
Performs a full setup for the current graphics frame:
If clear is true, the frame is cleared (same as running d.erase.) Otherwise, it is not cleared.
| clear | 1 to clear frame (visually and coordinates) |
Definition at line 46 of file display/setup.c.
References D_do_conversions(), D_erase(), D_get_frame(), D_set_clip_window_to_map_window(), D_set_clip_window_to_screen_window(), DEFAULT_BG_COLOR, G_get_set_window(), and Rast_set_window().
Sets source coordinate system.
Sets the source coordinate system to its arguments, and if the fit argument is non-zero, adjusts the destination coordinate system to preserve the aspect ratio.
If clear is true, the frame is cleared (same as running d.erase). Otherwise, it is not cleared.
| clear | non-zero code to clear the frame |
| fit | non-zero code to adjust destination coordinate system |
| st | top |
| sb | bottom |
| sl | left |
| sr | right |
Definition at line 114 of file display/setup.c.
References D_erase(), D_fit_d_to_u(), D_get_frame(), D_set_clip_window_to_map_window(), D_set_clip_window_to_screen_window(), D_set_dst(), D_set_src(), D_update_conversions(), DEFAULT_BG_COLOR, and st.
Graphics frame setup.
Sets the source coordinate system to match the destination coordinate system, so that D_* functions use the same coordinate system as R_* functions.
If clear is true, the frame is cleared (same as running d.erase). Otherwise, it is not cleared.
| clear | non-zero code to clear the frame |
Definition at line 78 of file display/setup.c.
References D_erase(), D_get_frame(), D_set_clip_window_to_map_window(), D_set_clip_window_to_screen_window(), D_set_dst(), D_set_src(), D_update_conversions(), and DEFAULT_BG_COLOR.
Definition at line 324 of file draw2.c.
References COM_Stroke().
Referenced by D_line_abs(), D_polyline_abs(), and D_polyline_rel().
| void D_symbol | ( | const SYMBOL * | Symb, |
| double | x0, | ||
| double | y0, | ||
| const RGBA_Color * | line_color, | ||
| const RGBA_Color * | fill_color | ||
| ) |
draw a symbol at pixel coordinates
Draws a symbol (one of $GISBASE/etc/symbols/) to the active display. The starting x0,y0 coordinate corresponds to the center of the icon. The symbol must be pre-processed with S_stroke() before being sent to this function.
| Symb | The symbol name (e.g. basic/circle) |
| x0 | The starting x display coordinate (pixel) |
| y0 | The starting y display coordinate (pixel) |
| line_color | Outline color |
| fill_color | Fill color |
| void D_symbol2 | ( | const SYMBOL * | Symb, |
| double | x0, | ||
| double | y0, | ||
| const RGBA_Color * | primary_color, | ||
| const RGBA_Color * | secondary_color | ||
| ) |
draw a symbol at pixel coordinates (alternate)
Draws a symbol (one of $GISBASE/etc/symbols/) to the active display. The same as D_symbol(), but it uses a primary and secondary color instead of line and fill color. The primary color is used to draw stroke lines (STRINGs) and as the fill color for polygons. The secondary color is used for polygon outlines.
| Symb | The symbol name (e.g. basic/circle) |
| x0 | The starting x display coordinate (pixel) |
| y0 | The starting y display coordinate (pixel) |
| primary_color | Primary draw color |
| secondary_color | Secondary draw color |
Draw text.
Writes text in the current color and font, at the current text width and height, starting at the current screen location.
| text | text to be drawn |
Definition at line 220 of file r_raster.c.
References COM_Text().
Set text rotation.
| rotation | value |
Definition at line 207 of file r_raster.c.
References COM_Text_rotation().
Set text size (width and height)
| width | text pixel width |
| height | text pixel height |
Definition at line 197 of file r_raster.c.
References COM_Text_size().
color name to number
Takes a color name in ascii and returns the color number for that color. Returns 0 if color is not known. The color number returned is for lines and text, not raster graphics.
| str | Color name as an ASCII string |
Definition at line 126 of file tran_colr.c.
References D_parse_color().
earth to array (east
Returns a column value in the array coordinate system when provided the corresponding east value in the earth coordinate system.
| U_col | east |
Definition at line 542 of file cnversions.c.
earth to array (north)
Returns a row value in the array coordinate system when provided the corresponding north value in the earth coordinate system.
| U_row | north |
Definition at line 528 of file cnversions.c.
earth to screen (east)
Returns an x value in the screen coordinate system when provided the corresponding east value in the earth coordinate system.
| U_col | east |
Definition at line 514 of file cnversions.c.
References D.
Referenced by D_dots(), and D_pos_abs().
earth to screen (north)
Returns a y value in the screen coordinate system when provided the corresponding north value in the earth coordinate system.
| U_row | north |
Definition at line 500 of file cnversions.c.
References D.
Referenced by D_dots(), and D_pos_abs().
Definition at line 90 of file cnversions.c.
References D.
Referenced by D_do_conversions(), D_setup2(), and D_setup_unity().
draw with a color from D_parse_color
Calls R_color or R_standard_color to use the color provided by D_parse_color. Returns 1 if color can be used to draw (is good and isn't none), 0 otherwise.
| color |
Definition at line 141 of file tran_colr.c.
References color_rgb::b, COM_Standard_color(), D_RGB_color(), color_rgb::g, G_num_standard_colors(), and color_rgb::r.
Referenced by D_erase().