Index: FL/Enumerations.H
===================================================================
--- FL/Enumerations.H	(revision 8512)
+++ FL/Enumerations.H	(working copy)
@@ -907,9 +907,14 @@
   FL_FAKE_SINGLE = 512	// Fake single buffered windows using double-buffer
 };
 
-// image alpha blending
+//#define FL_IMAGE_WITH_ALPHA 0x40000000  // image alpha blending
 
-#define FL_IMAGE_WITH_ALPHA 0x40000000
+/** Image data formats */
+enum Fl_Image_Data_Format {
+  FL_IMAGE_DATA_RGB = 0, /**< RGB format without alpha information. */
+  FL_IMAGE_DATA_RGBA = 1, /**< RGBA format with alpha information as last byte. */
+  FL_IMAGE_DATA_LA = 2  /**< luminance and then alpha. */
+};
 
 /** Damage masks */
 enum Fl_Damage {
Index: FL/fl_draw.H
===================================================================
--- FL/fl_draw.H	(revision 8443)
+++ FL/fl_draw.H	(working copy)
@@ -631,12 +631,14 @@
   \param[in] X,Y position where to put top-left corner of image
   \param[in] W,H size of the image
   \param[in] D   delta to add to the pointer between pixels. it may be
-                 any value greater than or equal to 3, or it can be
+                 any value greater than or equal to 1, or it can be
 		 negative to flip the image horizontally
   \param[in] L   delta to add to the pointer between lines (if 0 is
                  passed it uses \p W * \p D), and may be larger than
 		 \p W * \p D to crop data, or negative to flip the
 		 image vertically
+ \param[in] format  this parameter of type \ref Fl_Image_Data_Format 
+		  indicates the format of the image data.
 
   It is highly recommended that you put the following code before the
   first <tt>show()</tt> of \e any window in your program to get rid of
@@ -656,16 +658,22 @@
   draw the image in the current visual it will abort. FLTK supports
   any visual of 8 bits or less, and all common TrueColor visuals up
   to 32 bits.
+ 
+ \par Note: 
+ Format values other than FL_IMAGE_DATA_RGB are presently implemented 
+ for the Mac OS platform only.
   */
-inline void fl_draw_image(const uchar* buf, int X,int Y,int W,int H, int D=3, int L=0)
-  { fl_graphics_driver->draw_image(buf, X, Y, W, H, D, L); }
+inline void fl_draw_image(const uchar* buf, int X,int Y,int W,int H, int D=3, int L=0, 
+			   int format=0)
+{ fl_graphics_driver->draw_image(buf, X, Y, W, H, D, L, format); }
 
 /**
   Draw a gray-scale (1 channel) image.
-  \see fl_draw_image(const uchar* buf, int X,int Y,int W,int H, int D, int L)
+  \see fl_draw_image(const uchar* buf, int X,int Y,int W,int H, int D, int L, int format)
   */
-inline void fl_draw_image_mono(const uchar* buf, int X,int Y,int W,int H, int D=1, int L=0)
-  { fl_graphics_driver->draw_image_mono(buf, X, Y, W, H, D, L); }
+inline void fl_draw_image_mono(
+	      const uchar* buf, int X,int Y,int W,int H, int D=1, int L=0, int format=0)
+  { fl_graphics_driver->draw_image_mono(buf, X, Y, W, H, D, L, format); }
 
 /**
   Draw image using callback function to generate image data.
Index: FL/Fl_Device.H
===================================================================
--- FL/Fl_Device.H	(revision 8488)
+++ FL/Fl_Device.H	(working copy)
@@ -201,8 +201,8 @@
   friend void fl_clip_region(Fl_Region r);
   friend void fl_restore_clip();
   
-  friend void fl_draw_image(const uchar* buf, int X,int Y,int W,int H, int D, int L);
-  friend void fl_draw_image_mono(const uchar* buf, int X,int Y,int W,int H, int D, int L);
+  friend void fl_draw_image(const uchar* buf, int X,int Y,int W,int H, int D, int L, int format);
+  friend void fl_draw_image_mono(const uchar* buf, int X,int Y,int W,int H, int D, int L, int format);
   friend void fl_draw_image(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D);
   friend FL_EXPORT void fl_draw_image_mono(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D);
   friend FL_EXPORT void gl_start();
@@ -334,9 +334,9 @@
   
   // Images
   /** \brief see fl_draw_image(const uchar* buf, int X,int Y,int W,int H, int D, int L). */
-  virtual   void draw_image(const uchar* buf, int X,int Y,int W,int H, int D=3, int L=0) = 0;
+  virtual   void draw_image(const uchar* buf, int X,int Y,int W,int H, int D=3, int L=0, int format=0) = 0;
   /** \brief see fl_draw_image_mono(const uchar* buf, int X,int Y,int W,int H, int D, int L). */
-  virtual   void draw_image_mono(const uchar* buf, int X,int Y,int W,int H, int D=1, int L=0) = 0;
+  virtual   void draw_image_mono(const uchar* buf, int X,int Y,int W,int H, int D=1, int L=0, int format=0) = 0;
   /** \brief see fl_draw_image(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D). */
   virtual   void draw_image(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D=3) = 0;
   /** \brief see fl_draw_image_mono(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D). */
@@ -412,9 +412,9 @@
   void draw(Fl_Pixmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy);
   void draw(Fl_Bitmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy);
   void draw(Fl_RGB_Image *img, int XP, int YP, int WP, int HP, int cx, int cy);
-  void draw_image(const uchar* buf, int X,int Y,int W,int H, int D=3, int L=0);
+  void draw_image(const uchar* buf, int X,int Y,int W,int H, int D=3, int L=0, int format=0);
   void draw_image(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D=3);
-  void draw_image_mono(const uchar* buf, int X,int Y,int W,int H, int D=1, int L=0);
+  void draw_image_mono(const uchar* buf, int X,int Y,int W,int H, int D=1, int L=0, int format=0);
   void draw_image_mono(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D=1);
   double width(const char *str, int n);
   double width(unsigned int c);
@@ -442,9 +442,9 @@
   void draw(Fl_Pixmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy);
   void draw(Fl_Bitmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy);
   void draw(Fl_RGB_Image *img, int XP, int YP, int WP, int HP, int cx, int cy);
-  void draw_image(const uchar* buf, int X,int Y,int W,int H, int D=3, int L=0);
+  void draw_image(const uchar* buf, int X,int Y,int W,int H, int D=3, int L=0, int format=0);
   void draw_image(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D=3);
-  void draw_image_mono(const uchar* buf, int X,int Y,int W,int H, int D=1, int L=0);
+  void draw_image_mono(const uchar* buf, int X,int Y,int W,int H, int D=1, int L=0, int format=0);
   void draw_image_mono(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D=1);
   double width(const char *str, int n);
   double width(unsigned int c);
@@ -472,9 +472,9 @@
   void draw(Fl_Pixmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy);
   void draw(Fl_Bitmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy);
   void draw(Fl_RGB_Image *img, int XP, int YP, int WP, int HP, int cx, int cy);
-  void draw_image(const uchar* buf, int X,int Y,int W,int H, int D=3, int L=0);
+  void draw_image(const uchar* buf, int X,int Y,int W,int H, int D=3, int L=0, int format=0);
   void draw_image(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D=3);
-  void draw_image_mono(const uchar* buf, int X,int Y,int W,int H, int D=1, int L=0);
+  void draw_image_mono(const uchar* buf, int X,int Y,int W,int H, int D=1, int L=0, int format=0);
   void draw_image_mono(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D=1);
   double width(const char *str, int n);
   double width(unsigned int c);
Index: FL/Fl_PostScript.H
===================================================================
--- FL/Fl_PostScript.H	(revision 8467)
+++ FL/Fl_PostScript.H	(working copy)
@@ -192,8 +192,10 @@
   void end_complex_polygon(){end_polygon();};
   void transformed_vertex(double x, double y);
     
-  void draw_image(const uchar* d, int x,int y,int w,int h, int delta=3, int ldelta=0){draw_scaled_image(d,x,y,w,h,w,h,delta,ldelta);};
-  void draw_image_mono(const uchar* d, int x,int y,int w,int h, int delta=1, int ld=0){draw_scaled_image_mono(d,x,y,w,h,w,h,delta,ld);};
+  void draw_image(const uchar* d, int x,int y,int w,int h, int delta=3, int ldelta=0, int format=0) {
+    draw_scaled_image(d,x,y,w,h,w,h,delta,ldelta);};
+  void draw_image_mono(const uchar* d, int x,int y,int w,int h, int delta=1, int ld=0, int format=0){
+    draw_scaled_image_mono(d,x,y,w,h,w,h,delta,ld);};
   void draw_image(Fl_Draw_Image_Cb call, void* data, int x,int y, int w, int h, int delta=3){draw_scaled_image(call,data, x, y, w, h, w, h, delta);};
   void draw_image_mono(Fl_Draw_Image_Cb call, void* data, int x,int y, int w, int h, int delta=1){draw_scaled_image_mono(call, data, x, y, w, h, w, h, delta);};
       
Index: src/fl_draw_image.cxx
===================================================================
--- src/fl_draw_image.cxx	(revision 8287)
+++ src/fl_draw_image.cxx	(working copy)
@@ -543,14 +543,14 @@
   }
 }
 
-void Fl_Xlib_Graphics_Driver::draw_image(const uchar* buf, int x, int y, int w, int h, int d, int l){
+void Fl_Xlib_Graphics_Driver::draw_image(const uchar* buf, int x, int y, int w, int h, int d, int l, int format){
   innards(buf,x,y,w,h,d,l,(d<3&&d>-3),0,0);
 }
 void Fl_Xlib_Graphics_Driver::draw_image(Fl_Draw_Image_Cb cb, void* data,
 		   int x, int y, int w, int h,int d) {
   innards(0,x,y,w,h,d,0,(d<3&&d>-3),cb,data);
 }
-void Fl_Xlib_Graphics_Driver::draw_image_mono(const uchar* buf, int x, int y, int w, int h, int d, int l){
+void Fl_Xlib_Graphics_Driver::draw_image_mono(const uchar* buf, int x, int y, int w, int h, int d, int l, int format){
   innards(buf,x,y,w,h,d,l,1,0,0);
 }
 void Fl_Xlib_Graphics_Driver::draw_image_mono(Fl_Draw_Image_Cb cb, void* data,
Index: src/fl_draw_image_mac.cxx
===================================================================
--- src/fl_draw_image_mac.cxx	(revision 8351)
+++ src/fl_draw_image_mac.cxx	(working copy)
@@ -58,7 +58,7 @@
  */
 static void innards(const uchar *buf, int X, int Y, int W, int H,
 		    int delta, int linedelta, int mono,
-		    Fl_Draw_Image_Cb cb, void* userdata)
+		    Fl_Draw_Image_Cb cb, void* userdata, int format)
 {
   if (!linedelta) linedelta = W*delta;
 
@@ -87,9 +87,15 @@
   CGDataProviderRef src = CGDataProviderCreateWithData( 0L, array, linedelta*H, 
 						       tmpBuf ? dataReleaseCB : NULL
 						       );
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
+  CGBitmapInfo bitmapInfo;
+#else
+  CGImageAlphaInfo bitmapInfo;
+#endif
+  if (delta % 2 == 0 && (format == FL_IMAGE_DATA_RGBA || format == FL_IMAGE_DATA_LA)) bitmapInfo = kCGImageAlphaLast;
+  else bitmapInfo = kCGImageAlphaNone;
   CGImageRef        img = CGImageCreate( W, H, 8, 8*delta, linedelta,
-                            //lut, delta&1?kCGImageAlphaNone:kCGImageAlphaNoneSkipLast,
-                            lut, delta&1?kCGImageAlphaNone:kCGImageAlphaLast,
+			      lut, bitmapInfo,
                             src, 0L, false, kCGRenderingIntentDefault);
   // draw the image into the destination context
   if (img) {
@@ -147,19 +153,21 @@
   CGContextSetShouldAntialias(fl_gc, true);
 }
 
-void Fl_Quartz_Graphics_Driver::draw_image(const uchar* buf, int x, int y, int w, int h, int d, int l){
-  innards(buf,x,y,w,h,d,l,(d<3&&d>-3),0,0);
+void Fl_Quartz_Graphics_Driver::draw_image(const uchar* buf, int x, int y, int w, int h, int d, int l, 
+					    int format){
+  innards(buf,x,y,w,h,d,l,(d<3&&d>-3),0,0, format);
 }
 void Fl_Quartz_Graphics_Driver::draw_image(Fl_Draw_Image_Cb cb, void* data,
 		   int x, int y, int w, int h,int d) {
-  innards(0,x,y,w,h,d,0,(d<3&&d>-3),cb,data);
+  innards(0,x,y,w,h,d,0,(d<3&&d>-3),cb,data,0);
 }
-void Fl_Quartz_Graphics_Driver::draw_image_mono(const uchar* buf, int x, int y, int w, int h, int d, int l){
-  innards(buf,x,y,w,h,d,l,1,0,0);
+void Fl_Quartz_Graphics_Driver::draw_image_mono(const uchar* buf, int x, int y, int w, int h, int d, int l,
+						int format){
+  innards(buf,x,y,w,h,d,l,1,0,0,format);
 }
 void Fl_Quartz_Graphics_Driver::draw_image_mono(Fl_Draw_Image_Cb cb, void* data,
 		   int x, int y, int w, int h,int d) {
-  innards(0,x,y,w,h,d,0,1,cb,data);
+  innards(0,x,y,w,h,d,0,1,cb,data,0);
 }
 
 void fl_rectf(int x, int y, int w, int h, uchar r, uchar g, uchar b) {
Index: src/Fl_Image.cxx
===================================================================
--- src/Fl_Image.cxx	(revision 8287)
+++ src/Fl_Image.cxx	(working copy)
@@ -500,7 +500,8 @@
     img->id_ = fl_create_offscreen(img->w(), img->h());
     if ((img->d() == 2 || img->d() == 4) && fl_can_do_alpha_blending()) {
       fl_begin_offscreen((Fl_Offscreen)img->id_);
-      fl_draw_image(img->array, 0, 0, img->w(), img->h(), img->d()|FL_IMAGE_WITH_ALPHA, img->ld());
+      fl_draw_image(img->array, 0, 0, img->w(), img->h(), img->d(), img->ld(), 
+		    img->d() == 4 ? FL_IMAGE_DATA_RGBA : FL_IMAGE_DATA_LA);
       fl_end_offscreen();
     } else {
       fl_begin_offscreen((Fl_Offscreen)img->id_);
Index: src/fl_draw_image_win32.cxx
===================================================================
--- src/fl_draw_image_win32.cxx	(revision 8294)
+++ src/fl_draw_image_win32.cxx	(working copy)
@@ -287,10 +287,12 @@
 }
 
 static int fl_abs(int v) { return v<0 ? -v : v; }
-
-void Fl_GDI_Graphics_Driver::draw_image(const uchar* buf, int x, int y, int w, int h, int d, int l){
-  if (fl_abs(d)&FL_IMAGE_WITH_ALPHA) {
-    d ^= FL_IMAGE_WITH_ALPHA;
+void Fl_GDI_Graphics_Driver::draw_image(
+		const uchar* buf, int x, int y, int w, int h, int d, int l, int format) {
+  
+  //if (fl_abs(d)&FL_IMAGE_WITH_ALPHA) {
+    //d ^= FL_IMAGE_WITH_ALPHA;
+  if (format == FL_IMAGE_DATA_RGBA) {
     innards(buf,x,y,w,h,d,l,fl_abs(d),0,0);
   } else {
     innards(buf,x,y,w,h,d,l,(d<3&&d>-3),0,0);
@@ -299,17 +301,19 @@
 
 void Fl_GDI_Graphics_Driver::draw_image(Fl_Draw_Image_Cb cb, void* data,
 		   int x, int y, int w, int h,int d) {
-  if (fl_abs(d)&FL_IMAGE_WITH_ALPHA) {
+  /*if (fl_abs(d)&FL_IMAGE_WITH_ALPHA) {
     d ^= FL_IMAGE_WITH_ALPHA;
     innards(0,x,y,w,h,d,0,(d<3&&d>-3),cb,data);
-  } else {
+  } else {*/
     innards(0,x,y,w,h,d,0,(d<3&&d>-3),cb,data);
-  }
+ // }
 }
 
-void Fl_GDI_Graphics_Driver::draw_image_mono(const uchar* buf, int x, int y, int w, int h, int d, int l){
-  if (fl_abs(d)&FL_IMAGE_WITH_ALPHA) {
-    d ^= FL_IMAGE_WITH_ALPHA;
+void Fl_GDI_Graphics_Driver::draw_image_mono(
+		const uchar* buf, int x, int y, int w, int h, int d, int l, int format){
+  //if (fl_abs(d)&FL_IMAGE_WITH_ALPHA) {
+    //d ^= FL_IMAGE_WITH_ALPHA;
+  if (format == FL_IMAGE_DATA_LA) {
     innards(buf,x,y,w,h,d,l,1,0,0);
   } else {
     innards(buf,x,y,w,h,d,l,1,0,0);
@@ -318,12 +322,12 @@
 
 void Fl_GDI_Graphics_Driver::draw_image_mono(Fl_Draw_Image_Cb cb, void* data,
 		   int x, int y, int w, int h,int d) {
-  if (fl_abs(d)&FL_IMAGE_WITH_ALPHA) {
+  /*if (fl_abs(d)&FL_IMAGE_WITH_ALPHA) {
     d ^= FL_IMAGE_WITH_ALPHA;
     innards(0,x,y,w,h,d,0,1,cb,data);
-  } else {
+  } else {*/
     innards(0,x,y,w,h,d,0,1,cb,data);
-  }
+  //}
 }
 
 void fl_rectf(int x, int y, int w, int h, uchar r, uchar g, uchar b) {
Index: documentation/src/drawing.dox
===================================================================
--- documentation/src/drawing.dox	(revision 8241)
+++ documentation/src/drawing.dox	(working copy)
@@ -752,8 +752,8 @@
 should only draw images when the matrix is set to the identity.
 
 \anchor drawing_fl_draw_image
-void fl_draw_image(const uchar *buf,int X,int Y,int W,int H,int D,int L)<br>
-void fl_draw_image_mono(const uchar *buf,int X,int Y,int W,int H,int D,int L)
+void fl_draw_image(const uchar *buf,int X,int Y,int W,int H,int D,int L,int format)<br>
+void fl_draw_image_mono(const uchar *buf,int X,int Y,int W,int H,int D,int L,int format)
 
 \par
 Draw an 8-bit per color RGB or luminance image.  The pointer
@@ -762,7 +762,7 @@
 The top left corner is given by \p X and \p Y
 and the size of the image is given by \p W and \p H.
 \p D is the delta to add to the pointer between pixels,
-it may be any value greater or equal to \p 3,
+it may be any value greater or equal to \p 1,
 or it can be negative to flip the image horizontally.
 \p L is the delta to add to the pointer between lines
 (if 0 is passed it uses \p W*D).
