Tscope5
Main Page
Related Pages
Files
Examples
bitmaps04.c
////////////////////////////////////////////////////////////////////////////////
//
// __ ______
// / /_______________ ____ ___ / ____/
// / __/ ___/ ___/ __ \/ __ \/ _ \ /___ )
// / /_(__ ) /__/ /_/ / /_/ / __/ ____/ /
// \__/____/\___/\____/ .___/\___/ /_____/
// /_/
//
// bitmaps04.c
// - Illustration of the bitmap drawing functions.
// - Relative coordinate scale and display coordinate system.
////////////////////////////////////////////////////////////////////////////////
#include <tscope5.h>
int
main()
{
// open a display and set graphics parameters
double
dw, dh;
ts5_set_display_size
(1200,800);
ts5_install_display
();
ts5_get_display_size
(1, &dw, &dh);
ts5_set_coordinate_scale
(TS5_RELATIVE_COORDINATES);
ts5_set_coordinate_system
(TS5_DISPLAY_COORDINATES);
// read the bitmap
double
bw, bh;
TS5_BITMAP *map =
ts5_read_bitmap
(
"boe.jpg"
);
ts5_get_bitmap_size
(map, &bw, &bh);
// regular draw
ts5_clear_display
();
ts5_draw_bitmap
(map, 0.0, 0.0);
ts5_flip_display
();
ts5_draw_mouse_button
(0.9, 0.8);
// flipped draw
ts5_clear_display
();
ts5_draw_flipped_bitmap
(map, 0.0, 0.0, TS5_FLIP_VERTICAL);
ts5_flip_display
();
ts5_draw_mouse_button
(0.9, 0.8);
// tinted draw
TS5_COLOR tint =
ts5_make_named_color
(
"lawngreen"
, 1.0);
ts5_clear_display
();
ts5_draw_tinted_bitmap
(map, tint, 0.0, 0.0);
ts5_flip_display
();
ts5_draw_mouse_button
(0.9, 0.8);
// draw region
ts5_clear_display
();
ts5_draw_bitmap_region
(map, 0.0, 0.0, 0.5, 0.5, 0.0, 0.0);
ts5_flip_display
();
ts5_draw_mouse_button
(0.9, 0.8);
// draw rotated bitmap
ts5_clear_display
();
ts5_draw_rotated_bitmap
(map, 0.0, 0.0, 45.0, 0.0, 0.0);
ts5_flip_display
();
ts5_draw_mouse_button
(0.9, 0.8);
// draw scaled bitmap
ts5_clear_display
();
ts5_draw_scaled_bitmap
(map, 2.0, 2.0, 0.0, 0.0);
ts5_flip_display
();
ts5_draw_mouse_button
(0.9, 0.8);
// free the bitmap
ts5_free_bitmap
(map);
return
0;
}