Tscope5
bitmaps.c
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////////////
2 //
3 // __ ______
4 // / /_______________ ____ ___ / ____/
5 // / __/ ___/ ___/ __ \/ __ \/ _ \ /___ )
6 // / /_(__ ) /__/ /_/ / /_/ / __/ ____/ /
7 // \__/____/\___/\____/ .___/\___/ /_____/
8 // /_/
9 //
10 /// \file bitmaps.c
11 /// Definitions of bitmap functions.
12 /// \example bitmaps01.c
13 /// \example bitmaps02.c
14 /// \example bitmaps03.c
15 /// \example bitmaps04.c
16 /// \example bitmaps05.c
17 ////////////////////////////////////////////////////////////////////////////////
18 
19 
20 #include "../include/tscope5/bitmaps.h"
21 #include "../include/tscope5/display.h"
22 #include "../include/tscope5/graphics.h"
23 #include "../include/tscope5/bitmaps_internal.h"
24 #include "../include/tscope5/system_internal.h"
25 #include "../include/tscope5/graphics_internal.h"
26 #include "../include/tscope5/display_internal.h"
27 
28 
29 ////////////////////////////////////////////////////////////////////////////////
30 /// @name Loading bitmaps
31 /// Bitmaps can either be read from a file, or empty bitmaps can be generated.
32 //@{
33 ////////////////////////////////////////////////////////////////////////////////
34 
35 
36 ////////////////////////////////////////////////////////////////////////////////
37 /// Create a bitmap.
38 ///
39 /// \param w Width of the bitmap.
40 /// \param h Height of the bitmap.
41 ///
42 /// \return A pointer to the newly created bitmap.
43 ///
44 /// The default background color of the newly created bitmap
45 /// is the same as the display.
46 ////////////////////////////////////////////////////////////////////////////////
47 TS5_BITMAP *ts5_alloc_bitmap(double w, double h)
48 {
49  ts5_check_bitmaps("ts5_alloc_bitmap");
50  ts5_log(TS5_LOGLEVEL_2, "ts5_alloc_bitmap(%f,%f)\n", w, h);
51 
52  if (_ts5_status.graphics.coordinate_scale
53  == TS5_RELATIVE_COORDINATES) {
54  w *= _ts5_status.graphics.target_width;
55  h *= _ts5_status.graphics.target_height;
56  }
57 
58  TS5_BITMAP *map;
59  map = al_create_bitmap(w, h);
60 
61  if (map == NULL) {
62  ts5_fatal("ts5_alloc_bitmap: could not make bitmap\n");
63  }
64 
65  TS5_BITMAP *oldval = ts5_set_drawing_target(map);
67  ts5_set_drawing_target(oldval);
68 
69  return map;
70 }
71 
72 
73 ////////////////////////////////////////////////////////////////////////////////
74 /// Open a bitmap from a file.
75 ///
76 /// \param file Path to the bitmap file.
77 ///
78 /// \return A pointer to the newly created bitmap.
79 ///
80 /// Available bitmap types are: bmp, pcx, tga, jpeg and png.
81 ////////////////////////////////////////////////////////////////////////////////
82 TS5_BITMAP *ts5_read_bitmap(const char *file)
83 {
84  ts5_check_bitmaps("ts5_read_bitmap");
85  ts5_log(TS5_LOGLEVEL_2, "ts5_read_bitmap(%s)\n", file);
86 
87  TS5_BITMAP *map;
88  map = al_load_bitmap(file);
89 
90  if (map == NULL) {
91  ts5_fatal("ts5_read_bitmap: could not read bitmap\n");
92  }
93 
94  al_convert_bitmap(map);
95 
96  return map;
97 }
98 
99 
100 ////////////////////////////////////////////////////////////////////////////////
101 /// Write a bitmap.
102 ///
103 /// \param file Path to the bitmap file.
104 /// \param map Pointer to the bitmap that will be written.
105 ///
106 /// The extension specifies the file type.
107 /// Available bitmap types are: bmp, pcx, tga, jpeg and png.
108 ///
109 /// Useful for saving screenshots of the experiment.
110 ///
111 /// Useful for creating complex stimuli beforehand.
112 ////////////////////////////////////////////////////////////////////////////////
113 void ts5_write_bitmap(const char *file, TS5_BITMAP *map)
114 {
115  ts5_check_bitmaps("ts5_write_bitmap");
116  ts5_log(TS5_LOGLEVEL_2, "ts5_write_bitmap(%s,%p)\n", file, map);
117 
118  if (!al_save_bitmap(file, map)) {
119  ts5_fatal("ts5_write_bitmap: could not write bitmap\n");
120  }
121 }
122 
123 
124 ////////////////////////////////////////////////////////////////////////////////
125 /// Free the memory used by a bitmap.
126 ///
127 /// \param map pointer to the bitmap that will be freed.
128 ///
129 /// This function should be called at the end of the program for
130 /// each bitmap allocated or read by the user.
131 ////////////////////////////////////////////////////////////////////////////////
132 void ts5_free_bitmap(TS5_BITMAP *map)
133 {
134  ts5_check_bitmaps("ts5_free_bitmap");
135  ts5_log(TS5_LOGLEVEL_2, "ts5_free_bitmap(%p)\n", map);
136 
137  al_destroy_bitmap(map);
138  map = NULL;
139 }
140 
141 
142 ////////////////////////////////////////////////////////////////////////////////
143 //@}
144 ////////////////////////////////////////////////////////////////////////////////
145 
146 
147 ////////////////////////////////////////////////////////////////////////////////
148 /// @name Query bitmap dimensions
149 /// The dimensions of a bitmap can be queried using the functions below:
150 //@{
151 ////////////////////////////////////////////////////////////////////////////////
152 
153 
154 ////////////////////////////////////////////////////////////////////////////////
155 /// Get the size of a bitmap in pixels.
156 ///
157 /// \param map The bitmap that will be queried.
158 /// \param w Variable that will store the width.
159 /// \param h Variable that will store the height.
160 ///
161 /// You can pass NULL for values you are not interested in.
162 ///
163 /// ts5_alloc_bitmap(), ts5_read_bitmap(), primitives.c, textio.c
164 ////////////////////////////////////////////////////////////////////////////////
165 void ts5_get_bitmap_size(TS5_BITMAP *map, double *w, double *h)
166 {
167  ts5_check_bitmaps("ts5_get_bitmap_size");
168  ts5_log(TS5_LOGLEVEL_5, "ts5_get_bitmap_size(%p,%p,%p)\n", map, w, h);
169 
170  if (!map) {
171  ts5_fatal("ts5_get_bitmap_size: bitmap pointer is null\n");
172  }
173 
174  if (w) {
175  *w = al_get_bitmap_width(map);
176  }
177 
178  if (h) {
179  *h = al_get_bitmap_height(map);
180  }
181 }
182 
183 
184 ////////////////////////////////////////////////////////////////////////////////
185 /// Get the width of a bitmap in pixels.
186 ///
187 /// \param map The bitmap that will be queried.
188 ///
189 /// \return The width of the bitmap.
190 ////////////////////////////////////////////////////////////////////////////////
191 double ts5_get_bitmap_width(TS5_BITMAP *map)
192 {
193  ts5_check_bitmaps("ts5_get_bitmap_width");
194  ts5_log(TS5_LOGLEVEL_5, "ts5_get_bitmap_width(%p)\n", map);
195 
196  double w;
197  ts5_get_bitmap_size(map, &w, NULL);
198 
199  return w;
200 }
201 
202 
203 ////////////////////////////////////////////////////////////////////////////////
204 /// Get the height of a bitmap in pixels.
205 ///
206 /// \param map The bitmap that will be queried.
207 ///
208 /// \return The height of the bitmap.
209 ////////////////////////////////////////////////////////////////////////////////
210 double ts5_get_bitmap_height(TS5_BITMAP *map)
211 {
212  ts5_check_bitmaps("ts5_get_bitmap_height");
213  ts5_log(TS5_LOGLEVEL_5, "ts5_get_bitmap_width(%d)\n", map);
214 
215  double h;
216  ts5_get_bitmap_size(map, NULL, &h);
217 
218  return h;
219 }
220 
221 
222 ////////////////////////////////////////////////////////////////////////////////
223 //@}
224 ////////////////////////////////////////////////////////////////////////////////
225 
226 
227 ////////////////////////////////////////////////////////////////////////////////
228 /// @name Drawing on bitmaps
229 /// Text/primitives output that is normally drawn on the display can
230 /// be redirected to a bitmap.
231 //@{
232 ////////////////////////////////////////////////////////////////////////////////
233 
234 
235 ////////////////////////////////////////////////////////////////////////////////
236 /// Set the active drawing target.
237 ///
238 /// \param target Pointer to the bitmap that will be used
239 /// for drawing operations.
240 ///
241 /// \return A pointer to the previous active drawing target.
242 ////////////////////////////////////////////////////////////////////////////////
243 TS5_BITMAP *ts5_set_drawing_target(TS5_BITMAP * target)
244 {
245  ts5_check_display("ts5_set_drawing_target");
246  ts5_log(TS5_LOGLEVEL_4, "ts5_set_drawing_target(%p)\n", target);
247 
248  if (target == NULL) {
249  ts5_fatal("ts5_set_drawing_target: target is a NULL pointer\n");
250  }
251 
252  TS5_BITMAP *retval = _ts5_data.target;
253  _ts5_data.target = target;
254  al_set_target_bitmap(_ts5_data.target);
255 
256  _ts5_status.graphics.target_width =
257  al_get_bitmap_width(_ts5_data.target);
258 
259  _ts5_status.graphics.target_height =
260  al_get_bitmap_height(_ts5_data.target);
261 
262  return retval;
263 }
264 
265 
266 ////////////////////////////////////////////////////////////////////////////////
267 /// Get the active drawing target.
268 ///
269 /// \return A pointer to the active drawing target.
270 ////////////////////////////////////////////////////////////////////////////////
272 {
273  ts5_check_display("ts5_get_drawing_target");
274  ts5_log(TS5_LOGLEVEL_4, "ts5_get_drawing_target()\n");
275 
276  return _ts5_data.target;
277 }
278 
279 
280 ////////////////////////////////////////////////////////////////////////////////
281 /// Get the total size of the drawing target in pixels.
282 ///
283 /// \param w Variable that will store the width.
284 /// \param h Variable that will store the height.
285 ///
286 /// The drawing target can be either a display or a memory bitmap.
287 ///
288 /// You can pass NULL for values you are not interested in.
289 ////////////////////////////////////////////////////////////////////////////////
290 void ts5_get_target_size(double *w, double *h)
291 {
292  ts5_check_graphics("ts5_get_target_size");
293  ts5_log(TS5_LOGLEVEL_4, "ts5_get_target_size(%p,%p)\n", w, h);
294 
295  if (w) {
296  *w = _ts5_status.graphics.target_width;
297  }
298 
299  if (h) {
300  *h = _ts5_status.graphics.target_height;
301  }
302 }
303 
304 
305 ////////////////////////////////////////////////////////////////////////////////
306 /// Get the total width of the drawing target in pixels.
307 ///
308 /// \return the width of the drawing target.
309 ///
310 /// The drawing target can be either a display or a memory bitmap.
311 ////////////////////////////////////////////////////////////////////////////////
313 {
314  ts5_check_graphics("ts5_get_target_width");
315  ts5_log(TS5_LOGLEVEL_4, "ts5_get_target_width()\n");
316 
317  double w;
318  ts5_get_target_size(&w, NULL);
319 
320  return w;
321 }
322 
323 
324 ////////////////////////////////////////////////////////////////////////////////
325 /// Get the total height of the drawing target in pixels.
326 ///
327 /// \return the height of the drawing target.
328 ///
329 /// The drawing target can be either a display or a memory bitmap.
330 ////////////////////////////////////////////////////////////////////////////////
332 {
333  ts5_check_graphics("ts5_get_target_height");
334  ts5_log(TS5_LOGLEVEL_4, "ts5_get_target_height()\n");
335 
336  double h;
337  ts5_get_target_size(NULL, &h);
338 
339  return h;
340 
341 }
342 
343 
344 ////////////////////////////////////////////////////////////////////////////////
345 //@}
346 ////////////////////////////////////////////////////////////////////////////////
347 
348 
349 ////////////////////////////////////////////////////////////////////////////////
350 /// @name Drawing bitmaps on the display
351 ///
352 /// The destination coordinates of the bitmap drawing functions below are
353 /// interpreted dependent on the coordinate system used.
354 /// - When using the Cartesian coordinate system,
355 /// bitmaps are centered around the destination coordinates.
356 /// - When using the Display coordinate system,
357 /// the destination coordinates correspond to the
358 /// upper left corner of the bitmap.
359 //@{
360 ////////////////////////////////////////////////////////////////////////////////
361 
362 
363 ////////////////////////////////////////////////////////////////////////////////
364 /// Draw a bitmap.
365 ///
366 /// \param map The bitmap that will be drawn.
367 /// \param dx Horizontal position where it will be drawn.
368 /// \param dy Vertical position where it will be drawn.
369 ////////////////////////////////////////////////////////////////////////////////
370 void ts5_draw_bitmap(TS5_BITMAP *map, double dx, double dy)
371 {
372  ts5_check_bitmaps2("ts5_draw_bitmap", map);
373  ts5_log(TS5_LOGLEVEL_5, "ts5_draw_bitmap(%p,%f,%f)\n", map, dx, dy);
374 
375  if (_ts5_status.graphics.coordinate_scale
376  == TS5_RELATIVE_COORDINATES) {
379  }
380 
381  if (_ts5_status.graphics.coordinate_system
382  == TS5_CARTESIAN_COORDINATES) {
383 
385  - al_get_bitmap_width(map) / 2.0;
386 
388  - al_get_bitmap_height(map) / 2.0;
389  }
390 
391  al_draw_bitmap(map, dx, dy, 0);
392 }
393 
394 
395 ////////////////////////////////////////////////////////////////////////////////
396 /// Draw a flipped bitmap.
397 ///
398 /// \param map The bitmap that will be drawn.
399 /// \param dx Horizontal position where it will be drawn.
400 /// \param dy Vertical position where it will be drawn.
401 /// \param flip Direction of the flip.
402 /// Can be TS5_FLIP_HORIZONTAL, TS5_FLIP_VERTICAL or TS5_FLIP_BOTH.
403 ////////////////////////////////////////////////////////////////////////////////
404 void ts5_draw_flipped_bitmap(TS5_BITMAP *map, double dx, double dy,
405  const int flip)
406 {
407  ts5_check_bitmaps2("ts5_draw_flipped_bitmap", map);
408  ts5_log(TS5_LOGLEVEL_5, "ts5_draw_flipped_bitmap(%p,%f,%f,%d)\n",
409  map, dx, dy, flip);
410 
411  if (flip != TS5_FLIP_HORIZONTAL && flip != TS5_FLIP_VERTICAL
412  && flip != TS5_FLIP_BOTH) {
413  ts5_fatal("%s: %s %s\n", "ts5_draw_flipped_bitmap",
414  "flip should be TS5_FLIP_HORIZONTAL,",
415  "TS5_FLIP_VERTICAL or TS5_FLIP_BOTH");
416  }
417 
418  if (_ts5_status.graphics.coordinate_scale
419  == TS5_RELATIVE_COORDINATES) {
422  }
423 
424  if (_ts5_status.graphics.coordinate_system
425  == TS5_CARTESIAN_COORDINATES) {
426 
428  - al_get_bitmap_width(map) / 2.0;
429 
431  - al_get_bitmap_height(map) / 2.0;
432  }
433 
434  al_draw_bitmap(map, dx, dy, flip);
435 }
436 
437 
438 ////////////////////////////////////////////////////////////////////////////////
439 /// Draw a tinted bitmap.
440 ///
441 /// \param map The bitmap that will be drawn.
442 /// \param tint The tint color.
443 /// All colors in the bitmap are multiplied with the color specified in tint.
444 /// \param dx Horizontal position where it will be drawn.
445 /// \param dy Vertical position where it will be drawn.
446 ////////////////////////////////////////////////////////////////////////////////
447 void ts5_draw_tinted_bitmap(TS5_BITMAP *map, TS5_COLOR tint,
448  double dx, double dy)
449 {
450  ts5_check_bitmaps2("ts5_draw_tinted_bitmap", map);
451  ts5_log(TS5_LOGLEVEL_5, "ts5_draw_tinted_bitmap(%p,(%f,%f,%f,%f),%f,%f)\n",
452  map, tint.r, tint.g, tint.b, tint.a, dx, dy);
453 
454  if (_ts5_status.graphics.coordinate_scale
455  == TS5_RELATIVE_COORDINATES) {
458  }
459 
460  if (_ts5_status.graphics.coordinate_system
461  == TS5_CARTESIAN_COORDINATES) {
462 
464  - al_get_bitmap_width(map) / 2.0;
465 
467  - al_get_bitmap_height(map) / 2.0;
468  }
469 
470  al_draw_tinted_bitmap(map, tint, dx, dy, 0);
471 }
472 
473 
474 ////////////////////////////////////////////////////////////////////////////////
475 /// Draw a region of a bitmap.
476 ///
477 /// \param map The bitmap that will be drawn.
478 /// \param sx1 Horizontal coordinate of the first corner or the region.
479 /// \param sy1 Vertical coordinate of the first corner or the region.
480 /// \param sx2 Horizontal coordinate of the second corner or the region.
481 /// \param sy2 Vertical coordinate of the second corner or the region.
482 /// \param dx Horizontal position where it will be drawn.
483 /// \param dy Vertical position where it will be drawn.
484 ////////////////////////////////////////////////////////////////////////////////
485 void ts5_draw_bitmap_region(TS5_BITMAP *map, double sx1, double sy1,
486  double sx2, double sy2, double dx, double dy)
487 {
488  ts5_check_bitmaps2("ts5_draw_bitmap_region", map);
489  ts5_log(TS5_LOGLEVEL_5, "ts5_draw_bitmap_region(%p,%f,%f,%f,%f,%f,%f)\n",
490  map, sx1, sy1, sx2, sy2, dx, dy);
491 
492  if (_ts5_status.graphics.coordinate_scale
493  == TS5_RELATIVE_COORDINATES) {
496  TS5_BITMAP *oldval = ts5_set_drawing_target (map);
501  ts5_set_drawing_target(oldval);
502  }
503 
504  double width = abs(sx2 - sx1);
505  double height = abs(sy2 - sy1);
506  double x = sx1 < sx2 ? sx1 : sx2;
507  double y = sy1 < sy2 ? sy1 : sy2;
508 
509  if (_ts5_status.graphics.coordinate_system
510  == TS5_CARTESIAN_COORDINATES) {
511  dx = ts5_cartesian_to_display_coordinate_x(dx - width / 2.0);
512  dy = ts5_cartesian_to_display_coordinate_y(height / 2.0 - dy);
513  x = x + al_get_bitmap_width(map) / 2.0;
514  y = y + al_get_bitmap_height(map) / 2.0;
515  }
516 
517  al_draw_bitmap_region(map, x, y, width, height, dx, dy, 0);
518 }
519 
520 
521 ////////////////////////////////////////////////////////////////////////////////
522 /// Draw a rotated bitmap.
523 ///
524 /// \param map The bitmap that will be drawn.
525 /// \param cx Horizontal coordinate of the center of rotation.
526 /// \param cy Certical coordinate of the center of rotation.
527 /// \param angle The angle of rotation in degrees
528 /// (positive is counter clockwise, negative is clockwise).
529 /// \param dx Horizontal position where it will be drawn.
530 /// \param dy Vertical position where it will be drawn.
531 ///
532 /// The center of rotation (cx,cy) will be drawn at (dx,dy).
533 ////////////////////////////////////////////////////////////////////////////////
534 void ts5_draw_rotated_bitmap(TS5_BITMAP *map, double cx, double cy,
535  double angle, double dx, double dy)
536 {
537  ts5_check_bitmaps2("ts5_draw_rotated_bitmap", map);
538  ts5_log(TS5_LOGLEVEL_5, "ts5_draw_rotated_bitmap(%p,%f,%f,%f,%f,%f)\n",
539  map, cx, cy, angle, dx, dy);
540 
541  if (_ts5_status.graphics.coordinate_scale
542  == TS5_RELATIVE_COORDINATES) {
545  TS5_BITMAP *oldval = ts5_set_drawing_target (map);
548  ts5_set_drawing_target(oldval);
549  }
550 
551  if (_ts5_status.graphics.coordinate_system
552  == TS5_CARTESIAN_COORDINATES) {
555  cx = al_get_bitmap_width(map) / 2.0 + cx;
556  cy = al_get_bitmap_height(map) / 2.0 - cy;
557  }
558 
559  angle = - angle * TS5_PI / 180.0;
560 
561  al_draw_rotated_bitmap(map, cx, cy, dx, dy, angle, 0);
562 }
563 
564 
565 ////////////////////////////////////////////////////////////////////////////////
566 /// Draw a scaled bitmap.
567 ///
568 /// \param map The bitmap that will be drawn.
569 /// \param xratio The scaling factor in the horizontal direction.
570 /// \param yratio The scaling factor in the vertical direction.
571 /// \param dx Horizontal position where it will be drawn.
572 /// \param dy Vertical position where it will be drawn.
573 ////////////////////////////////////////////////////////////////////////////////
574 void ts5_draw_scaled_bitmap(TS5_BITMAP *map, double xratio, double yratio,
575  double dx, double dy)
576 {
577  ts5_check_bitmaps2("ts5_draw_scaled_bitmap", map);
578  ts5_log(TS5_LOGLEVEL_5, "ts5_draw_scaled_bitmap(%p,%f,%f,%f,%f)\n",
579  map, xratio, yratio, dx, dy);
580 
581  double h = al_get_bitmap_height(map);
582  double w = al_get_bitmap_width(map);
583 
584  if (_ts5_status.graphics.coordinate_scale
585  == TS5_RELATIVE_COORDINATES) {
588  }
589 
590  if (_ts5_status.graphics.coordinate_system
591  == TS5_CARTESIAN_COORDINATES) {
592  dx = ts5_cartesian_to_display_coordinate_x(dx) - w * xratio / 2.0;
593  dy = ts5_cartesian_to_display_coordinate_y(dy) - h * yratio / 2.0;
594  }
595 
596  al_draw_scaled_bitmap(map, 0.0, 0.0, w, h, dx, dy,
597  w * xratio, h * yratio, 0);
598 }
599 
TS5_BITMAP * ts5_read_bitmap(const char *file)
Open a bitmap from a file.
Definition: bitmaps.c:82
void ts5_draw_bitmap(TS5_BITMAP *map, double dx, double dy)
Draw a bitmap.
Definition: bitmaps.c:370
void ts5_check_display(char *calling_function)
Do some checks at the start of each display function.
void ts5_draw_flipped_bitmap(TS5_BITMAP *map, double dx, double dy, const int flip)
Draw a flipped bitmap.
Definition: bitmaps.c:404
void ts5_free_bitmap(TS5_BITMAP *map)
Free the memory used by a bitmap.
Definition: bitmaps.c:132
void ts5_get_target_size(double *w, double *h)
Get the total size of the drawing target in pixels.
Definition: bitmaps.c:290
double ts5_get_bitmap_width(TS5_BITMAP *map)
Get the width of a bitmap in pixels.
Definition: bitmaps.c:191
void ts5_check_graphics(char *calling_function)
Do some checks at the start of each graphics function.
TS5_BITMAP * ts5_alloc_bitmap(double w, double h)
Create a bitmap.
Definition: bitmaps.c:47
void ts5_draw_tinted_bitmap(TS5_BITMAP *map, TS5_COLOR tint, double dx, double dy)
Draw a tinted bitmap.
Definition: bitmaps.c:447
double ts5_get_bitmap_height(TS5_BITMAP *map)
Get the height of a bitmap in pixels.
Definition: bitmaps.c:210
TS5_BITMAP * ts5_set_drawing_target(TS5_BITMAP *target)
Set the active drawing target.
Definition: bitmaps.c:243
void ts5_draw_rotated_bitmap(TS5_BITMAP *map, double cx, double cy, double angle, double dx, double dy)
Draw a rotated bitmap.
Definition: bitmaps.c:534
double ts5_relative_to_absolute_coordinate_x(const double x)
Convert a relative horizontal coordinate into an absolute horizontal coordinate.
Definition: graphics.c:208
void ts5_check_bitmaps(char *calling_function)
Do some checks at the start of each bitmap function.
void ts5_draw_bitmap_region(TS5_BITMAP *map, double sx1, double sy1, double sx2, double sy2, double dx, double dy)
Draw a region of a bitmap.
Definition: bitmaps.c:485
void ts5_draw_scaled_bitmap(TS5_BITMAP *map, double xratio, double yratio, double dx, double dy)
Draw a scaled bitmap.
Definition: bitmaps.c:574
void ts5_log(const unsigned int level, const char *format,...)
Send info to a logging window.
Definition: system.c:45
double ts5_cartesian_to_display_coordinate_x(const double x)
Convert a horizontal Cartesian coordinate into a horizontal display coordinate.
Definition: graphics.c:333
void ts5_clear_display()
Clear the current drawing target.
Definition: display.c:505
double ts5_cartesian_to_display_coordinate_y(const double y)
Convert a vertical Cartesian coordinate into a vertical display coordinate.
Definition: graphics.c:354
void ts5_check_bitmaps2(char *calling_function, TS5_BITMAP *map)
Do some checks at the start of each bitmap function.
TS5_BITMAP * ts5_get_drawing_target()
Get the active drawing target.
Definition: bitmaps.c:271
void ts5_fatal(const char *format,...)
Exit safely with an error message.
Definition: system.c:529
double ts5_relative_to_absolute_coordinate_y(const double y)
Convert a relative vertical coordinate into an absolute vertical coordinate.
Definition: graphics.c:240
void ts5_write_bitmap(const char *file, TS5_BITMAP *map)
Write a bitmap.
Definition: bitmaps.c:113
double ts5_get_target_width()
Get the total width of the drawing target in pixels.
Definition: bitmaps.c:312
double ts5_get_target_height()
Get the total height of the drawing target in pixels.
Definition: bitmaps.c:331
void ts5_get_bitmap_size(TS5_BITMAP *map, double *w, double *h)
Get the size of a bitmap in pixels.
Definition: bitmaps.c:165