DisplayGraphics Struct Reference

Inheritance diagram for DisplayGraphics

Inheritance graph

Collaboration diagram for DisplayGraphics:

Collaboration graph


Public Methods

void DisplayGraphics_draw_bitmap (struct DisplayGraphics *ptr_gfx, struct Bitmap *bmp, int left, int top, int fm)
int DisplayGraphics_draw_char (struct DisplayGraphics *ptr_gfx, int fx, int fy, char_t fc)
void DisplayGraphics_draw_hline (struct DisplayGraphics *ptr_gfx, int x, int y, int xx)
void DisplayGraphics_draw_vline (struct DisplayGraphics *ptr_gfx, int x, int y, int yy)
void DisplayGraphics_draw_line (struct DisplayGraphics *ptr_gfx, int x, int y, int xx, int yy)
void DisplayGraphics_draw_rect (struct DisplayGraphics *ptr_gfx, int fx, int fy, int fw, int fh)
void DisplayGraphics_draw_rect_Ex (struct DisplayGraphics *ptr_gfx, struct rect_t *ptr_rectangle)
void DisplayGraphics_draw_text (struct DisplayGraphics *ptr_gfx, char *text, int left, int top)
void DisplayGraphics_draw_text_Ex (struct DisplayGraphics *ptr_gfx, char *text, int left, int top, int flen)
void DisplayGraphics_fill_rect (struct DisplayGraphics *ptr_gfx, int fx,int fy, int fw, int fh)
void DisplayGraphics_fill_rect_Ex (struct DisplayGraphics *ptr_gfx, struct rect_t *ptr_rectangle)
void DisplayGraphics_fill_screen (struct DisplayGraphics *ptr_gfx, color_t fc)
void DisplayGraphics_flip (struct DisplayGraphics *ptr_gfx)
int DisplayGraphics_get_char_height (struct DisplayGraphics *ptr_gfx)
int DisplayGraphics_get_char_width (struct DisplayGraphics *ptr_gfx, char chr)
void DisplayGraphics_get_clip (struct DisplayGraphics *ptr_gfx, struct rect_t *ptr_rectangle)
color_t DisplayGraphics_get_color (struct DisplayGraphics *ptr_gfx)
drawmode_t DisplayGraphics_get_draw_mode (struct DisplayGraphics *ptr_gfx)
struct FontDisplayGraphics_get_font (struct DisplayGraphics *ptr_gfx)
int DisplayGraphics_get_page (struct DisplayGraphics *ptr_gfx)
int DisplayGraphics_get_bytes_total (struct DisplayGraphics *ptr_gfx)
char* DisplayGraphics_get_page_ptr (struct DisplayGraphics *ptr_gfx, int page)
color_t DisplayGraphics_get_pixel (struct DisplayGraphics *ptr_gfx, int fx, int fy)
int DisplayGraphics_string_width (struct DisplayGraphics *ptr_gfx, char *string)
int DisplayGraphics_string_width_Ex (struct DisplayGraphics *ptr_gfx, char *string, int flen)
void DisplayGraphics_page_copy (struct DisplayGraphics *ptr_gfx, int from_page, int to_page, int x, int y, int w, int h)
void DisplayGraphics_page_copy_Ex (struct DisplayGraphics *ptr_gfx, int from_page, int to_page, struct rect_t *rc)
void DisplayGraphics_scroll (struct DisplayGraphics *ptr_gfx, struct rect_t *ptr_rectangle, int dx, int dy)
void DisplayGraphics_set_bitmap (struct DisplayGraphics *ptr_gfx, struct Bitmap *bmp)
void DisplayGraphics_put_background (struct DisplayGraphics *ptr_gfx, char *ptr_background)
char* DisplayGraphics_get_buf_addr (struct DisplayGraphics *ptr_gfx)
void DisplayGraphics_set_bkcolor (struct DisplayGraphics *ptr_gfx, color_t fc)
void DisplayGraphics_set_clip (struct DisplayGraphics *ptr_gfx, int fx, int fy, int fw, int fh)
void DisplayGraphics_set_clip_Ex (struct DisplayGraphics *ptr_gfx, struct rect_t *ptr_rectangle)
void DisplayGraphics_set_color (struct DisplayGraphics *ptr_gfx, color_t fc)
void DisplayGraphics_set_draw_mode (struct DisplayGraphics *ptr_gfx, drawmode_t dm)
void DisplayGraphics_set_font (struct DisplayGraphics *ptr_gfx, struct Font *font)
void DisplayGraphics_set_pixel (struct DisplayGraphics *ptr_gfx, int fx, int fy, color_t fc)
void DisplayGraphics_set_page (struct DisplayGraphics *ptr_gfx, int page)
void DisplayGraphics_show (struct DisplayGraphics *ptr_gfx)
void DisplayGraphics_show_Ex (struct DisplayGraphics *ptr_gfx, int page)


Detailed Description

See also:
Drawing Primitives and Screen Manipulation


Member Function Documentation

void DisplayGraphics_draw_bitmap ( struct DisplayGraphics * ptr_gfx,
struct Bitmap * bmp,
int left,
int top,
int fm )
 

Draws a bitmap 'bmp' in a specified position (left, top) in 'fm' mode.

Parameters:
ptr_gfx   A pointer to the initialized DisplayGraphics object
bmp   A pointer to the initialized Bitmap object
left   x-coordinate of the left side of the bitmap to be drawn
top   y-coordinate of the top side of the bitmap to be drawn
fm   A drawing mode
Returns:
None
   #include <cybiko.h>
     ...
     struct module_t main_module;
     struct Bitmap bitmap;
     ...
     init_module( &main_module );
     Bitmap_ctor_Ex1( &bitmap, "screen.pic" );
     ...
     // main_module.m_gfx is a pointer to the Cybiko graphics context.
     DisplayGraphics_draw_bitmap( main_module.m_gfx, &bitmap, 30, 40, BM_NORMAL );
     ...

int DisplayGraphics_draw_char ( struct DisplayGraphics * ptr_gfx,
int fx,
int fy,
char_t fc )
 

Draws a character 'fc' with the current font in a specified position (fx, fy).

Parameters:
ptr_gfx   A pointer to the initialized DisplayGraphics object
fx   x-coordinate of the character to be drawn
fy   y-coordinate of the character to be drawn
fc   A character to be drawn
Returns:
The position of the next pixel after the 'fc' character
   #include <cybiko.h>
     ...
     struct module_t main_module;
     int pos;
     ...
     init_module( &main_module );
     Graphics_set_font( main_module.m_gfx, cool_normal_font);
     pos = Graphics_draw_char( main_module.m_gfx, 10, 10, 'c' );
     ...

void DisplayGraphics_draw_hline ( struct DisplayGraphics * ptr_gfx,
int x,
int y,
int xx )
 

Draws a horizontal line from point (x , y) to point (xx , y).

Parameters:
ptr_gfx   A pointer to the initialized DisplayGraphics object
x   x-coordinate horizontal line's starting point
y   y-coordinate horizontal line's starting point
xx   x-coordinate horizontal line's finishing point
Returns:
None
   #include <cybiko.h>
     ...
     struct module_t main_module;
     int pos;
     ...
     init_module( &main_module );
     TGraph_set_color( main_module.m_gfx, CLR_LTGRAY );
     DisplayGraphics_draw_hline( main_module.m_gfx, 10, 10, 20);
     ...
See also:
DisplayGraphics_draw_line, DisplayGraphics_draw_vline.

void DisplayGraphics_draw_line ( struct DisplayGraphics * ptr_gfx,
int x,
int y,
int xx,
int yy )
 

Draws a solid line from point (x,y) to point (xx,yy).

Parameters:
ptr_gfx   A pointer to the initialized DisplayGraphics object
x   x-coordinate of the line's starting point
y   y-coordinate of the line's starting point
xx   x-coordinate of the line's finishing point
yy   y-coordinate of the line's finishing point
Returns:
None
   #include <cybiko.h>
     ...
     struct module_t main_module;
     int pos;
     ...
     init_module( &main_module );
     TGraph_set_color( main_module.m_gfx, CLR_LTGRAY );
     DisplayGraphics_draw_line( main_module.m_gfx, 10, 10, 20, 20);
     ...
See also:
DisplayGraphics_draw_vline, DisplayGraphics_draw_hline.

void DisplayGraphics_draw_rect ( struct DisplayGraphics * ptr_gfx,
int fx,
int fy,
int fw,
int fh )
 

Draws a rectangular frame in the current color.
It is defined by the coordinates stored in the fx, fy, fw and fh parameters.

Parameters:
ptr_gfx   A pointer to the initialized DisplayGraphics object
fx   The rectangle's left coordinate
fy   The rectangle's top coordinate
fw   The rectangle's width
fh   The rectangle's height
Returns:
None
   #include <cybiko.h>
     ...
     struct module_t main_module;
     int pos;
     ...
     init_module( &main_module );
     TGraph_set_color( main_module.m_gfx, CLR_LTGRAY );
     DisplayGraphics_draw_rect( main_module.m_gfx, 10, 10, 20, 20);
     ...
See also:
DisplayGraphics_draw_rect_Ex.

void DisplayGraphics_draw_rect_Ex ( struct DisplayGraphics * ptr_gfx,
struct rect_t * ptr_rectangle )
 

Duplicates the DisplayGraphics_draw_rect function.

Parameters:
ptr_gfx   A pointer to the initialized DisplayGraphics object
ptr_rectangle   A pointer to a rect_t object
Returns:
None
   #include <cybiko.h>
     ...
     struct module_t main_module;
     struct rect_t rectangle={0,0,100,100};
     ...
     init_module( &main_module );
     TGraph_set_color( main_module.m_gfx, CLR_LTGRAY );
     DisplayGraphics_draw_rect_Ex( main_module.m_gfx, &rectangle );
     ...
See also:
DisplayGraphics_draw_rect.

void DisplayGraphics_draw_text ( struct DisplayGraphics * ptr_gfx,
char * text,
int left,
int top )
 

Draws text in a specified position (left, top) with the current font.

Parameters:
ptr_gfx   A pointer to the initialized DisplayGraphics object
text   A pointer to the string to be drawn
left   x-coordinate of the text to be drawn
top   y-coordinate of the text to be drawn
Returns:
None
   #include <cybiko.h>
     ...
     struct module_t main_module;
     ...
     init_module( &main_module );
     TGraph_set_color( main_module.m_gfx, CLR_LTGRAY );
     DisplayGraphics_draw_text( main_module.m_gfx, "Any text", 10, 10 );
     ...
See also:
DisplayGraphics_draw_text_Ex.

void DisplayGraphics_draw_text_Ex ( struct DisplayGraphics * ptr_gfx,
char * text,
int left,
int top,
int flen )
 

Duplicates the DisplayGraphics_draw_text function.
If the length of the string exceeds the number of 'flen' pixels, the string will be truncated.

Parameters:
ptr_gfx   A pointer to the initialized DisplayGraphics object
text   A pointer to the string to be drawn
left   x-coordinate of the text to be drawn
top   y-coordinate of the text to be drawn
flen   Maximum length (in pixels) of the string to be drawn
Returns:
None
   #include <cybiko.h>
     ...
     struct module_t main_module;
     ...
     init_module( &main_module );
     TGraph_set_color( main_module.m_gfx, CLR_LTGRAY );
     DisplayGraphics_draw_text_Ex( main_module.m_gfx, "Any text", 10, 10, 20);
     ...
See also:
DisplayGraphics_draw_text.

void DisplayGraphics_draw_vline ( struct DisplayGraphics * ptr_gfx,
int x,
int y,
int yy )
 

Draws a vertical line from point (x, y) to point (x , yy).

Parameters:
ptr_gfx   A pointer to the initialized DisplayGraphics object
x   x-coordinate of the vertical line's starting point
y   y-coordinate of the vertical line's starting point
yy   y-coordinate of the vertical line's finishing point
Returns:
None
   #include <cybiko.h>
     ...
     struct module_t main_module;
     int pos;
     ...
     init_module( &main_module );
     TGraph_set_color( main_module.m_gfx, CLR_LTGRAY );
     DisplayGraphics_draw_vline( main_module.m_gfx, 10, 10, 20);
     ...
See also:
DisplayGraphics_draw_line, DisplayGraphics_draw_hline.

void DisplayGraphics_fill_rect ( struct DisplayGraphics * ptr_gfx,
int fx,
int fy,
int fw,
int fh )
 

Fills a rectangle with the current color.
The rectangle's area is defined by the fx, fy, fw and fh parameters.

Parameters:
ptr_gfx   A pointer to the initialized DisplayGraphics object
fx   The rectangle's left coordinate
fy   The rectangle's top coordinate
fw   The rectangle's width
fh   The rectangle's height
Returns:
None
   #include <cybiko.h>
     ...
     struct module_t main_module;
     int pos;
     ...
     init_module( &main_module );
     TGraph_set_color( main_module.m_gfx, CLR_LTGRAY );
     DisplayGraphics_fill_rect( main_module.m_gfx, 10, 10, 20, 20);
     ...
See also:
DisplayGraphics_fill_rect_Ex.

void DisplayGraphics_fill_rect_Ex ( struct DisplayGraphics * ptr_gfx,
struct rect_t * ptr_rectangle )
 

Duplicates the Graphics_fill_rect function.

Parameters:
ptr_gfx   A pointer to the initialized DisplayGraphics object
ptr_rectangle   A pointer to a tect_t object
Returns:
None
   #include <cybiko.h>
     ...
     struct module_t main_module;
     struct rect_t rectangle={0,0,100,100};
     ...
     init_module( &main_module );
     TGraph_set_color( main_module.m_gfx, CLR_LTGRAY );
     DisplayGraphics_fill_rect_Ex( main_module.m_gfx, &rectangle );
     ...
See also:
Graphics_fill_rect.

void DisplayGraphics_fill_screen ( struct DisplayGraphics * ptr_gfx,
color_t fc )
 

Fills the screen with the 'fc' color.

Parameters:
ptr_gfx   A pointer to the initialized DisplayGraphics object
fc   A color's value
Returns:
None
   #include <cybiko.h>
     ...
     struct module_t main_module;
     ...
     init_module( &main_module );
     DisplayGraphics_fill_screen( main_module.m_gfx, CLR_LTGRAY);
     ...
See also:
CLR_WHITE, CLR_LTGRAY, CLR_DKGRAY, CLR_BLACK.

void DisplayGraphics_flip ( struct DisplayGraphics * ptr_gfx )
 

Switches background and foreground pages and shows the background screen on the LCD.

Parameters:
ptr_gfx   A pointer to the initialized DisplayGraphics object
Returns:
None
   #include <cybiko.h>
     ...
     int i;
     struct module_t main_module;
     ...
     init_module( &main_module );
     ...
     // main_module.m_gfx is a pointer to the Cybiko graphics context.
     DisplayGraphics_set_page( main_module.m_gfx, 0 );
     // main_module.m_gfx is a pointer to the Cybiko graphics context.
     // The second parameter in the TGraph_set_color function is color value.
     // This value must be one of the following: CLR_WHITE, CLR_LTGRAY, CLR_DKGRAY, CLR_BLACK.
     TGraph_set_color( main_module.m_gfx, CLR_WHITE );
     TGraph_fill_rect( main_module.m_gfx, 5, 5, 30, 30 );
     // To send the current graphics page to the Cybiko display you should use this function
     DisplayGraphics_show( main_module.m_gfx );
     ...
     DisplayGraphics_set_page( main_module.m_gfx, 1 );
     TGraph_set_color( main_module.m_gfx, CLR_BLACK );
     TGraph_fill_rect( main_module.m_gfx, 5, 5, 30, 30 );
     DisplayGraphics_show( main_module.m_gfx );
     ...
     for(i = 0; i < 20 ; i++)
     {
       DisplayGraphics_flip( main_module.m_gfx );
       cWinApp_pause( main_module.m_gfx , 250 );   // 250 milliseconds delay.
     }
     //  Black and white rectangles will change places with each other.

char * DisplayGraphics_get_buf_addr ( struct DisplayGraphics * ptr_gfx )
 

Returns a pointer to an image of the DisplayGraphics object destination.

Parameters:
ptr_gfx   A pointer to a DisplayGraphics object
Returns:
A pointer to an image of the DisplayGraphics object destination
   #include <cywin.h>
     ...
     struct module_t main_module;
     struct Graphics gfx;
     ...
     init_module( &main_module );
     ...
     DisplayGraphics_put_background( main_module.m_gfx,
              DisplayGraphics_get_buf_addr( &gfx ));
     ...
See also:
DisplayGraphics_page_copy_Ex.

int DisplayGraphics_get_bytes_total ( struct DisplayGraphics * ptr_gfx )
 

Returns the number of bytes amount in the screen buffer.

Parameters:
ptr_gfx   A pointer to the initialized DisplayGraphics object
Returns:
The number of bytes in the screen buffer
   #include <cybiko.h>
     ...
     struct module_t main_module;
     char* ptr_display_buffer;
     ...
     init_module( &main_module );
     ptr_display_buffer = (char* ) malloc( DisplayGraphics_get_bytes_total( main_module.m_gfx ) );
     ...

int DisplayGraphics_get_char_height ( struct DisplayGraphics * ptr_gfx )
 

Returns the current font's character's height.

Parameters:
ptr_gfx   A pointer to the initialized DisplayGraphics object
Returns:
Current font's character height
   #include <cybiko.h>
     ...
     struct module_t main_module;
     int font_height;
     ...
     DisplayGraphics_set_font( main_module.m_gfx, cool_normal_font );
     font_height = DisplayGraphics_get_char_height( main_module.m_gfx );
     ...

int DisplayGraphics_get_char_width ( struct DisplayGraphics * ptr_gfx,
char chr )
 

Returns the current font's character width.

Parameters:
ptr_gfx   A pointer to the initialized DisplayGraphics object
Returns:
Current font's character width
   #include <cybiko.h>
     ...
     struct module_t main_module;
     int font_width;
     ...
     DisplayGraphics_set_font( main_module.m_gfx, cool_normal_font );
     font_width = DisplayGraphics_get_char_width( main_module.m_gfx, 'g' );
     ...

void DisplayGraphics_get_clip ( struct DisplayGraphics * ptr_gfx,
struct rect_t * ptr_rectangle )
 

Returns a clip region.

Parameters:
ptr_gfx   A pointer to the initialized DisplayGraphics object
ptr_rectangle   A pointer to a rect_t object
Returns:
None
   #include <cybiko.h>
     struct module_t main_module;
     ...
     struct rect_t clip_region;
     ...
     DisplayGraphics_get_clip( main_module.m_gfx, &clip_region);
     ...

color_t DisplayGraphics_get_color ( struct DisplayGraphics * ptr_gfx )
 

Returns the current foreground color.

Parameters:
ptr_gfx   A pointer to the initialized DisplayGraphics object
Returns:
Current foreground color
   #include <cybiko.h>
     ...
     struct module_t main_module;
     ...
     init_module( &main_module );
     if ( DisplayGraphics_get_color( main_module.m_gfx ) != CLR_LTGRAY )
       DisplayGraphics_set_color( main_module.m_gfx, CLR_LTGRAY);
     ...
See also:
DisplayGraphics_set_color, CLR_WHITE, CLR_LTGRAY, CLR_DKGRAY, CLR_BLACK.

drawmode_t DisplayGraphics_get_draw_mode ( struct DisplayGraphics * ptr_gfx )
 

Returns the current draw mode.

Parameters:
ptr_gfx   A pointer to the initialized DisplayGraphics object
Returns:
Current draw mode
   #include <cybiko.h>
     ...
     struct module_t main_module;
     ...
     init_module( &main_module );
     if ( DisplayGraphics_get_draw_mode( main_module.m_gfx ) != DM_PUT )
       DisplayGraphics_set_draw_mode( main_module.m_gfx, DM_PUT);
     ...
See also:
DisplayGraphics_set_draw_mode, DM_PUT, DM_OR, DM_XOR.

struct Font * DisplayGraphics_get_font ( struct DisplayGraphics * ptr_gfx )
 

Returns the current font.

Parameters:
ptr_gfx   A pointer to the initialized DisplayGraphics object
Returns:
A pointer to the current font
   #include <cybiko.h>
     ...
     struct module_t main_module;
     struct Font *curFont;
     ...
     init_module( &main_module );
     curFont=DisplayGraphics_get_font( main_module.m_gfx);
     ...

int DisplayGraphics_get_page ( struct DisplayGraphics * ptr_gfx )
 

Returns the current graphics page number (0 or 1).

Parameters:
ptr_gfx   A pointer to a Graphics object
Returns:
Current graphics page number (0 or 1)
   #include <cybiko.h>
     ...
     struct module_t main_module;
     ...
     init_module( &main_module );
     ...
     if ( !DisplayGraphics_get_page( main_module.m_gfx ) )
       DisplayGraphics_set_page( main_module.m_gfx, 1 );
     ...
See also:
DisplayGraphics_flip, DisplayGraphics_set_page.

char * DisplayGraphics_get_page_ptr ( struct DisplayGraphics * ptr_gfx,
int page )
 

Returns the pointer to the screen buffer for the 'fp' graphics page.
Use with caution!!!

Parameters:
ptr_gfx   A pointer to a DisplayGraphics object
page   A number of the graphics page
Returns:
A pointer to the graphics page's screen buffer
   #include <cybiko.h>
     ...
     struct module_t main_module;
     char*  ptr_display_buffer;
     init_module( &main_module );
     ...
     // Allocating memory for buffer
     ptr_display_buffer = (char* ) malloc( TGraph_get_bytes_total( main_module.m_gfx ) );
     ...
     // Make some graphics operations ( draw a picture, for instance)
     ...
     // Save the screen
     memcpy( ptr_display_buffer, DisplayGraphics_get_page_ptr(main_module.m_gfx, 0), TGraph_get_bytes_total(main_module.m_gfx));
     ...
     // Make another graphics operation
     ...
     // Restore the screen. Works very fast.
     TGraph_put_background( main_module.m_gfx, ptr_display_buffer );
     ...
     // Make another graphics operation
     ...
     // Restore the screen again.
     TGraph_put_background( main_module.m_gfx, ptr_display_buffer );
     ...
     free( ptr_display_buffer );

color_t DisplayGraphics_get_pixel ( struct DisplayGraphics * ptr_gfx,
int fx,
int fy )
 

Returns the color of the pixel with coordinate (fx , fy).

Parameters:
ptr_gfx   A pointer to the initialized DisplayGraphics object
fx   x-coordinate of the required pixel
fy   y-coordinate of the required pixel
Returns:
The color of the pixel with coordinate (fx , fy)
   #include <cybiko.h>
     ...
     struct module_t main_module;
     if ( DisplayGraphics_get_pixel( main_module.m_gfx, 10, 30 ) == CLR_BLACK )
          DisplayGraphics_set_pixel( main_module.m_gfx, 10, 30, CLR_WHITE );
       ...
See also:
DisplayGraphics_set_pixel.

void DisplayGraphics_page_copy ( struct DisplayGraphics * ptr_gfx,
int from_page,
int to_page,
int x,
int y,
int w,
int h )
 

Copies a rectangular area from one graphics page to another.
A rectangular area is defined by x,y,h and w parameters.

Parameters:
ptr_gfx   A pointer to a DisplayGraphics object
from_page   The source page to copy
to_page   The destination page for the copied image
x   x-coordinate of the rectangular area to be copied
y   y-coordinate of the rectangular area to be copied
w   A width of the page to be copied
h   A height of the page to be copied
Returns:
None
   #include <cybiko.h>
     ...
     struct module_t main_module;
     init_module( &main_module );
     ...
     // main_module.m_gfx A pointer to the Cybiko graphics context
     DisplayGraphics_set_page( main_module.m_gfx, 1 );
     // main_module.m_gfx is a pointer to the Cybiko graphics context.
     // The second parameter in the TGraph_set_color function is the color value.
     // This value must be one of the following: CLR_WHITE, CLR_LTGRAY, CLR_DKGRAY, CLR_BLACK.
     TGraph_set_color( main_module.m_gfx, CLR_WHITE );
     TGraph_fill_rect( main_module.m_gfx, 5, 5, 30, 30 );
     // To send the current graphics page to the Cybiko display you should use this function
     DisplayGraphics_show_Ex( main_module.m_gfx , 1 );
     ...
     DisplayGraphics_set_page( main_module.m_gfx, 0 );
     DisplayGraphics_page_copy( main_module.m_gfx, 1, 0, 5, 5, 30, 30 );
     // Now the white rectangle is on both Cybiko graphics pages.
     ...
See also:
DisplayGraphics_page_copy_Ex.

void DisplayGraphics_page_copy_Ex ( struct DisplayGraphics * ptr_gfx,
int from_page,
int to_page,
struct rect_t * rc )
 

Duplicates the DisplayGraphics_page_copy function.
The region coordinates are defined in the rect_t object.

Parameters:
ptr_gfx   A pointer to a DisplayGraphicsGraphics object
from_page   The source page to copy
to_page   The destination page for the copied image
rc   A pointer to the rectangle to be copied
Returns:
None
   #include <cybiko.h>
     ...
     struct module_t main_module;
     struct rect_t white_rect;
     init_module( &main_module );
     ...
     // main_module.m_gfx is a pointer to the Cybiko graphics context.
     DisplayGraphics_set_page( main_module.m_gfx, 1 );
     white_rect.x = 5;
     white_rect.y = 5;
     white_rect.w = 30;
     white_rect.h = 30;
     // main_module.m_gfx is a pointer to the Cybiko graphics context.
     // The second parameter in the TGraph_set_color function is color value.
     // This value must be one of the following: CLR_WHITE, CLR_LTGRAY, CLR_DKGRAY, CLR_BLACK.
     TGraph_set_color( main_module.m_gfx, CLR_WHITE );
     TGraph_fill_rect_Ex( main_module.m_gfx, &white_rect );
     // To send the current graphics page to the Cybiko display you should use this function
     DisplayGraphics_show_Ex( main_module.m_gfx , 1 );
     ...
     DisplayGraphics_set_page( main_module.m_gfx, 0 );
     DisplayGraphics_page_copy_Ex( main_module.m_gfx, 1, 0 , &white_rect );
     // Now the white rectangle is on both Cybiko graphics pages.
See also:
DisplayGraphics_page_copy.

void DisplayGraphics_put_background ( struct DisplayGraphics * ptr_gfx,
char * ptr_background )
 

Sets an image pointed by ptr_background as a background image.

Parameters:
ptr_gfx   A pointer to a DisplayGraphics object
ptr_background   A pointer to a background image
Returns:
None
   #include <cywin.h>
     ...
     struct module_t main_module;
     struct Graphics gfx;
     ...
     init_module( &main_module );
     ...
     DisplayGraphics_put_background( main_module.m_gfx,
              Graphics_get_buf_addr( &gfx ));
     ...

void DisplayGraphics_scroll ( struct DisplayGraphics * ptr_gfx,
struct rect_t * ptr_rectangle,
int dx,
int dy )
 

Scrolls a rectangular area by dx and dy.

Parameters:
ptr_gfx   A pointer to a DisplayGraphics object
ptr_rectangle   A pointer to the rect_t type structure to be scrolled
dx   A number of pixels in the x-direction
dy   A number of pixels in the y-direction
Returns:
None
   #include <cywin.h>
     ...
     struct module_t main_module;
     int scroll_shift;
     ...
     init_module( &main_module );
     ...
     DisplayGraphics_scroll( main_module.m_gfx, 0, 0, 160, 78, scroll_shift, 0 );
     ...

void DisplayGraphics_set_bitmap ( struct DisplayGraphics * ptr_gfx,
struct Bitmap * bmp )
 

Sets a bitmap 'bmp' as the destination for drawings.

Parameters:
ptr_gfx   A pointer to a DisplayGraphics object
bmp   A pointer to the Bitmap object
Returns:
None
   #include <cywin.h>
     ...
     struct module_t main_module;
     struct Bitmap bitmap;
     ...
     init_module( &main_module );
     ...
     DisplayGraphics_set_bitmap( main_module.m_gfx, &bitmap );
     ...
     DisplayGraphics_show( main_module.m_gfx );
     ...

void DisplayGraphics_set_bkcolor ( struct DisplayGraphics * ptr_gfx,
color_t fc )
 

Sets the current background color.

Parameters:
ptr_gfx   A pointer to a TGraph object
fc   A color_t object
Returns:
None
   #include <cybiko.h>
     ...
     struct module_t main_module;
     struct Bitmap bmp;
     ...
     init_module( &main_module );
     // Creates a bitmap from the file "root.ico".
     Bitmap_ctor_Ex1( &bmp, "root.ico" );
     ...
     // Set draw mode to mode OR.
     TGraph_set_draw_mode( main_module.m_gfx, DM_OR );
     // Set transparent color to CLR_BLACK
     TGraph_set_bkcolor( main_module.m_gfx, CLR_BLACK );
     // Draw all pixels of the bitmap except pixels with CLR_BLACK color.
     Graphics_draw_bitmap( main_module.m_gfx, &bmp, 30, 40, BM_NORMAL );
     ...
     Bitmap_dtor( &bmp, LEAVE_MEMORY );
     ...
See also:
CLR_WHITE, CLR_LTGRAY, CLR_DKGRAY, CLR_BLACK.

void DisplayGraphics_set_clip ( struct DisplayGraphics * ptr_gfx,
int fx,
int fy,
int fw,
int fh )
 

Sets a clip region, defined by coordinates that are stored in fx, fy, fw and fh parameters.

Parameters:
ptr_gfx   A pointer to a TGraph object
fx   x-coordinate of upper-left corner of the area to be clipped
fy   y-coordinate of upper-left corner of the area to be clipped
fw   Width of the area to be clipped
fh   Height of the area to be clipped
Returns:
None
   #include <cybiko.h>
     ...
     struct module_t main_module;
     struct rect_t clip_region;
     init_module( &main_module );
     ...
     // main_module.m_gfx is a pointer to the Cybiko graphics context.
     TGraph_get_clip ( main_module.m_gfx, &clip_region );
     if ( (clip_region.x != 0) || ( clip_region.y != 0) ||
        ( clip_region.w != SCREEN_WIDTH) ||( clip_region.h != SCREEN_HEIGHT) )
         TGraph_set_clip( main_module.m_gfx, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT );
     ...
See also:
DisplayGraphics_set_clip_Ex.

void DisplayGraphics_set_clip_Ex ( struct DisplayGraphics * ptr_gfx,
struct rect_t * ptr_rectangle )
 

Duplicates the Graphics_set_clip function.
The region coordinates are stored in the rect_t object.

Parameters:
ptr_gfx   A pointer to a TGraph object
ptr_rectangle   A pointer to a rect_t object. By this structure we can define the region coordinates
Returns:
None
   #include <cybiko.h>
     ...
     struct module_t main_module;
     struct rect_t clip_region;
     struct rect_t new_clip_reg;
     init_module( &main_module );
     ...
     new_clip_reg.x = 10;
     new_clip_reg.y = 10;
     new_clip_reg.h = 100;
     new_clip_reg.w = 100;
     ...
     // main_module.m_gfx is a pointer to the Cybiko graphics context.
     TGraph_get_clip ( main_module.m_gfx, &clip_region );
     if ( (clip_region.x != 0) || ( clip_region.y != 0) ||
        ( clip_region.w != SCREEN_WIDTH) ||( clip_region.h != SCREEN_HEIGHT) )
        TGraph_set_clip_Ex( main_module.m_gfx, &new_clip_reg );
     ...
See also:
DisplayGraphics_set_clip.

void DisplayGraphics_set_color ( struct DisplayGraphics * ptr_gfx,
color_t fc )
 

Sets the current foreground color.

Parameters:
ptr_gfx   A pointer to a TGraph object
fc   A pointer to a color_t object
Returns:
None
   #include <cybiko.h>
     ...
     struct module_t main_module;
     init_module( &main_module );
     ...
     // main_module.m_gfx is a pointer to the Cybiko graphics context.
     // The second parameter in the TGraph_set_color function is color value.
     // This value must be one of the following: CLR_WHITE, CLR_LTGRAY, CLR_DKGRAY, CLR_BLACK.
     if ( TGraph_get_color( main_module.m_gfx ) != CLR_LTGRAY )
          TGraph_set_color( main_module.m_gfx, CLR_LTGRAY );
     TGraph_draw_line( main_module.m_gfx, 10, 10, 20, 60 );
     ...
     // To send the current graphics page to the Cybiko display you should use this function
     DisplayGraphics_show( main_module.m_gfx );
See also:
DisplayGraphics_get_color, CLR_WHITE, CLR_LTGRAY, CLR_DKGRAY, CLR_BLACK.

void DisplayGraphics_set_draw_mode ( struct DisplayGraphics * ptr_gfx,
drawmode_t dm )
 

Sets the current drawing mode.

Parameters:
ptr_gfx   A pointer to a TGraph object
dm   A drawmode_t object
Returns:
None
   #include <cybiko.h>
     ...
     struct module_t main_module;
     init_module( &main_module );
     ...
     // main_module.m_gfx is a pointer to the Cybiko graphics context.
     // The second parameter in the TGraph_set_color function is color value.
     // This value must be one of the following: CLR_WHITE, CLR_LTGRAY, CLR_DKGRAY, CLR_BLACK.
     TGraph_set_color( main_module.m_gfx, CLR_LTGRAY );
     ...
     // The second parameter in the TGraph_set_draw_mode function is the draw mode value.
     // This value must be one of the following: DM_XOR, DM_OR, DM_PUT.
     if ( TGraph_get_draw_mode( main_module.m_gfx ) != DM_PUT )
          TGraph_set_draw_mode( main_module.m_gfx, DM_PUT );
     TGraph_fill_rect( main_module.m_gfx, 5, 5, 30, 30 );
     ...
     // To send the current graphics page to the Cybiko display you should use this function
     DisplayGraphics_show( main_module.m_gfx );
See also:
DisplayGraphics_get_draw_mode, DM_XOR, DM_OR, DM_PUT.

void DisplayGraphics_set_font ( struct DisplayGraphics * ptr_gfx,
struct Font * font )
 

Sets the font object as a current font.

Parameters:
ptr_gfx   A pointer to a TGraph object
font   A pointer to the Font structure
Returns:
None
   #include <cybiko.h>
     ...
     int str_plen;
     struct module_t main_module;
     ...
     init_module( &main_module );
     ...
     // main_module.m_gfx is a pointer to the Cybiko graphics context.
     Graphics_set_font( main_module.m_gfx, cool_normal_font );
     ...

void DisplayGraphics_set_page ( struct DisplayGraphics * ptr_gfx,
int page )
 

Sets the page 'page' as a target for drawing, and in default sends it to the LCD.

Parameters:
ptr_gfx   A pointer to a DisplayGraphics object
page   Can be 0 or 1
Returns:
None
   #include <cybiko.h>
     ...
     struct module_t main_module;
     init_module( &main_module );
     ...
     if ( !DisplayGraphics_get_page( main_module.m_gfx ) )
        DisplayGraphics_set_page( main_module.m_gfx, 1 );
     ...
See also:
DisplayGraphics_get_page.

void DisplayGraphics_set_pixel ( struct DisplayGraphics * ptr_gfx,
int fx,
int fy,
color_t fc )
 

Sets the color value 'fc' for pixel (fx, fy).

Parameters:
ptr_gfx   A pointer to a TGraph object
fx   x-coordinate of the pixel to be drawn
fy   y-coordinate of the pixel to be drawn
fc   Color of the pixel to be drawn
Returns:
None
   #include <cybiko.h>
     ...
     struct module_t main_module;
     struct rect_t clip_region;
     init_module( &main_module );
     ...
     // main_module.m_gfx is a pointer to the Cybiko graphics context.
     TGraph_get_clip ( main_module.m_gfx, &clip_region );
     if ( TGraph_get_pixel( main_module.m_gfx, 10, 30 ) == CLR_BLACK )
          TGraph_set_pixel( main_module.m_gfx, 10, 30, CLR_WHITE );
     ...
See also:
DisplayGraphics_get_pixel, CLR_WHITE, CLR_LTGRAY, CLR_DKGRAY, CLR_BLACK.

void DisplayGraphics_show ( struct DisplayGraphics * ptr_gfx )
 

Sends the current graphics page to the LCD.

Parameters:
ptr_gfx   A pointer to a DisplayGraphics object
Returns:
None
   #include <cybiko.h>
     ...
     int i;
     struct module_t main_module;
     ...
     init_module( &main_module );
     ...
     // main_module.m_gfx is a pointer to the Cybiko graphics context.
     DisplayGraphics_set_page( main_module.m_gfx, 0 );
     // main_module.m_gfx is a pointer to the Cybiko graphics context.
     // The second parameter in the TGraph_set_color function is the color value.
     // This value must be one of the following: CLR_WHITE, CLR_LTGRAY, CLR_DKGRAY, CLR_BLACK.
     TGraph_set_color( main_module.m_gfx, CLR_WHITE );
     TGraph_fill_rect( main_module.m_gfx, 5, 5, 30, 30 );
     // To send the current graphics page to the Cybiko display you should use this function
     DisplayGraphics_show( main_module.m_gfx );
     ...
     DisplayGraphics_set_page( main_module.m_gfx, 1 );
     TGraph_set_color( main_module.m_gfx, CLR_BLACK );
     TGraph_fill_rect( main_module.m_gfx, 5, 5, 30, 30 );
     DisplayGraphics_show( main_module.m_gfx );
     ...
     for(i=0; i<20; i++)
     {
       DisplayGraphics_flip( main_module.m_gfx );
       cWinApp_pause( main_module.m_gfx, 250);   // 250 milliseconds delay.
     }
     //  Black and white rectangles will change places with each other.
See also:
DisplayGraphics_set_page, DisplayGraphics_show_Ex.

void DisplayGraphics_show_Ex ( struct DisplayGraphics * ptr_gfx,
int page )
 

The extended version of the DisplayGraphics_show function.
Sends a specified graphics page to the LCD. The graphics page defines are in the 'pg' parameter.

Parameters:
ptr_gfx   A pointer to a DisplayGraphics object
page   Graphics page (0 or 1)
Returns:
None
   #include <cybiko.h>
     ...
     int i;
     struct module_t main_module;
     ...
     init_module( &main_module );
     ...
     // main_module.m_gfx is a pointer to the Cybiko graphics context.
     DisplayGraphics_set_page( main_module.m_gfx, 0 );
     // main_module.m_gfx is a pointer to the Cybiko graphics context.
     // The second parameter in the TGraph_set_color function is color value.
     // This value must be one of the following: CLR_WHITE, CLR_LTGRAY, CLR_DKGRAY, CLR_BLACK.
     TGraph_set_color( main_module.m_gfx, CLR_WHITE );
     TGraph_fill_rect( main_module.m_gfx, 5, 5, 30, 30 );
     // To send the current graphics page to the Cybiko display you should use this function
     DisplayGraphics_show( main_module.m_gfx );
     ...
     DisplayGraphics_set_page( main_module.m_gfx, 1 );
     TGraph_set_color( main_module.m_gfx, CLR_BLACK );
     TGraph_fill_rect( main_module.m_gfx, 5, 5, 30, 30 );
     DisplayGraphics_show( main_module.m_gfx );
     ...
     for(i=0; i<20; i++)
     {
       DisplayGraphics_show_Ex( main_module.m_gfx, i%2 );
       cWinApp_pause(main_module.m_process , 250);   // 250 milliseconds delay.
     }
     //  Black and white rectangles will change places with each other.
See also:
DisplayGraphics_set_page, DisplayGraphics_show.

int DisplayGraphics_string_width ( struct DisplayGraphics * ptr_gfx,
char * string )
 

Returns the width (in pixels) of a string in the current font.

Parameters:
ptr_gfx   A pointer to the initialized DisplayGraphics object
string   A pointer to the string
Returns:
The width (in pixels) of a string in the current font
   #include <cybiko.h>
     ...
     struct module_t main_module;
     int str_plen;
     DisplayGraphics_set_font( main_module.m_gfx, cool_normal_font );
     ...
     str_plen = DisplayGraphics_string_width( main_module.m_gfx, "Any string" );
     ...
See also:
DisplayGraphics_string_width_Ex.

int DisplayGraphics_string_width_Ex ( struct DisplayGraphics * ptr_gfx,
char * string,
int flen )
 

Returns the width (in pixels) of the first 'flen' symbols in a string.

Parameters:
ptr_gfx   A pointer to the initialized DisplayGraphics object
string   A pointer to the string
flen   A number of the symbols
Returns:
The width (in pixels) of the first 'flen' symbols in a string
   #include <cybiko.h>
     ...
     struct module_t main_module;
     int str_plen;
     DisplayGraphics_set_font( main_module.m_gfx, cool_normal_font );
     ...
     str_plen = DisplayGraphics_string_width_Ex( main_module.m_gfx, "Any string" ,20);
     ...
See also:
DisplayGraphics_string_width.