Skip to content

Instantly share code, notes, and snippets.

@kroovysteph
Created December 11, 2016 11:45
Show Gist options
  • Save kroovysteph/6b9a32dfa7369615f335748ba0afa61d to your computer and use it in GitHub Desktop.
Save kroovysteph/6b9a32dfa7369615f335748ba0afa61d to your computer and use it in GitHub Desktop.
Image* make_image(int width, int height, int bytes_per_pixel) {
// todo: implement
if (width == 0 || height == 0) return NULL;
Image* i = xmalloc(sizeof(Image));
i->width = width;
i->height = height;
i->bytes_per_pixel = bytes_per_pixel;
i->data = xmalloc(sizeof(Byte) * bytes_per_pixel * width * height);
clear_image(i);
return i;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment