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

ref: 247d0c106cc3c32caef42a555948bb0b8cd32ff6 CTU-FEE-B0B35APO-Semestral-project/image-viewer/include/cursor.h -rw-r--r-- 1.7 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#ifndef __CURSOR_H__
#define __CURSOR_H__

#include "direction.h"
#include "display_utils.h"
#include "image.h"
#include <stdint.h>
#include <time.h>

#define CURSOR_WIDTH 11

typedef struct {
  uint16_t x;
  uint16_t y;

  bool shown;
  time_t shown_at;

  display_pixel_t previous_display_data[CURSOR_WIDTH * CURSOR_WIDTH];
} cursor_t;

extern const display_pixel_t CURSOR_COLOR;
extern const display_pixel_t CURSOR_OUTLINE_COLOR;

/**
 * @brief Create cursor
 *
 * @return cursor_t
 */
cursor_t cursor_create();

/**
 * @brief Center cursor within region
 *
 * @param cursor
 * @param region within to center the cursor
 */
void cursor_center(cursor_t *cursor, image_region_t region);

/**
 * @brief Move cursor in given direction within region given
 *
 * @param cursor
 * @param region to move cursor within, if cursor is outside, move it inside
 * @param direction what direction to move cursor to
 * @param amount how many steps to move
 * @return true cursor was moved
 * @return false cursor was not moved
 */
bool cursor_move(cursor_t *cursor, image_region_t region, direction_t direction,
                 int16_t amount);

/**
 * @brief Show cursor on display screen
 *
 * @param cursor
 * @param image image to map image coords to screen coords
 * @param zoom zoom to map image coords to screen coords
 * @param display
 */
void cursor_show(cursor_t *cursor, image_t *image, image_zoom_t zoom,
                 display_t *display);

/**
 * @brief Hide cursor shown on display
 *
 * @param cursor
 * @param image image to map image coords to screen coords
 * @param zoom zoom to map image coords to screen coords
 * @param display
 */
void cursor_hide(cursor_t *cursor, image_t *image, image_zoom_t zoom,
                 display_t *display);

#endif // __CURSOR_H__
Do not follow this link