dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-pnet-commits] pnetlib/System.Drawing Icon.cs, 1.2, 1.3 Image.cs,


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] pnetlib/System.Drawing Icon.cs, 1.2, 1.3 Image.cs, 1.5, 1.6
Date: Mon, 29 Sep 2003 00:23:51 +0000

Update of /cvsroot/dotgnu-pnet/pnetlib/System.Drawing
In directory subversions:/tmp/cvs-serv23638/System.Drawing

Modified Files:
        Icon.cs Image.cs 
Log Message:


ECMA fixes.


Index: Icon.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System.Drawing/Icon.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Icon.cs     28 Sep 2003 21:57:29 -0000      1.2
--- Icon.cs     29 Sep 2003 00:23:49 -0000      1.3
***************
*** 34,169 ****
  #endif
  
!               public sealed class Icon : MarshalByRefObject, ISerializable, 
ICloneable
!               {
!                       private byte[] data;
!                       private Size size;
  
!                       public IntPtr Handle
!                       {
!                               get
!                               {
!                                       // Not used in this implementation
!                                       return IntPtr.Zero;
!                               }
!                       }
  
!                       public int Height
!                       {
!                               get
!                               {
!                                       return size.Height;
!                               }
!                       }
  
!                       public Size Size
!                       {
!                               get
!                               {
!                                       return size;
!                               }
!                       }
  
!                       public int Width
!                       {
!                               get
!                               {
!                                       return size.Width;
!                               }
!                       }
  
!                       public Icon(string fileName)
!                       {
!                               using (FileStream fileStream = new 
FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.Read))
!                               {
!                                       data = new byte[fileStream.Length];
!                                       fileStream.Read(data, 0, data.Length);
!                               }
!                               SetSizeFromData();
!                       }
  
!                       public Icon(Icon original, Size size) : this(original, 
size.Width, size.Height)
!                       {}
  
!                       public Icon(Icon original, int width, int height)
!                       {
!                               data = original.data;
!                               if (data == null)
!                                       size = original.Size;
!                               else
!                                       size = new Size(width, height);
!                       }
  
!                       public Icon(Type type, string resource)
!                       {
!                               using(Stream stream = 
type.Module.Assembly.GetManifestResourceStream(type, resource))
!                               {
!                                       data = new byte[stream.Length];
!                                       stream.Read(data, 0, data.Length);
!                               }
!                               SetSizeFromData();
!                       }
  
!                       public Icon(Stream stream)
!                       {
!                               data = new byte[stream.Length];
!                               stream.Read(data, 0, data.Length);
!                       }
  
!                       public Icon(Stream stream, int width, int height)
!                       {
!                               data = new byte[stream.Length];
!                               stream.Read(data, 0, data.Length);
!                               size = new Size(width, height);
!                       }
  
!                       [TODO]
!                       private void SetSizeFromData()
!                       {
!                       }
  
!                       object ICloneable.Clone()
!                       {
!                               return new System.Drawing.Icon(this, Width, 
Height);
!                       }
  
!                       public static Icon FromHandle(IntPtr handle)
!                       {
!                               // Not implemented
!                               return null;
!                       }
  
!                       public void Save(Stream outputStream)
!                       {
!                               outputStream.Write(data, 0, data.Length);
!                       }
  
!                       public Bitmap ToBitmap()
!                       {
!                               Bitmap bitmap = new Bitmap(Size.Width, 
Size.Height);
!                               using(Graphics graphics = 
Graphics.FromImage(bitmap))
!                                       graphics.DrawIcon(this, new 
Rectangle(0, 0, Size.Width, Size.Height));
!                               bitmap.MakeTransparent(Color.FromArgb(13, 11, 
12));
!                               return bitmap;
!                       }
  
!                       public override string ToString()
!                       {
!                               return "Icon: " + Width + ", " + Height;
!                       }
  
  #if CONFIG_SERIALIZATION
!                       void ISerializable.GetObjectData(SerializationInfo si, 
StreamingContext context)
!                       {
!                               if (data != null)
!                                       si.AddValue("IconData", data, 
typeof(byte[]));
!                               else
!                               {
!                                       MemoryStream memoryStream = new 
MemoryStream();
!                                       Save(memoryStream);
!                                       si.AddValue("IconData", 
memoryStream.ToArray(), typeof(byte[]));
!                               }
!                               si.AddValue("IconSize", size, typeof(Size));
!                       }
! #endif
                }
  }; // namespace System.Drawing
--- 34,175 ----
  #endif
  
! public sealed class Icon : MarshalByRefObject, ICloneable
! #if CONFIG_SERIALIZATION
!       , ISerializable
! #endif
! {
!       private byte[] data;
!       private Size size;
  
!       public IntPtr Handle
!       {
!               get
!               {
!                       // Not used in this implementation
!                       return IntPtr.Zero;
!               }
!       }
  
!       public int Height
!       {
!               get
!               {
!                       return size.Height;
!               }
!       }
  
!       public Size Size
!       {
!               get
!               {
!                       return size;
!               }
!       }
  
!       public int Width
!       {
!               get
!               {
!                       return size.Width;
!               }
!       }
  
!       public Icon(string fileName)
!       {
!               using (FileStream fileStream = new FileStream(fileName, 
FileMode.Open, FileAccess.Read, FileShare.Read))
!               {
!                       data = new byte[fileStream.Length];
!                       fileStream.Read(data, 0, data.Length);
!               }
!               SetSizeFromData();
!       }
  
!       public Icon(Icon original, Size size) : this(original, size.Width, 
size.Height)
!       {}
  
!       public Icon(Icon original, int width, int height)
!       {
!               data = original.data;
!               if (data == null)
!                       size = original.Size;
!               else
!                       size = new Size(width, height);
!       }
  
! #if !ECMA_COMPAT
!       public Icon(Type type, string resource)
!       {
!               using(Stream stream = 
type.Module.Assembly.GetManifestResourceStream(type, resource))
!               {
!                       data = new byte[stream.Length];
!                       stream.Read(data, 0, data.Length);
!               }
!               SetSizeFromData();
!       }
! #endif
  
!       public Icon(Stream stream)
!       {
!               data = new byte[stream.Length];
!               stream.Read(data, 0, data.Length);
!       }
  
!       public Icon(Stream stream, int width, int height)
!       {
!               data = new byte[stream.Length];
!               stream.Read(data, 0, data.Length);
!               size = new Size(width, height);
!       }
  
!       [TODO]
!       private void SetSizeFromData()
!       {
!       }
  
!       object ICloneable.Clone()
!       {
!               return new System.Drawing.Icon(this, Width, Height);
!       }
  
!       public static Icon FromHandle(IntPtr handle)
!       {
!               // Not implemented
!               return null;
!       }
  
!       public void Save(Stream outputStream)
!       {
!               outputStream.Write(data, 0, data.Length);
!       }
  
!       public Bitmap ToBitmap()
!       {
!               Bitmap bitmap = new Bitmap(Size.Width, Size.Height);
!               using(Graphics graphics = Graphics.FromImage(bitmap))
!                       graphics.DrawIcon(this, new Rectangle(0, 0, Size.Width, 
Size.Height));
!               bitmap.MakeTransparent(Color.FromArgb(13, 11, 12));
!               return bitmap;
!       }
  
!       public override string ToString()
!       {
!               return "Icon: " + Width + ", " + Height;
!       }
  
  #if CONFIG_SERIALIZATION
!       void ISerializable.GetObjectData(SerializationInfo si, StreamingContext 
context)
!       {
!               if (data != null)
!                       si.AddValue("IconData", data, typeof(byte[]));
!               else
!               {
!                       MemoryStream memoryStream = new MemoryStream();
!                       Save(memoryStream);
!                       si.AddValue("IconData", memoryStream.ToArray(), 
typeof(byte[]));
                }
+               si.AddValue("IconSize", size, typeof(Size));
+       }
+ #endif
+ }
+ 
  }; // namespace System.Drawing

Index: Image.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System.Drawing/Image.cs,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** Image.cs    4 Sep 2003 22:24:20 -0000       1.5
--- Image.cs    29 Sep 2003 00:23:49 -0000      1.6
***************
*** 88,92 ****
--- 88,94 ----
                                pixelFormat = 
(System.Drawing.Imaging.PixelFormat)
                                        (dgImage.PixelFormat);
+ #if !ECMA_COMPAT
                                frameDimensionsList = new Guid[0];
+ #endif
                        }
  #if CONFIG_SERIALIZATION





reply via email to

[Prev in Thread] Current Thread [Next in Thread]