#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
typedef struct {
size_t width;
size_t height;
unsigned char *data;
} Image;
static Image *image_new (size_t width,size_t height){
Image *image;
image = malloc (sizeof *image);
image->width = width;
image->height = height;
image->data = malloc (width * height);
return image;
}
static void image_free (Image *image){
free (image->data);
free (image);
}
static void image_fill (Image *image,unsigned char value){
memset (image->data, value, image->width * image->height);
}
/**
* image_set_pixel:
* Sets a pixel passed in signed (x, y) coordinates, where (0,0) is at
* the center of the image.
**/
static void image_set_pixel(Image *image,
&
#include <stdlib.h>
#include <string.h>
#include <math.h>
typedef struct {
size_t width;
size_t height;
unsigned char *data;
} Image;
static Image *image_new (size_t width,size_t height){
Image *image;
image = malloc (sizeof *image);
image->width = width;
image->height = height;
image->data = malloc (width * height);
return image;
}
static void image_free (Image *image){
free (image->data);
free (image);
}
static void image_fill (Image *image,unsigned char value){
memset (image->data, value, image->width * image->height);
}
/**
* image_set_pixel:
* Sets a pixel passed in signed (x, y) coordinates, where (0,0) is at
* the center of the image.
**/
static void image_set_pixel(Image *image,
&