blob: 562c81472dc3f9814b4a411f2aa1113ea1b71dbd (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
#include "P_TransformRotate.h"
#include "PixelCallback.h"
#include <math.h>
#include <stdlib.h>
#include <string.h>
void TransformRotate_callback(TransformRotate* self, struct PixelContext* pc) {
u32 xR = pc->x * cos(self->angle) + pc->y * sin(self->angle);
u32 yR = - pc->x * sin(self->angle) + pc->y * cos(self->angle);
pc->x = xR;
pc->y = yR;
}
PixelCallback* TransformRotate_setup(TransformRotate obj) {
PixelCallback* pca = malloc(sizeof(struct PixelCallback));
pca->callback = (PixelCallback_callback)TransformRotate_callback;
pca->callback_self = malloc(sizeof(obj));
memcpy(pca->callback_self, &obj, sizeof(obj));
return pca;
}
|