#include "P_Circle.h"
#include "PixelCallback.h"
#include <stdlib.h>
#include <string.h>

void Circle_callback(Circle* self, struct PixelContext* fc) {
	if (fc->x * fc->x + fc->y *fc->y <= self->radius * self->radius) {
		ARGB_merge(&fc->pixel, self->color);
	}
}

PixelCallback* Circle_setup(Circle obj) {
	PixelCallback* pca = malloc(sizeof(struct PixelCallback));

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

	return pca;
}
