---
# System prepended metadata

title: graphic

---

# graphic
### _Name_ 
draw_rectangle - Game program call this function to draw rectangle on screen
### _Signature_
```C
int draw_rectangle(int pos_x, int pos_y, int width, int height) 
```

### _Parameters_
int pos_x - the x pixel value of upper left corner of the rectangle to be drawn on screen
int pos_y - the y pixel value of upper left corner of the rectangle to be drawn on screen
int width - the desired width of the rectangle in terms of pixels
int height - the desired height of the rectangle in terms of pixels

### _Return Value_
On success return 1, On failure return -1

### _Name_ 
draw_circle - Game program call this function to draw circle on screen
### _Signature_
```C
int draw_circle(int center_x, int center_y, int radius)
```

### _Parameters_
int center_x - the x pixel value of center of cicle
int center_y - the y pixel value of center of cicle
int radius - the desired radius of the cicle in terms of pixels

### _Return Value_
On success return 1, On failure return -1


### _Name_ 
draw_text - Game program call this function to draw text on screen
### _Signature_
```C
int draw_text(int pos_x, int pos_y, string text)
```

### _Parameters_
int pos_x - the x pixel value of starting point of text
int pos_y - the y pixel value of starting point of text
char* text - the desired text to be drawn on screen

### _Return Value_
On success return 1, On failure return -1

### _Name_ 
read_buffer - directly read RGB value from video buffer by id
### _Signature_
```C
void read_buffer(int vbuffer_id, int start_pos, int length)
```

### _Parameters_
int vbuffer_id - the abstract id for the buffer
int start_pos - the start position to read from
int length - the length to read
### _Return Value_
On success return 1, On failure return -1

### _Name_ 
write_buffer - directly write RGB value to video buffer by id
### _Signature_
```C
void write_buffer(int vbuffer_id, int index, int r, int g, int b)
```

### _Parameters_
int vbuffer_id - the abstract id for the buffer
int index - the position to write to
int r - the r value to write
int g - the g value to write
int b - the b value to write
### _Return Value_
On success return 1, On failure return -1

### _Name_ 
clear_buffer - clear video buffer by id
### _Signature_
```C
void clear_buffer(int vbuffer_id, int clear_value)
```

### _Parameters_
int vbuffer_id - the abstract id for the buffer
int clear_value - the value used to overwrite buffer
### _Return Value_
On success return 1, On failure return -1
