started implementing intersection functions and the main renderer data
[cyberay] / src / image.c
diff --git a/src/image.c b/src/image.c
new file mode 100644 (file)
index 0000000..b685a8a
--- /dev/null
@@ -0,0 +1,17 @@
+#include <imago2.h>
+#include "image.h"
+
+int load_image(struct image *img, const char *fname)
+{
+       if(!(img->pixels = img_load_pixels(fname, &img->width, &img->height, IMG_FMT_RGBF))) {
+               fprintf(stderr, "load_image: failed to load %s\n", fname);
+               return -1;
+       }
+       return 0;
+}
+
+void destroy_image(struct image *img)
+{
+       img_free_pixels(img->pixels);
+       img->pixels = 0;
+}