+/* for MS-DOS/Allegro, exclude all except newImage() and freeImage() */
+
+Image *newImage(unsigned int width, unsigned int height, unsigned int depth)
+{
+ Image *image;
+ const unsigned int bytes_per_pixel = 1;
+ int i;
+
+ if (depth > 8)
+ Error(ERR_EXIT, "images with more than 256 colors are not supported");
+
+ depth = 8;
+ image = checked_malloc(sizeof(Image));
+ image->data = checked_malloc(width * height * bytes_per_pixel);
+ image->width = width;
+ image->height = height;
+ image->depth = depth;
+ image->rgb.used = 0;
+ for (i=0; i<MAX_COLORS; i++)
+ image->rgb.color_used[i] = FALSE;
+
+ return image;
+}
+
+void freeImage(Image *image)
+{
+ free(image->data);
+ free(image);
+}
+
+#if defined(PLATFORM_UNIX)