base.Initialize( orig, false );
}
+ [MonoTODO]
private Bitmap (SerializationInfo info, StreamingContext context) {
throw new NotImplementedException ();
}
internal Bitmap (java.awt.Image nativeObject, ImageFormat format)
:base (nativeObject, format) {}
+ [MonoTODO]
private Bitmap (java.awt.Image nativeObject, ImageFormat format, PixelFormat pixFormat)
:this (nativeObject, format) {
if (pixFormat != this.PixelFormat)
public Bitmap (string filename)
:this (filename, false) {}
+ [MonoTODO]
public Bitmap (Stream stream, bool useIcm)
:this (stream, useIcm, null) {}
+ [MonoTODO]
public Bitmap (string filename, bool useIcm)
:this (filename, useIcm, null) {}
}
internal Bitmap (string filename, bool useIcm, ImageFormat format) {
- // TBD: useIcm param
- java.io.File file = vmw.common.IOUtils.getJavaFile (filename);
- if (!file.exists ())
- throw new System.IO.FileNotFoundException (filename);
- Initialize (new stream.FileImageInputStream (file), format);
+ using(FileStream stream = new FileStream(filename, FileMode.Open, FileAccess.Read)) {
+ // TBD: useIcm param
+ io.InputStream jis = vmw.common.IOUtils.ToInputStream (stream);
+ Initialize (new stream.MemoryCacheImageInputStream (jis), format);
+ }
}
public Bitmap (Type type, string resource) {
}
}
#if INTPTR_SUPPORT
+ [MonoTODO]
public Bitmap (int width, int height, int stride, PixelFormat format, IntPtr scan0)
{
throw new NotImplementedException();
protected override void InternalSave (stream.ImageOutputStream output, Guid clsid) {
ImageCodec ic = ImageCodec.CreateWriter( clsid );
-
- // .net saves in png if cannot find requested encoder. act id 316563
- if (ic == null)
- ic = ImageCodec.CreateWriter( ImageFormat.Png );
-
- if (ic == null)
- throw new NotSupportedException("The requested format encoder is not supported");
-
using (ic) {
PlainImage plainImage = CurrentImage;
public Bitmap Clone (RectangleF rect, PixelFormat pixFormat)
{
- PlainImage plainImage = CurrentImage.Clone(false);\r
- BufferedImage clone = new BufferedImage( (int)rect.Width, (int)rect.Height, ToBufferedImageFormat( pixFormat ) );\r
- awt.Graphics2D g = clone.createGraphics();\r
- try {\r
- g.drawImage( NativeObject, -(int)rect.X, -(int)rect.Y, null );\r
- }\r
- finally {\r
- g.dispose();\r
- }\r
-\r
- plainImage.NativeImage = clone;\r
- return new Bitmap(plainImage);\r
+ PlainImage plainImage = CurrentImage.Clone(false);
+ BufferedImage clone = new BufferedImage( (int)rect.Width, (int)rect.Height, ToBufferedImageFormat( pixFormat ) );
+ awt.Graphics2D g = clone.createGraphics();
+ try {
+ g.drawImage( NativeObject, -(int)rect.X, -(int)rect.Y, null );
+ }
+ finally {
+ g.dispose();
+ }
+
+ plainImage.NativeImage = clone;
+ return new Bitmap(plainImage);
}
#endregion
#region LockBits
- // TBD: implement this
+ [MonoTODO]
public BitmapData LockBits (Rectangle rect, ImageLockMode flags, PixelFormat format) {
throw new NotImplementedException();
}
#region MakeTransparent
public void MakeTransparent ()
{
- Color clr = GetPixel(0,0);
+ Color clr = Color.FromArgb(0,0,0);
MakeTransparent (clr);
}
public void MakeTransparent (Color transparentColor)
{
- byte A = transparentColor.A;
image.WritableRaster raster = NativeObject.getRaster();
int numBands = raster.getNumBands();
+ if (numBands != 4)
+ return;
+
int maxWidth = raster.getWidth() + raster.getMinX();
int maxHeight = raster.getHeight() + raster.getMinY();
int[] srcPix = new int[numBands];
for (int y = raster.getMinY(); y < maxHeight; y++) {
for (int x = raster.getMinX(); x < maxWidth; x++) {
/*srcPix =*/ raster.getPixel(x, y, srcPix);
- for (int z = 0; z < numBands; z++) {
- int argb = srcPix[z];
- if ((uint)argb >> 24 == A) {
- argb &= 0x00FFFFFF;
- srcPix[z] = argb;
- }
+ if (srcPix[0] == transparentColor.R &&
+ srcPix[1] == transparentColor.G &&
+ srcPix[2] == transparentColor.B) {
+ srcPix[3] = 0;
+ raster.setPixel(x, y, srcPix);
}
}
}
#endregion
#region UnlockBits
- // TBD: implement this
+ [MonoTODO]
public void UnlockBits (BitmapData bitmap_data)
{
throw new NotImplementedException();
#endregion
#if INTPTR_SUPPORT
+ [MonoTODO]
public static Bitmap FromHicon (IntPtr hicon)
{
throw new NotImplementedException();
}
+ [MonoTODO]
public static Bitmap FromResource (IntPtr hinstance, string bitmapName) //TBD: Untested
{
throw new NotImplementedException();
}
+ [MonoTODO]
public IntPtr GetHbitmap ()
{
throw new NotImplementedException();
}
+ [MonoTODO]
public IntPtr GetHbitmap (Color background)
{
throw new NotImplementedException();
}
+ [MonoTODO]
public IntPtr GetHicon ()
{
throw new NotImplementedException();