blob: 78653705537215b2b7d89c991664f8d8b7c4efae (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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;
}
|