~ruther/CTU-FEE-B0B35APO-Semestral-project

ref: 247d0c106cc3c32caef42a555948bb0b8cd32ff6 CTU-FEE-B0B35APO-Semestral-project/image-viewer/include/coords.h -rw-r--r-- 1.2 KiB
247d0c10 — František Boháček fix: floating point exception 3 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include "display_utils.h"
#include "image.h"
#include <stdint.h>

typedef struct {
  int32_t x;
  int32_t y;
} coords_t;

/**
 * @brief Create coords with given x and y coordinates
 *
 * @param x x coordinate
 * @param y y coordinate
 * @return coords_t
 */
coords_t coords_create(int32_t x, int32_t y);

/**
 * @brief Get begin coords on screen of given image and scale
 *
 * @param image
 * @param zoom
 * @return coords_t
 */
coords_t coords_get_image_screen_beg_coord(image_t *image, image_zoom_t zoom);

/**
 * @brief Get end coords on screen of given image and scale
 *
 * @param image
 * @param zoom
 * @return coords_t
 */
coords_t coords_get_image_screen_end_coords(image_t *image, image_zoom_t zoom);

/**
 * @brief Map image coords to screen coords for given image and zoom
 *
 * @param image
 * @param zoom
 * @param image_coords
 * @return coords_t
 */
coords_t image_get_screen_coords(image_t *image, image_zoom_t zoom,
                                 coords_t image_coords);

/**
 * @brief Map screen coords to image coords for given image and zoom
 *
 * @param image
 * @param zoom
 * @param screen_coords
 * @return coords_t
 */
coords_t image_get_image_coords(image_t *image, image_zoom_t zoom,
                                coords_t screen_coords);
Do not follow this link