diff options
| author | Syndamia <kamen@syndamia.com> | 2026-03-28 20:33:03 +0200 |
|---|---|---|
| committer | Syndamia <kamen@syndamia.com> | 2026-03-28 20:33:03 +0200 |
| commit | d31239eeeac4ea595b1d1e7063ab5d762809fb02 (patch) | |
| tree | aa0d5f426a2dc439ad863b9e3ec017c5776f528e /FrameRender/P_Square.c | |
| parent | 56099072165578b505a6c81e187cf392b9bd5a2e (diff) | |
| download | ppm_graphics-d31239eeeac4ea595b1d1e7063ab5d762809fb02.tar ppm_graphics-d31239eeeac4ea595b1d1e7063ab5d762809fb02.tar.gz ppm_graphics-d31239eeeac4ea595b1d1e7063ab5d762809fb02.zip | |
feat!: Complete rewrite
This new scheme will be much simpler
Diffstat (limited to 'FrameRender/P_Square.c')
| -rw-r--r-- | FrameRender/P_Square.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/FrameRender/P_Square.c b/FrameRender/P_Square.c new file mode 100644 index 0000000..7865370 --- /dev/null +++ b/FrameRender/P_Square.c @@ -0,0 +1,22 @@ +#include "P_Square.h" +#include "PixelCallback.h" +#include <stdlib.h> +#include <string.h> + +void Square_callback(Square* self, struct PixelContext* fc) { + if (0 <= fc->x && fc->x <= self->width && + 0 <= fc->y && fc->y <= self->height) + { + ARGB_set(&fc->pixel, self->color); + } +} + +PixelCallback* Square_setup(Square obj) { + PixelCallback* pca = malloc(sizeof(struct PixelCallback)); + + pca->callback = (PixelCallback_callback)Square_callback; + pca->callback_self = malloc(sizeof(obj)); + memcpy(pca->callback_self, &obj, sizeof(obj)); + + return pca; +} |
