Well, I guess my freeloading days are over ;)  I need to
get some code into the Bitmap and Graphics classes, which
currently are just stubs. Looking at the datestamps, it
appears these classes haven't been touched in a while so
I have just gone ahead and started editing.

These patches stub in the methods that I need and clean
up Bitmap.cs in preparation for coding (adding [MonoTODO],
etc.)

Jason
379
--- Bitmap.cs.old       2003-02-14 10:58:33.000000000 -0500
+++ Bitmap.cs   2003-02-14 10:54:07.000000000 -0500
@@ -1,9 +1,11 @@
 //
 // System.Drawing.Bitmap.cs
 //
-// (C) 2002 Ximian, Inc.  http://www.ximian.com
-// Author: Christian Meyer
-// eMail: [EMAIL PROTECTED]
+// (C) 2002 Ximian, Inc.  http://www.ximian.com
+//
+// Authors:
+//   Christian Meyer ([EMAIL PROTECTED])
+//   Jason Perkins ([EMAIL PROTECTED])
 //
 // No implementation has been done yet. I first want to write the method
 // headers of every System.Drawing.
@@ -16,11 +18,14 @@
 //C:\cygwin\usr\local\mcs\class\System.Drawing\System.Drawing\Bitmap.cs(54,20): 
warning CS0649: Field 'System.Drawing.BITMAPINFO.colorpalette' is never assigned to, 
and will always have its default value null
 // 2002-03-27  Christian Meyer  <[EMAIL PROTECTED]>
 // I'll have a closer look at it next week.
-//
-using System;
+//
+
+using System;
+using System.Drawing.Imaging;
 using System.IO;
 
 namespace System.Drawing {
+
        struct BITMAPFILEHEADER {        // File info header
                public uint bfType;      // Specifies the type of file. This member 
must be BM.
                public uint bfSize;      // Specifies the size of the file, in bytes.
@@ -29,6 +34,7 @@
                public uint bfOffBits;   // Specifies the byte offset from the 
BITMAPFILEHEADER
                                          // structure to the actual bitmap data in 
the file.
        }
+
        struct BITMAPINFOHEADER {        // bitmap info header
                public uint   biSize;
                public int    biWidth;
@@ -49,10 +55,12 @@
                public byte rgbRed;
                public byte rgbReserved;
        }
+
        struct BITMAPINFO {              // bitmap info
                public BITMAPINFOHEADER bitmapinfoheader;
                public RGBQUAD[] colorpalette;
        }
+
        // I do not think pinning is needed execpt for when locked
        // Is layout packed attribute needed here?
        struct bitmapstruct {
@@ -62,11 +70,18 @@
                public BITMAPINFO       info;           //bitmap info
                public byte[,]          bits;           //Actual bitmap bits
        }
-       public sealed class Bitmap : Image {
+
+       [MonoTODO]
+       public sealed class Bitmap : Image, IDisposable 
+       {
+               
                // TODO: add following to an enum  with BI_RLE4 and BI_RLE8
                const int BI_RGB = 0;                   //? 0 is from example;
+               
                bitmapstruct bitmap = new bitmapstruct();
-               private void CommonInit (int width, int height) {
+               
+               private void CommonInit (int width, int height) 
+               {
                        // Init BITMAPFILEHANDLE
                        // document I am working from says tyoe must allways be "BM",
                        // the example has this set to 19778.
@@ -129,148 +144,189 @@
                        bitmap.info.bitmapinfoheader.biYPelsPerMeter = 0;
                        bitmap.bits = new byte[width*4, height];
                }
+               
                #region constructors
-               // constructors
-               public Bitmap (int width, int height) {
+               
+               [MonoTODO]
+               public Bitmap (int width, int height) 
+               {
                        CommonInit (width, height);
                }
-
-               public Bitmap (int width, int height, Graphics g) {
+
+               [MonoTODO]
+               public Bitmap (int width, int height, Graphics g) 
+               {
                        //TODO: Error check X,Y
                        CommonInit (width,height);
                        //TODO: use graphics to set vertial and horzontal resolution.
                        //TODO: that is all the spec requires or desires
                }
-
-//             public Bitmap (int width, int heigth, PixelFormat format) {
-//                     if ((int)format != BI_RGB) {
-//                             throw new NotImplementedException ();
-//                     }
-//                     CommonInit (width, heigth);
-//             }
-//
-//             public Bitmap (Image origial) {
-//                     throw new NotImplementedException ();
-//                     //this.original = original;
-//             }
-
-               public Bitmap (Stream stream) {
+
+               [MonoTODO]
+               public Bitmap (int width, int height, PixelFormat format) 
+               {
                        throw new NotImplementedException ();
-                       //this.stream = stream;
                }
-
-               public Bitmap (string filename) {
+
+               [MonoTODO]
+               public Bitmap (Image origial) 
+               {
                        throw new NotImplementedException ();
-                       //this.filename = filename;
+                       //this.original = original;
                }
-
-               public Bitmap (Image original, Size newSize) {
+
+               [MonoTODO]
+               public Bitmap (Stream stream) 
+               {
                        throw new NotImplementedException ();
-                       //this.original = original;
-                       //this.newSize = newSize;
                }
-
-               public Bitmap (Stream stream, bool useIcm) {
+
+               [MonoTODO]
+               public Bitmap (string filename) 
+               {
                        throw new NotImplementedException ();
-                       //this.stream = stream;
-                       //this.useIcm = useIcm;
                }
-
-               public Bitmap (string filename, bool useIcm) {
+
+               [MonoTODO]
+               public Bitmap (Image original, Size newSize) 
+               {
                        throw new NotImplementedException ();
-                       //this.filename = filename;
-                       //this.useIcm = useIcm;
                }
-
-               public Bitmap (Type type, string resource) {
+
+               [MonoTODO]
+               public Bitmap (Stream stream, bool useIcm) 
+               {
                        throw new NotImplementedException ();
-                       //this.type = type;
-                       //this.resource = resource;
                }
-
-               public Bitmap (Image original, int width, int heigth) {
+
+               [MonoTODO]
+               public Bitmap (string filename, bool useIcm) 
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public Bitmap (Type type, string resource) 
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public Bitmap (Image original, int width, int heigth) 
+               {
                        throw new NotImplementedException ();
-                       //this.original = original;
-                       //this.width = width;
-                       //this.heigth = heigth;
                }
 
-
-//             public Bitmap (int width, int height, int stride,
-//                            PixelFormat format, IntPtr scan0) {
-//                     throw new NotImplementedException ();
-//                     //this.width = width;
-//                     //this.heigth = heigth;
-//                     //this.stride = stride;
-//                     //this.format = format;
-//                     //this.scan0 = scan0;
-//             }
+
+               [MonoTODO]
+               public Bitmap (int width, int height, int stride, PixelFormat format, 
+IntPtr scan0) 
+               {
+                       throw new NotImplementedException ();
+               }
+
                #endregion
-               // methods
-               public Color GetPixel (int x, int y) {
+
+               [MonoTODO]
+               public Color GetPixel (int x, int y) 
+               {
                        //TODO: Error check X,Y
                        return Color.FromArgb (bitmap.bits[x,y], bitmap.bits[x+1,y], 
bitmap.bits[x+2,y], bitmap.bits[x+3,y]);
                }
-
-               public void SetPixel (int x, int y, Color color) {
+
+               [MonoTODO]
+               public void SetPixel (int x, int y, Color color) 
+               {
                        //TODO: Error check X,Y
                        bitmap.bits[x, y]     = color.A;
                        bitmap.bits[x + 1, y] = color.R;
                        bitmap.bits[x + 2, y] = color.G;
                        bitmap.bits[x + 2, y] = color.B;
                }
-
-//             public Bitmap Clone (Rectangle rect,PixelFormat format) {
-//                     throw new NotImplementedException ();
-//             }
-//             
-//             public Bitmap Clone (RectangleF rect, PixelFormat format) {
-//                     throw new NotImplementedException ();
-//             }
-
-               public static Bitmap FromHicon (IntPtr hicon) {
+
+               [MonoTODO]
+               public Bitmap Clone (Rectangle rect,PixelFormat format) 
+               {
                        throw new NotImplementedException ();
                }
-
-               public static Bitmap FromResource (IntPtr hinstance,
-                                                  string bitmapName) {
+               
+               [MonoTODO]
+               public Bitmap Clone (RectangleF rect, PixelFormat format) 
+               {
                        throw new NotImplementedException ();
                }
-
-               public IntPtr GetHbitmap () {
+
+               public void Dispose()
+               {
+               }
+               
+               [MonoTODO]
+               public static Bitmap FromHicon (IntPtr hicon) 
+               {
                        throw new NotImplementedException ();
                }
-
-               public IntPtr GetHbitmap (Color background) {
+
+               [MonoTODO]
+               public static Bitmap FromResource (IntPtr hinstance, string 
+bitmapName) 
+               {
                        throw new NotImplementedException ();
                }
-
-               public IntPtr GetHicon () {
+
+               [MonoTODO]
+               public IntPtr GetHbitmap () 
+               {
                        throw new NotImplementedException ();
                }
-
-//             public BitmapData LockBits (Rectangle rect, ImageLockMode flags,
-//                                         PixelFormat format) {
-//                     throw new NotImplementedException ();
-//             }
-
-               public void MakeTransparent () {
+
+               [MonoTODO]
+               public IntPtr GetHbitmap (Color background) 
+               {
                        throw new NotImplementedException ();
                }
-
-               public void MakeTransparent (Color transparentColor) {
+
+               [MonoTODO]
+               public IntPtr GetHicon () 
+               {
                        throw new NotImplementedException ();
                }
-
-               public void SetResolution (float xDpi, float yDpi) {
+
+               [MonoTODO]
+               public BitmapData LockBits (Rectangle rect, ImageLockMode flags, 
+PixelFormat format) 
+               {
                        throw new NotImplementedException ();
                }
-
-//             public void UnlockBits (BitmapData bitmapdata) {
-//                     throw new NotImplementedException ();
-//             }
-
-               // properties
-               // needs to be done ###FIXME###
+
+               [MonoTODO]
+               public void MakeTransparent () 
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public void MakeTransparent (Color transparentColor) 
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public PixelFormat PixelFormat
+               {
+                       get 
+                       {
+                               throw new NotImplementedException ();
+                       }
+               }
+                       
+               [MonoTODO]
+               public void SetResolution (float xDpi, float yDpi) 
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public void UnlockBits (BitmapData bitmapdata) 
+               {
+                       throw new NotImplementedException ();
+               }
+
        }
 }
--- Graphics.cs.old     2003-02-14 10:58:33.000000000 -0500
+++ Graphics.cs 2003-02-14 10:54:32.000000000 -0500
@@ -21,7 +21,13 @@
                {
                        throw new NotImplementedException ();
                }
-
+
+               [MonoTODO]
+               public void DrawImage(Image image, int x, int y, int width, int height)
+               {
+                       throw new NotImplementedException ();
+               }
+               
                [MonoTODO]
                public static Graphics FromHwnd (IntPtr hwnd)
                {
@@ -38,6 +44,12 @@
                public static Graphics FromHdc (IntPtr hdc, IntPtr hdevice)
                {
                        throw new NotImplementedException ();
+               }
+               
+               [MonoTODO]
+               public static Graphics FromImage (Image image)
+               {
+                       throw new NotImplementedException ();
                }
        }
 }

Reply via email to