Tscope5
bitmaps4.c

read a bitmap from a file, relative coordinate scale + display coordinate system

#include <tscope5.h>
#include <stdio.h>
int main()
{
ts5_set_coordinate_scale(TS5_RELATIVE_COORDINATES);
ts5_set_coordinate_system(TS5_DISPLAY_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_draw_bitmap(map, 0.0, 0.0);
// flipped draw
ts5_draw_flipped_bitmap(map, 0.0, 0.0, TS5_FLIP_VERTICAL);
// tinted draw
TS5_COLOR tint = ts5_make_named_color("lawngreen", 1.0);
ts5_draw_tinted_bitmap(map, tint, 0.0, 0.0);
// draw region
ts5_draw_bitmap_region(map, 0.0, 0.0, 0.5, 0.5, 0.0, 0.0);
// draw rotated bitmap
ts5_draw_rotated_bitmap(map, 0.0, 0.0, 45.0, 0.0, 0.0);
// draw scaled bitmap
ts5_draw_scaled_bitmap(map, 1.0/bw, 1.0/bh, 0.0, 0.0);
return 0;
}