summaryrefslogtreecommitdiff
path: root/FrameRender/P_TransformCenter.c
blob: 538843744e8d78bef6f21b8ad3b77565f2bc94c2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include "P_TransformCenter.h"
#include "PixelCallback.h"
#include <stdlib.h>
#include <string.h>

void TransformCenter_callback(TransformCenter* self, struct PixelContext* pc) {
	pc->x -= self->centerX;
	pc->y -= self->centerY;
}

PixelCallback* TransformCenter_setup(TransformCenter obj) {
	PixelCallback* pca = malloc(sizeof(struct PixelCallback));

	pca->callback = (PixelCallback_callback)TransformCenter_callback;
	pca->callback_self = malloc(sizeof(obj));
	memcpy(pca->callback_self, &obj, sizeof(obj));

	return pca;
}