diff options
Diffstat (limited to 'AnimationObject.c')
| -rw-r--r-- | AnimationObject.c | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/AnimationObject.c b/AnimationObject.c index 87fe324..63594ce 100644 --- a/AnimationObject.c +++ b/AnimationObject.c @@ -3,76 +3,76 @@ #include <stdlib.h> ARGB -AO_CheckerPattern(const Animation* anim, u32 frameIndex, ARGB pixel, i32 r, i32 c, void* priv) { - struct AO_CheckerPattern chp = *(struct AO_CheckerPattern*)priv; +AO_CheckerPattern(const Animation* anim, PixelRendererParams a) { + struct AO_CheckerPattern chp = *(struct AO_CheckerPattern*)a.priv; - r /= chp.squareSize; - c /= chp.squareSize; + a.row /= chp.squareSize; + a.col /= chp.squareSize; - if ((r + c) % 2 == 0) { - ARGB_set(&pixel, 0xFF000000); + if ((a.row + a.col) % 2 == 0) { + ARGB_set(&a.pixel, 0xFF000000); } else { - ARGB_set(&pixel, 0xFFFF00FF); + ARGB_set(&a.pixel, 0xFFFF00FF); } - return pixel; + return a.pixel; } ARGB -AO_Square(const Animation* anim, u32 frameIndex, ARGB pixel, i32 r, i32 c, void* priv) { - struct AO_Square* set = (struct AO_Square*)priv; +AO_Square(const Animation* anim, PixelRendererParams a) { + struct AO_Square* set = (struct AO_Square*)a.priv; - if (0 <= r && r <= set->width && 0 <= c && c <= set->height) { - ARGB_set(&pixel, set->color); + if (0 <= a.row && a.row <= set->width && 0 <= a.col && a.col <= set->height) { + ARGB_set(&a.pixel, set->color); } - return pixel; + return a.pixel; } ARGB -AO_Circle(const Animation* anim, u32 frameIndex, ARGB pixel, i32 r, i32 c, void* priv) { - struct AO_Circle* cir = (struct AO_Circle*)priv; +AO_Circle(const Animation* anim, PixelRendererParams a) { + struct AO_Circle* cir = (struct AO_Circle*)a.priv; - if (r * r + c * c < cir->radius * cir->radius) { - ARGB_set(&pixel, cir->color); + if (a.row * a.row + a.col * a.col < cir->radius * cir->radius) { + ARGB_set(&a.pixel, cir->color); } - return pixel; + return a.pixel; } ARGB -AO_Image(const Animation* anim, u32 frameIndex, ARGB pixel, i32 r, i32 c, void* priv) { - struct AO_Image img = *(struct AO_Image*)priv; +AO_Image(const Animation* anim, PixelRendererParams a) { + struct AO_Image img = *(struct AO_Image*)a.priv; if (img.noRepeat == true && - (c < 0 || img.img.width * img.zoom <= c || - r < 0 || img.img.height * img.zoom <= r)) + (a.col < 0 || img.img.width * img.zoom <= a.col || + a.row < 0 || img.img.height * img.zoom <= a.row)) { - return pixel; + return a.pixel; } - return *RGBImage_at(*(RGBImage*)priv, r / img.zoom, c / img.zoom); + return *RGBImage_at(*(RGBImage*)a.priv, a.row / img.zoom, a.col / img.zoom); } ARGB -AO_Line(const Animation* anim, u32 frameIndex, ARGB pixel, i32 r, i32 c, void* priv) { - struct AO_Line l = *(struct AO_Line*)priv; +AO_Line(const Animation* anim, PixelRendererParams a) { + struct AO_Line l = *(struct AO_Line*)a.priv; - if (fabs(l.a * c + l.b * r + l.c) / sqrt(l.a * l.a + l.b * l.b) < l.width) { - ARGB_set(&pixel, l.color); + if (fabs(l.a * a.col + l.b * a.row + l.c) / sqrt(l.a * l.a + l.b * l.b) < l.width) { + ARGB_set(&a.pixel, l.color); } - return pixel; + return a.pixel; } ARGB -AO_HorSegment(const Animation* anim, u32 frameIndex, ARGB pixel, i32 r, i32 c, void* priv) { - struct AO_HorSegment hs = *(struct AO_HorSegment*)priv; +AO_HorSegment(const Animation* anim, PixelRendererParams a) { + struct AO_HorSegment hs = *(struct AO_HorSegment*)a.priv; - if (abs(r) <= hs.width && hs.left <= c && c <= hs.right) { - ARGB_set(&pixel, hs.color); + if (abs(a.row) <= hs.width && hs.left <= a.col && a.col <= hs.right) { + ARGB_set(&a.pixel, hs.color); } - return pixel; + return a.pixel; } |
