Tscope5
Main Page
Related Pages
Files
Examples
bitmaps2.c
read a bitmap from a file, relative coordinate scale
#include <tscope5.h>
#include <stdio.h>
int
main()
{
ts5_install_display
();
ts5_set_coordinate_scale
(TS5_RELATIVE_COORDINATES);
double
dw, dh;
ts5_get_display_size
(1, &dw, &dh);
printf(
"display size: %f %f\n"
, dw, dh);
TS5_BITMAP *map =
ts5_read_bitmap
(
"boe.jpg"
);
double
bw, bh;
ts5_get_bitmap_size
(map, &bw, &bh);
printf(
"bitmap size: %f %f\n"
, 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.5, -0.5, 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.5, -0.5, 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, 1.0/bw, 1.0/bh, 0.0, 0.0);
ts5_flip_display
();
ts5_draw_mouse_button
(0.9, -0.8);
ts5_free_bitmap
(map);
return
0;
}