GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
com_proto.c File Reference
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <grass/gis.h>
#include <grass/raster.h>
#include <grass/graphics.h>
#include "transport.h"
Include dependency graph for com_proto.c:

Go to the source code of this file.

Functions

int R_screen_left (void)
 screen left edge More...
 
int R_screen_rite (void)
 screen right edge More...
 
int R_screen_bot (void)
 bottom of screen More...
 
int R_screen_top (void)
 top of screen More...
 
void R_get_num_colors (int *n)
 
void R_standard_color (int index)
 select standard color More...
 
void R_RGB_color (unsigned char red, unsigned char grn, unsigned char blu)
 select color More...
 
void R_line_width (int width)
 change the width of line More...
 
void R_erase (void)
 erase screen More...
 
void R_move_abs (int x, int y)
 move current location More...
 
void R_move_rel (int x, int y)
 move current location More...
 
void R_cont_abs (int x, int y)
 draw line More...
 
void R_cont_rel (int x, int y)
 draw line More...
 
void R_polydots_abs (const int *xarray, const int *yarray, int number)
 draw a series of dots More...
 
void R_polydots_rel (const int *xarray, const int *yarray, int number)
 draw a series of dots More...
 
void R_polyline_abs (const int *xarray, const int *yarray, int number)
 draw an open polygon More...
 
void R_polyline_rel (const int *xarray, const int *yarray, int number)
 draw an open polygon More...
 
void R_polygon_abs (const int *xarray, const int *yarray, int number)
 draw a closed polygon More...
 
void R_polygon_rel (const int *xarray, const int *yarray, int number)
 draw a closed polygon More...
 
void R_box_abs (int x1, int y1, int x2, int y2)
 fill a box More...
 
void R_box_rel (int x, int y)
 fill a box More...
 
void R_text_size (int width, int height)
 set text size More...
 
void R_text_rotation (float rotation)
 
void R_set_window (int t, int b, int l, int r)
 set text clipping frame More...
 
void R_text (const char *text)
 write text More...
 
void R_get_text_box (const char *text, int *t, int *b, int *l, int *r)
 get text extents More...
 
void R_font (const char *name)
 choose font More...
 
void R_charset (const char *name)
 
void R_font_list (char ***list, int *count)
 
void R_font_info (char ***list, int *count)
 
void R_panel_save (const char *name, int t, int b, int l, int r)
 
void R_panel_restore (const char *name)
 
void R_panel_delete (const char *name)
 
void R_begin_scaled_raster (int mask, int src[2][2], int dst[2][2])
 
int R_scaled_raster (int n, int row, const unsigned char *red, const unsigned char *grn, const unsigned char *blu, const unsigned char *nul)
 
void R_end_scaled_raster (void)
 
void R_bitmap (int ncols, int nrows, int threshold, const unsigned char *buf)
 

Function Documentation

void R_begin_scaled_raster ( int  mask,
int  src[2][2],
int  dst[2][2] 
)

Definition at line 515 of file com_proto.c.

References transport::begin_scaled_raster, and trans.

Referenced by D_cell_draw_setup().

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

Definition at line 532 of file com_proto.c.

References transport::bitmap, and trans.

void R_box_abs ( int  x1,
int  y1,
int  x2,
int  y2 
)

fill a box

A box is drawn in the current color using the coordinates x1,y1 and x2,y2 as opposite corners of the box. The current location is undefined afterwards

Parameters
x1
y1
x2
y2
Returns
int

Definition at line 350 of file com_proto.c.

References transport::box_abs, and trans.

Referenced by D_box(), D_erase(), D_erase_window(), D_popup(), and D_setup().

void R_box_rel ( int  x,
int  y 
)

fill a box

A box is drawn in the current color using the current location as one corner and the current location plus x and y as the opposite corner of the box. The current location is undefined afterwards.

Parameters
x
y
Returns
int

Definition at line 368 of file com_proto.c.

References transport::box_rel, and trans.

void R_charset ( const char *  name)

Definition at line 485 of file com_proto.c.

References transport::charset, and trans.

void R_cont_abs ( int  x,
int  y 
)

draw line

Draw a line using the current color, selected via R_color, from the current location to the location specified by x,y. The current location is updated to x,y.

Parameters
x
y
Returns
int

Definition at line 190 of file com_proto.c.

References transport::cont_abs, and trans.

Referenced by D_cont(), D_cont_abs(), D_popup(), D_show_window(), D_symbol(), and D_symbol2().

void R_cont_rel ( int  x,
int  y 
)

draw line

Draw a line using the current color, selected via R_color, from the current location to the relative location specified by x and y. The current location is updated:

Newx = Oldx + x;
Newy = Oldy + y;
Parameters
x
y
Returns
int

Definition at line 212 of file com_proto.c.

References transport::cont_rel, and trans.

Referenced by D_popup().

void R_end_scaled_raster ( void  )

Definition at line 527 of file com_proto.c.

References transport::end_scaled_raster, and trans.

Referenced by D_cell_draw_end().

void R_erase ( void  )

erase screen

Erases the entire screen to black.

Parameters
void
Returns
int

Definition at line 137 of file com_proto.c.

References transport::erase, and trans.

Referenced by D_full_screen().

void R_font ( const char *  name)

choose font

Set current font to font name. Available fonts are:

Font NameDescription
cyrilc cyrillic
gothgbt Gothic Great Britain triplex
gothgrt Gothic German triplex
gothitt Gothic Italian triplex
greekc Greek complex
greekcs Greek complex script
greekp Greek plain
greeks Greek simplex
italicc Italian complex
italiccs Italian complex small
italict Italian triplex
romanc Roman complex
romancs Roman complex small
romand Roman duplex
romanp Roman plain
romans Roman simplex
romant Roman triplex
scriptc Script complex
scripts Script simplex
Parameters
name
Returns
int

Definition at line 480 of file com_proto.c.

References transport::font, and trans.

void R_font_info ( char ***  list,
int count 
)

Definition at line 495 of file com_proto.c.

References transport::font_info, and trans.

void R_font_list ( char ***  list,
int count 
)

Definition at line 490 of file com_proto.c.

References transport::font_list, and trans.

void R_get_num_colors ( int n)

Definition at line 72 of file com_proto.c.

References transport::get_num_colors, and trans.

void R_get_text_box ( const char *  text,
int t,
int b,
int l,
int r 
)

get text extents

The extent of the area enclosing the text is returned in the integer pointers top, bottom, left, and right. No text is actually drawn. This is useful for capturing the text extent so that the text location can be prepared with proper background or border.

Parameters
sometext
ttop
bbottom
lleft
rright
Returns
int

Definition at line 443 of file com_proto.c.

References transport::get_text_box, and trans.

void R_line_width ( int  width)

change the width of line

Changes the width of line to be used in subsequent draw commands.

Parameters
width
Returns
int

Definition at line 123 of file com_proto.c.

References transport::line_width, and trans.

Referenced by D_line_width().

void R_move_abs ( int  x,
int  y 
)

move current location

Move the current location to the absolute screen coordinate x,y. Nothing is drawn on the screen.

Parameters
x
y
Returns
int

Definition at line 153 of file com_proto.c.

References transport::move_abs, and trans.

Referenced by D_cont_abs(), D_move(), D_popup(), D_set_clip_window(), D_setup(), D_show_window(), D_symbol(), and D_symbol2().

void R_move_rel ( int  x,
int  y 
)

move current location

Shift the current screen location by the values in dx and dy:

Newx = Oldx + dx;
Newy = Oldy + dy;

Nothing is drawn on the screen.

Parameters
xdx
ydy
Returns
int

Definition at line 173 of file com_proto.c.

References transport::move_rel, and trans.

void R_panel_delete ( const char *  name)

Definition at line 510 of file com_proto.c.

References transport::panel_delete, and trans.

Referenced by D_popup().

void R_panel_restore ( const char *  name)

Definition at line 505 of file com_proto.c.

References transport::panel_restore, and trans.

Referenced by D_popup().

void R_panel_save ( const char *  name,
int  t,
int  b,
int  l,
int  r 
)

Definition at line 500 of file com_proto.c.

References transport::panel_save, and trans.

Referenced by D_popup().

void R_polydots_abs ( const int xarray,
const int yarray,
int  number 
)

draw a series of dots

Pixels at the num absolute positions in the x and y arrays are turned to the current color. The current location is left updated to the position of the last dot.

Parameters
xarrayx
yarrayy
number
Returns
int

Definition at line 230 of file com_proto.c.

References transport::polydots_abs, and trans.

Referenced by D_polydots(), and D_polydots_clip().

void R_polydots_rel ( const int xarray,
const int yarray,
int  number 
)

draw a series of dots

Pixels at the number relative positions in the x and y arrays are turned to the current color. The first position is relative to the starting current location; the succeeding positions are then relative to the previous position. The current location is updated to the position of the last dot.

Parameters
xarrayx
yarrayy
number
Returns
int

Definition at line 250 of file com_proto.c.

References transport::polydots_rel, and trans.

void R_polygon_abs ( const int xarray,
const int yarray,
int  number 
)

draw a closed polygon

The number absolute positions in the x and y arrays outline a closed polygon which is filled with the current color. The current location is undefined afterwards.

Parameters
xarrayx
yarrayy
number
Returns
int

Definition at line 311 of file com_proto.c.

References transport::polygon_abs, and trans.

Referenced by D_polygon(), D_symbol(), and D_symbol2().

void R_polygon_rel ( const int xarray,
const int yarray,
int  number 
)

draw a closed polygon

The number relative positions in the x and y arrays outline a closed polygon which is filled with the current color. The first position is relative to the starting current location; the succeeding positions are then relative to the previous position. The current location is undefined afterwards.

Parameters
xarrayx
yarrayy
number
Returns
int

Definition at line 331 of file com_proto.c.

References transport::polygon_rel, and trans.

void R_polyline_abs ( const int xarray,
const int yarray,
int  number 
)

draw an open polygon

The number absolute positions in the x and y arrays are used to generate a multisegment line (often curved). This line is drawn with the current color. The current location is left updated to the position of the last point. Note. It is not assumed that the line is closed, i.e., no line is drawn from the last point to the first point.

Parameters
xarrayx
yarrayy
number
Returns
int

Definition at line 271 of file com_proto.c.

References transport::polyline_abs, and trans.

Referenced by D_polyline().

void R_polyline_rel ( const int xarray,
const int yarray,
int  number 
)

draw an open polygon

The number relative positions in the x and y arrays are used to generate a multisegment line (often curved). The first position is relative to the starting current location; the succeeding positions are then relative to the previous position. The current location is updated to the position of the last point. This line is drawn with the current color. Note. No line is drawn between the last point and the first point.

Parameters
xarrayx
yarrayy
number
Returns
int

Definition at line 293 of file com_proto.c.

References transport::polyline_rel, and trans.

void R_RGB_color ( unsigned char  red,
unsigned char  grn,
unsigned char  blu 
)

select color

When in float mode (see R_color_table_float), this call selects the color most closely matched to the red, grn, and blue intensities requested. These values must be in the range of 0-255.

Parameters
red
grn
blue
Returns
int

Definition at line 109 of file com_proto.c.

References transport::RGB_color, and trans.

Referenced by D_color_of_type(), D_raster_use_color(), D_symbol(), and D_symbol2().

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

Definition at line 520 of file com_proto.c.

References transport::scaled_raster, and trans.

Referenced by D_draw_raster_RGB().

int R_screen_bot ( void  )

bottom of screen

Returns the coordinate of the bottom of the screen.

Parameters
void
Returns
int

Definition at line 52 of file com_proto.c.

References transport::screen_bot, and trans.

Referenced by D_new_window_percent(), D_popup(), D_setup(), get_win_w_mouse(), and ident_win().

int R_screen_left ( void  )

screen left edge

Returns the coordinate of the left edge of the screen.

Parameters
void
Returns
int

Definition at line 24 of file com_proto.c.

References transport::screen_left, and trans.

Referenced by D_new_window_percent(), D_popup(), D_setup(), get_win_w_mouse(), and ident_win().

int R_screen_rite ( void  )

screen right edge

Returns the coordinate of the right edge of the screen.

Parameters
void
Returns
int

Definition at line 38 of file com_proto.c.

References transport::screen_rite, and trans.

Referenced by D_new_window_percent(), D_popup(), D_setup(), get_win_w_mouse(), and ident_win().

int R_screen_top ( void  )

top of screen

Returns the coordinate of the top of the screen.

Parameters
void
Returns
int

Definition at line 67 of file com_proto.c.

References transport::screen_top, and trans.

Referenced by D_new_window_percent(), D_popup(), D_setup(), get_win_w_mouse(), and ident_win().

void R_set_window ( int  t,
int  b,
int  l,
int  r 
)

set text clipping frame

Subsequent calls to R_text will have text strings clipped to the screen frame defined by top, bottom, left, right.

Parameters
ttop
bbottom
lleft
rright
Returns
int

Definition at line 406 of file com_proto.c.

References transport::set_window, and trans.

Referenced by D_new_window(), D_popup(), D_set_cur_wind(), D_setup(), and D_show_window().

void R_standard_color ( int  index)

select standard color

Selects the standard color to be used in subsequent draw commands. The color value is best retrieved using D_translate_color. See Display_Graphics_Library.

Parameters
index
Returns
int

Definition at line 90 of file com_proto.c.

References transport::standard_color, and trans.

Referenced by D_full_screen(), D_popup(), D_raster_use_color(), D_setup(), and D_show_window().

void R_text ( const char *  text)

write text

Writes text in the current color and font, at the current text width and height, starting at the current screen location.

Parameters
sometext
Returns
int

Definition at line 421 of file com_proto.c.

References transport::text, and trans.

Referenced by D_popup().

void R_text_rotation ( float  rotation)

Definition at line 388 of file com_proto.c.

References transport::text_rotation, and trans.

void R_text_size ( int  width,
int  height 
)

set text size

Sets text pixel width and height to width and height.

Parameters
width
height
Returns
int

Definition at line 383 of file com_proto.c.

References transport::text_size, and trans.

Referenced by D_popup().