forked from sackmotion/motion
-
Notifications
You must be signed in to change notification settings - Fork 1
/
rotate.h
67 lines (62 loc) · 1.6 KB
/
rotate.h
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
/*
* rotate.h
*
* Include file for handling image rotation.
*
* Copyright 2004-2005, Per Jonsson ([email protected])
*
* This software is distributed under the GNU Public license
* Version 2. See also the file 'COPYING'.
*/
#ifndef _INCLUDE_ROTATE_H
#define _INCLUDE_ROTATE_H
#include "motion.h" /* for struct context */
/**
* rotate_init
*
* Sets up rotation data by allocating a temporary buffer for 90/270 degrees
* rotation, and by determining the right rotate-180-degrees function.
*
* Parameters:
*
* cnt - current thread's context structure
*
* Returns: nothing
*/
void rotate_init(struct context *cnt);
/**
* rotate_deinit
*
* Frees memory allocated by rotate_init.
*
* Parameters:
*
* cnt - current thread's context structure
*/
void rotate_deinit(struct context *cnt);
/**
* rotate_map
*
* Rotates the image stored in map according to the rotation data
* available in cnt. Rotation is performed clockwise. Supports 90,
* 180 and 270 degrees rotation. 180 degrees rotation is performed
* in-place by simply reversing the image data, which is a very
* fast operation. 90 and 270 degrees rotation are performed using
* a temporary buffer and a somewhat more complicated algorithm,
* which makes them slower.
*
* Note that to the caller, all rotations will seem as they are
* performed in-place.
*
* Parameters:
*
* map - the image map/data to rotate
* cnt - current thread's context structure
*
* Returns:
*
* 0 - success
* -1 - failure (rare, shouldn't happen)
*/
int rotate_map(struct context *cnt, unsigned char *map);
#endif