Draws a bitmap 'bmp' in a specified position (left, top) in 'fm' mode.
#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 ); ...
Draws a character 'fc' with the current font in a specified position (fx, fy).
#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' ); ...
Draws a horizontal line from point (x , y) to point (xx , y).
#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); ...
Draws a solid line from point (x,y) to point (xx,yy).
#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); ...
Draws a rectangular frame in the current color.
It is defined by the coordinates stored in the fx, fy, fw and fh parameters.
#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); ...
Duplicates the DisplayGraphics_draw_rect function.
#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 ); ...
Draws text in a specified position (left, top) with the current font.
#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 ); ...
Duplicates the DisplayGraphics_draw_text function.
If the length of the string exceeds the number of 'flen' pixels, the string will be truncated.
#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); ...
Draws a vertical line from point (x, y) to point (x , yy).
#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); ...
Fills a rectangle with the current color.
The rectangle's area is defined by the fx, fy, fw and fh parameters.
#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); ...
Duplicates the Graphics_fill_rect function.
#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 ); ...
Fills the screen with the 'fc' color.
#include <cybiko.h> ... struct module_t main_module; ... init_module( &main_module ); DisplayGraphics_fill_screen( main_module.m_gfx, CLR_LTGRAY); ...
Switches background and foreground pages and shows the background screen on the LCD.
#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.
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 )); ...
Returns the number of bytes amount 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 ) ); ...
Returns the current font's character's 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 ); ...
Returns the 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' ); ...
Returns a clip region.
#include <cybiko.h> struct module_t main_module; ... struct rect_t clip_region; ... DisplayGraphics_get_clip( main_module.m_gfx, &clip_region); ...
Returns the 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); ...
Returns the 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); ...
Returns 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); ...
Returns the 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 ); ...
Returns the pointer to the screen buffer for the 'fp' graphics page.
Use with caution!!!
#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 );
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 ); ...
Copies a rectangular area from one graphics page to another.
A rectangular area is defined by x,y,h and w parameters.
#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. ...
Duplicates the DisplayGraphics_page_copy function.
The region coordinates are defined in the rect_t object.
#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.
Sets an image pointed by ptr_background as a background image.
#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 )); ...
Scrolls a rectangular area by dx and dy.
#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 ); ...
Sets a bitmap 'bmp' as the destination for drawings.
#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 ); ...
Sets the current background color.
#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 ); ...
Sets a clip region, defined by coordinates that are stored in fx, fy, fw and fh parameters.
#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 ); ...
Duplicates the Graphics_set_clip function.
The region coordinates are stored in the rect_t object.
#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 ); ...
Sets the current foreground color.
#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 );
Sets the current drawing mode.
#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 );
Sets the font object as a current font.
#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 ); ...
Sets the page 'page' as a target for drawing, and in default sends it to the LCD.
#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 ); ...
Sets the color value 'fc' for pixel (fx, fy).
#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 ); ...
Sends the current graphics page to the LCD.
#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.
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.
#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.
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" ); ...
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); ...