Root/eeshow/gfx/misc.h

1/*
2 * gfx/misc.h - Helper functions for geometry and attributes
3 *
4 * Written 2016 by Werner Almesberger
5 * Copyright 2016 Werner Almesberger
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13
14#ifndef GFX_MISC_H
15#define GFX_MISC_H
16
17#include <stdbool.h>
18
19
20static inline int mxr(int x, int y, const int m[6])
21{
22    return x * m[1] + y * m[2];
23}
24
25
26static inline int myr(int x, int y, const int m[6])
27{
28    return x * m[4] + y * m[5];
29}
30
31
32static inline int mx(int x, int y, const int m[6])
33{
34    return m[0] + mxr(x, y, m);
35}
36
37
38static inline int my(int x, int y, const int m[6])
39{
40    return m[3] + myr(x, y, m);
41}
42
43
44unsigned matrix_to_angle(const int m[6]);
45bool matrix_is_mirrored(const int m[6]);
46int angle_add(int a, int b);
47
48int rx(int x, int y, int rot);
49int ry(int x, int y, int rot);
50
51#endif /* !GFX_MISC_H */
52

Archive Download this file

Branches:
master



interactive