diff options
| author | Syndamia <kamen@syndamia.com> | 2026-03-28 21:13:27 +0200 |
|---|---|---|
| committer | Syndamia <kamen@syndamia.com> | 2026-03-28 21:13:27 +0200 |
| commit | 6a63e2c0e1f37c502501e1b611e8dc289476c1f2 (patch) | |
| tree | 6721b5aa27ad7bbb64901eb7e6d9bc84d0a92d6e /FrameRender/P_TransformRotate.c | |
| parent | d31239eeeac4ea595b1d1e7063ab5d762809fb02 (diff) | |
| download | ppm_graphics-6a63e2c0e1f37c502501e1b611e8dc289476c1f2.tar ppm_graphics-6a63e2c0e1f37c502501e1b611e8dc289476c1f2.tar.gz ppm_graphics-6a63e2c0e1f37c502501e1b611e8dc289476c1f2.zip | |
feat: Add Checker, Image, Circle; properly handle transparency
Diffstat (limited to 'FrameRender/P_TransformRotate.c')
| -rw-r--r-- | FrameRender/P_TransformRotate.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/FrameRender/P_TransformRotate.c b/FrameRender/P_TransformRotate.c new file mode 100644 index 0000000..562c814 --- /dev/null +++ b/FrameRender/P_TransformRotate.c @@ -0,0 +1,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; +} |
