- img->bitmap = CreateBitmap(width, height, 1 /* plane */ ,
+ /* create the bitmap with the same number of planes as the default display
+ * (otherwise it wouldn't work for 16 color mode) */
+ img->bitmap = CreateBitmap(width, height,
+ GetDeviceCaps(*d, PLANES),