[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] pnetlib/System.Drawing Bitmap.cs, 1.7, 1.8 Image.c
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] pnetlib/System.Drawing Bitmap.cs, 1.7, 1.8 Image.cs, 1.6, 1.7 |
Date: |
Thu, 02 Oct 2003 04:00:40 +0000 |
Update of /cvsroot/dotgnu-pnet/pnetlib/System.Drawing
In directory subversions:/tmp/cvs-serv11737/System.Drawing
Modified Files:
Bitmap.cs Image.cs
Log Message:
Hook the new image code into "System.Drawing.Image" and "System.Drawing.Xsharp".
Index: Bitmap.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System.Drawing/Bitmap.cs,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** Bitmap.cs 29 Sep 2003 03:56:38 -0000 1.7
--- Bitmap.cs 2 Oct 2003 04:00:37 -0000 1.8
***************
*** 23,26 ****
--- 23,27 ----
using System.IO;
+ using System.Security;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
***************
*** 42,98 ****
{
// Constructors.
- [TODO]
public Bitmap(Image original)
! {
! dgImage = (DotGNU.Images.Image)dgImage.Clone();
! }
public Bitmap(Image original, Size newSize)
! : this (original, newSize.Width, newSize.Height)
! {}
public Bitmap(Stream stream) : this(stream, false) {}
-
public Bitmap(Stream stream, bool useIcm)
{
! // TODO Icm
! dgImage = new DotGNU.Images.Image();
dgImage.Load(stream);
}
public Bitmap(String filename) : this(filename, false) {}
-
public Bitmap(String filename, bool useIcm)
{
! // TODO Icm
! dgImage = new DotGNU.Images.Image();
dgImage.Load(filename);
}
public Bitmap(int width, int height)
: this(width, height,
Imaging.PixelFormat.Format32bppArgb) {}
-
public Bitmap(int width, int height,
System.Drawing.Imaging.PixelFormat format)
{
! dgImage = new DotGNU.Images.Image(width, height,
! (DotGNU.Images.PixelFormat)format);
}
- [TODO]
public Bitmap(int width, int height, Graphics g)
{
! // TODO
}
- [TODO]
public Bitmap(Type type, String resource)
{
! // TODO
}
- [TODO]
public Bitmap(Image original, int width, int height)
{
! // TODO
}
- [TODO]
public Bitmap(int width, int height, int stride,
System.Drawing.Imaging.PixelFormat format,
IntPtr scan0)
{
! // TODO
}
internal Bitmap(DotGNU.Images.Image image) : base(image) {}
--- 43,114 ----
{
// Constructors.
public Bitmap(Image original)
! : this(original, original.Width, original.Height) {}
public Bitmap(Image original, Size newSize)
! : this (original, newSize.Width, newSize.Height) {}
public Bitmap(Stream stream) : this(stream, false) {}
public Bitmap(Stream stream, bool useIcm)
{
! DotGNU.Images.Image dgImage = new
DotGNU.Images.Image();
dgImage.Load(stream);
+ SetDGImage(dgImage);
}
public Bitmap(String filename) : this(filename, false) {}
public Bitmap(String filename, bool useIcm)
{
! DotGNU.Images.Image dgImage = new
DotGNU.Images.Image();
dgImage.Load(filename);
+ SetDGImage(dgImage);
}
public Bitmap(int width, int height)
: this(width, height,
Imaging.PixelFormat.Format32bppArgb) {}
public Bitmap(int width, int height,
System.Drawing.Imaging.PixelFormat format)
{
! SetDGImage(new DotGNU.Images.Image
! (width, height,
(DotGNU.Images.PixelFormat)format));
! dgImage.AddFrame();
}
public Bitmap(int width, int height, Graphics g)
{
! if(g == null)
! {
! throw new ArgumentNullException("g");
! }
! SetDGImage(new DotGNU.Images.Image
! (width, height,
DotGNU.Images.PixelFormat.Format32bppArgb));
! dgImage.AddFrame();
}
public Bitmap(Type type, String resource)
{
! Stream stream =
type.Module.Assembly.GetManifestResourceStream
! (resource);
! if(stream == null)
! {
! throw new
ArgumentException(S._("Arg_UnknownResource"));
! }
! try
! {
! DotGNU.Images.Image dgImage = new
DotGNU.Images.Image();
! dgImage.Load(stream);
! SetDGImage(dgImage);
! }
! finally
! {
! stream.Close();
! }
}
public Bitmap(Image original, int width, int height)
{
! if(original.dgImage != null)
! {
!
SetDGImage(original.dgImage.Stretch(width, height));
! }
}
public Bitmap(int width, int height, int stride,
System.Drawing.Imaging.PixelFormat format,
IntPtr scan0)
{
! // We don't support loading bitmaps from
unmanaged buffers.
! throw new SecurityException();
}
internal Bitmap(DotGNU.Images.Image image) : base(image) {}
***************
*** 119,135 ****
// Create a bitmap from a native icon handle.
- [TODO]
public static Bitmap FromHicon(IntPtr hicon)
{
! // TODO
! return null;
}
// Create a bitmap from a Windows resource name.
- [TODO]
public static Bitmap FromResource(IntPtr hinstance, String bitmapName)
{
! // TODO
! return null;
}
--- 135,147 ----
// Create a bitmap from a native icon handle.
public static Bitmap FromHicon(IntPtr hicon)
{
! throw new SecurityException();
}
// Create a bitmap from a Windows resource name.
public static Bitmap FromResource(IntPtr hinstance, String bitmapName)
{
! throw new SecurityException();
}
***************
*** 148,153 ****
public IntPtr GetHbitmap(Color background)
{
! // TODO
! return IntPtr.Zero;
}
--- 160,164 ----
public IntPtr GetHbitmap(Color background)
{
! throw new SecurityException();
}
***************
*** 159,181 ****
public IntPtr GetHicon()
{
! // TODO
! return IntPtr.Zero;
}
// Get the color of a specific pixel.
- [TODO]
public Color GetPixel(int x, int y)
{
! // TODO
return Color.Empty;
}
// Lock a region of this bitmap.
- [TODO]
public BitmapData LockBits(Rectangle rect, ImageLockMode flags,
System.Drawing.Imaging.PixelFormat format)
{
! // TODO
! return null;
}
--- 170,195 ----
public IntPtr GetHicon()
{
! throw new SecurityException();
}
// Get the color of a specific pixel.
public Color GetPixel(int x, int y)
{
! if(dgImage != null)
! {
! int pix =
dgImage.GetFrame(0).GetPixel(x, y);
! return Color.FromArgb((pix >> 16) &
0xFF,
!
(pix >> 8) & 0xFF,
!
pix & 0xFF);
! }
return Color.Empty;
}
// Lock a region of this bitmap.
public BitmapData LockBits(Rectangle rect, ImageLockMode flags,
System.Drawing.Imaging.PixelFormat format)
{
! // Don't use this: it isn't portable.
! return new BitmapData();
}
***************
*** 192,199 ****
// Set a pixel within this bitmap.
- [TODO]
public void SetPixel(int x, int y, Color color)
{
! // TODO
}
--- 206,216 ----
// Set a pixel within this bitmap.
public void SetPixel(int x, int y, Color color)
{
! if(dgImage != null)
! {
! dgImage.GetFrame(0).SetPixel
! (x, y, (color.R << 16) |
(color.G << 8) | color.B);
! }
}
***************
*** 206,213 ****
// Unlock the bits within this bitmap.
- [TODO]
public void UnlockBits(BitmapData bitmapData)
{
! // TODO
}
--- 223,229 ----
// Unlock the bits within this bitmap.
public void UnlockBits(BitmapData bitmapData)
{
! // Nothing to do in this implementation.
}
Index: Image.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System.Drawing/Image.cs,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** Image.cs 29 Sep 2003 00:23:49 -0000 1.6
--- Image.cs 2 Oct 2003 04:00:37 -0000 1.7
***************
*** 56,94 ****
// Constructors.
! [TODO]
! internal Image()
! {
! // TODO
! }
internal Image(DotGNU.Images.Image dgImage)
{
! flags = 0;
! #if !ECMA_COMPAT
! switch(dgImage.LoadFormat)
! {
! case DotGNU.Images.Image.Png:
! rawFormat = ImageFormat.Png;
break;
! case DotGNU.Images.Image.Jpeg:
! rawFormat = ImageFormat.Jpeg;
break;
! case DotGNU.Images.Image.Gif:
! rawFormat = ImageFormat.Gif;
break;
! case DotGNU.Images.Image.Tiff:
! rawFormat = ImageFormat.Tiff;
break;
! case DotGNU.Images.Image.Bmp:
! rawFormat = ImageFormat.Bmp;
break;
! case DotGNU.Images.Image.Icon:
! rawFormat = ImageFormat.Icon;
break;
! }
! #endif
! this.dgImage = dgImage;
! width = dgImage.Width;
! height = dgImage.Height;
! horizontalResolution =
Graphics.DefaultScreenDpi;
! verticalResolution = Graphics.DefaultScreenDpi;
! pixelFormat =
(System.Drawing.Imaging.PixelFormat)
! (dgImage.PixelFormat);
! #if !ECMA_COMPAT
! frameDimensionsList = new Guid[0];
! #endif
}
#if CONFIG_SERIALIZATION
--- 56,63 ----
// Constructors.
! internal Image() {}
internal Image(DotGNU.Images.Image dgImage)
{
! SetDGImage(dgImage);
}
#if CONFIG_SERIALIZATION
***************
*** 460,463 ****
--- 429,463 ----
#endif
+
+ // Set the dgImage field within this object.
+ internal void SetDGImage(DotGNU.Images.Image dgImage)
+ {
+ flags = 0;
+ #if !ECMA_COMPAT
+ switch(dgImage.LoadFormat)
+ {
+ case DotGNU.Images.Image.Png:
+ rawFormat = ImageFormat.Png;
break;
+ case DotGNU.Images.Image.Jpeg:
+ rawFormat = ImageFormat.Jpeg;
break;
+ case DotGNU.Images.Image.Gif:
+ rawFormat = ImageFormat.Gif;
break;
+ case DotGNU.Images.Image.Tiff:
+ rawFormat = ImageFormat.Tiff;
break;
+ case DotGNU.Images.Image.Bmp:
+ rawFormat = ImageFormat.Bmp;
break;
+ case DotGNU.Images.Image.Icon:
+ rawFormat = ImageFormat.Icon;
break;
+ }
+ frameDimensionsList = new Guid [0];
+ #endif
+ this.dgImage = dgImage;
+ width = dgImage.Width;
+ height = dgImage.Height;
+ horizontalResolution =
Graphics.DefaultScreenDpi;
+ verticalResolution = Graphics.DefaultScreenDpi;
+ pixelFormat =
(System.Drawing.Imaging.PixelFormat)
+ (dgImage.PixelFormat);
+ }
}; // class Image
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] pnetlib/System.Drawing Bitmap.cs, 1.7, 1.8 Image.cs, 1.6, 1.7,
Rhys Weatherley <address@hidden> <=