Author: andrews
Date: 2005-08-03 09:54:01 -0400 (Wed, 03 Aug 2005)
New Revision: 47959
Added:
trunk/mcs/class/System.Drawing/System.Drawing.Imaging/EncoderParameter.jvm.cs
trunk/mcs/class/System.Drawing/System.Drawing.Imaging/ImageAttributes.jvm.cs
trunk/mcs/class/System.Drawing/System.Drawing.Imaging/ImageCodecInfo.jvm.cs
trunk/mcs/class/System.Drawing/System.Drawing.Imaging/ImageFormat.jvm.cs
Modified:
trunk/mcs/class/System.Drawing/System.Drawing.Imaging/ChangeLog
trunk/mcs/class/System.Drawing/System.Drawing.Imaging/ColorPalette.cs
trunk/mcs/class/System.Drawing/System.Drawing.Imaging/EncoderParameters.cs
trunk/mcs/class/System.Drawing/System.Drawing.Imaging/FrameDimension.cs
Log:
* ColorPalette.cs, FrameDimension.cs, EncoderParameters.cs: TARGET_JVM
exclude not supported internal methods
* EncoderParameter.jvm.cs, ImageAttributes.jvm.cs, ImageFormat.jvm.cs,
ImageCodecInfo.jvm.cs: added TARGET_JVM implementation of these classes
Modified: trunk/mcs/class/System.Drawing/System.Drawing.Imaging/ChangeLog
===================================================================
--- trunk/mcs/class/System.Drawing/System.Drawing.Imaging/ChangeLog
2005-08-03 13:48:31 UTC (rev 47958)
+++ trunk/mcs/class/System.Drawing/System.Drawing.Imaging/ChangeLog
2005-08-03 13:54:01 UTC (rev 47959)
@@ -1,3 +1,10 @@
+2005-08-03 Andrew Skiba <[EMAIL PROTECTED]>
+
+ * ColorPalette.cs, FrameDimension.cs, EncoderParameters.cs: TARGET_JVM
+ exclude not supported internal methods
+ * EncoderParameter.jvm.cs, ImageAttributes.jvm.cs, ImageFormat.jvm.cs,
+ ImageCodecInfo.jvm.cs: added TARGET_JVM implementation of these classes
+
2005-03-23 Jordi Mas i Hernandez <[EMAIL PROTECTED]>
* ColorPalette.cs: fixes ColorPalette marshaling
Modified: trunk/mcs/class/System.Drawing/System.Drawing.Imaging/ColorPalette.cs
===================================================================
--- trunk/mcs/class/System.Drawing/System.Drawing.Imaging/ColorPalette.cs
2005-08-03 13:48:31 UTC (rev 47958)
+++ trunk/mcs/class/System.Drawing/System.Drawing.Imaging/ColorPalette.cs
2005-08-03 13:54:01 UTC (rev 47959)
@@ -70,7 +70,7 @@
return flags;
}
}
-
+#if !TARGET_JVM
/* Caller should call FreeHGlobal*/
internal IntPtr getGDIPalette()
{
@@ -111,5 +111,6 @@
ptr = (IntPtr) (ptr.ToInt32() + 4);
}
}
+#endif
}
}
Added:
trunk/mcs/class/System.Drawing/System.Drawing.Imaging/EncoderParameter.jvm.cs
===================================================================
---
trunk/mcs/class/System.Drawing/System.Drawing.Imaging/EncoderParameter.jvm.cs
2005-08-03 13:48:31 UTC (rev 47958)
+++
trunk/mcs/class/System.Drawing/System.Drawing.Imaging/EncoderParameter.jvm.cs
2005-08-03 13:54:01 UTC (rev 47959)
@@ -0,0 +1,173 @@
+//
+// System.Drawing.Imaging.EncoderParameter.cs
+//
+// Author:
+// Ravindra ([EMAIL PROTECTED])
+// Vladimir Vukicevic ([EMAIL PROTECTED])
+//
+// (C) 2004 Novell, Inc. http://www.novell.com
+//
+
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Text;
+
+using System.Runtime.InteropServices;
+
+namespace System.Drawing.Imaging {
+
+ public sealed class EncoderParameter : IDisposable {
+
+ private Encoder encoder;
+ private int valuesCount;
+ private EncoderParameterValueType type;
+
+ internal EncoderParameter ()
+ {
+ }
+
+ public EncoderParameter (Encoder encoder, byte value)
+ {
+ throw new NotImplementedException();
+ }
+
+ public EncoderParameter (Encoder encoder, byte[] value)
+ {
+ throw new NotImplementedException();
+ }
+
+ public EncoderParameter (Encoder encoder, short value)
+ {
+ throw new NotImplementedException();
+ }
+
+ public EncoderParameter (Encoder encoder, short[] value)
+ {
+ throw new NotImplementedException();
+ }
+
+
+ public EncoderParameter (Encoder encoder, long value)
+ {
+ throw new NotImplementedException();
+ }
+
+ public EncoderParameter (Encoder encoder, long[] value)
+ {
+ throw new NotImplementedException();
+ }
+
+ public EncoderParameter (Encoder encoder, string value)
+ {
+ throw new NotImplementedException();
+ }
+
+ public EncoderParameter (Encoder encoder, byte value, bool
undefined)
+ {
+ throw new NotImplementedException();
+ }
+
+ public EncoderParameter (Encoder encoder, byte[] value, bool
undefined)
+ {
+ throw new NotImplementedException();
+ }
+
+ public EncoderParameter (Encoder encoder, int numerator, int
denominator)
+ {
+ throw new NotImplementedException();
+ }
+
+ public EncoderParameter (Encoder encoder, int[] numerator,
int[] denominator)
+ {
+ throw new NotImplementedException();
+ }
+
+ public EncoderParameter (Encoder encoder, long rangebegin, long
rangeend)
+ {
+ throw new NotImplementedException();
+ }
+
+ public EncoderParameter (Encoder encoder, long[] rangebegin,
long[] rangeend)
+ {
+ throw new NotImplementedException();
+ }
+
+ public EncoderParameter (Encoder encoder, int numberOfValues,
int type, int value)
+ {
+ throw new NotImplementedException();
+ }
+
+ public EncoderParameter (Encoder encoder, int numerator1, int
denominator1, int numerator2, int denominator2)
+ {
+ throw new NotImplementedException();
+ }
+
+ public EncoderParameter (Encoder encoder, int[] numerator1,
int[] denominator1, int[] numerator2, int[] denominator2)
+ {
+ throw new NotImplementedException();
+ }
+
+ public Encoder Encoder {
+ get {
+ return encoder;
+ }
+
+ set {
+ encoder = value;
+ }
+ }
+
+ public int NumberOfValues {
+ get {
+ return valuesCount;
+ }
+ }
+
+ public EncoderParameterValueType Type {
+ get {
+ return type;
+ }
+ }
+
+ public EncoderParameterValueType ValueType {
+ get {
+ return type;
+ }
+ }
+
+ void Dispose (bool disposing) {
+ throw new NotImplementedException();
+ }
+
+ public void Dispose () {
+ Dispose (true);
+ }
+
+ ~EncoderParameter () {
+ Dispose (false);
+ }
+
+ }
+}
Property changes on:
trunk/mcs/class/System.Drawing/System.Drawing.Imaging/EncoderParameter.jvm.cs
___________________________________________________________________
Name: svn:executable
+ *
Modified:
trunk/mcs/class/System.Drawing/System.Drawing.Imaging/EncoderParameters.cs
===================================================================
--- trunk/mcs/class/System.Drawing/System.Drawing.Imaging/EncoderParameters.cs
2005-08-03 13:48:31 UTC (rev 47958)
+++ trunk/mcs/class/System.Drawing/System.Drawing.Imaging/EncoderParameters.cs
2005-08-03 13:54:01 UTC (rev 47959)
@@ -61,7 +61,7 @@
public void Dispose () {
// Nothing
}
-
+#if TARGET_JVM
internal IntPtr ToNativePtr () {
IntPtr result;
IntPtr ptr;
@@ -109,5 +109,6 @@
return result;
}
+#endif
}
}
Modified:
trunk/mcs/class/System.Drawing/System.Drawing.Imaging/FrameDimension.cs
===================================================================
--- trunk/mcs/class/System.Drawing/System.Drawing.Imaging/FrameDimension.cs
2005-08-03 13:48:31 UTC (rev 47958)
+++ trunk/mcs/class/System.Drawing/System.Drawing.Imaging/FrameDimension.cs
2005-08-03 13:54:01 UTC (rev 47959)
@@ -51,7 +51,7 @@
return guid;
}
}
-
+
public static FrameDimension Page {
get {
return new FrameDimension (new Guid
("7462dc86-6180-4c7e-8e3f-ee7333a7a483"));
@@ -69,7 +69,15 @@
return new FrameDimension (new Guid
("6aedbd6d-3fb5-418a-83a6-7f45229dc872" ));
}
}
-
+
+#if TARGET_JVM
+ internal static FrameDimension PixelFormat {
+ get {
+ return new FrameDimension (new Guid
("9BCCD13D-9D8C-401a-B9ED-BB548E5B3329" ));
+ }
+ }
+#endif
+
//methods
public override bool Equals(object o)
{
Added:
trunk/mcs/class/System.Drawing/System.Drawing.Imaging/ImageAttributes.jvm.cs
===================================================================
---
trunk/mcs/class/System.Drawing/System.Drawing.Imaging/ImageAttributes.jvm.cs
2005-08-03 13:48:31 UTC (rev 47958)
+++
trunk/mcs/class/System.Drawing/System.Drawing.Imaging/ImageAttributes.jvm.cs
2005-08-03 13:54:01 UTC (rev 47959)
@@ -0,0 +1,303 @@
+
+using System;
+using System.Drawing;
+using System.Drawing.Drawing2D;
+
+namespace System.Drawing.Imaging
+{
+ /// <summary>
+ /// Summary description for ImageAttributes.
+ /// </summary>
+ ///
+ public sealed class ImageAttributes : ICloneable, IDisposable
+ {
+
+ public ImageAttributes()
+ {
+ }
+
+ public void Dispose()
+ {
+ }
+
+
+ public void Finalize()
+ {
+ Dispose();
+ }
+
+ public Object Clone()
+ {
+ ImageAttributes imgAttr = new ImageAttributes();
+ imgAttr.clrMatrix = clrMatrix;
+ imgAttr.clrMatrixFlag = clrMatrixFlag;
+ imgAttr.clrAdjustType = clrAdjustType;
+ imgAttr.gMatrix = gMatrix;
+ imgAttr.thresh = thresh;
+ imgAttr.gamma = gamma;
+ imgAttr.clrChannelFlags = clrChannelFlags;
+ imgAttr.clrProfileFilename = clrProfileFilename;
+ imgAttr.clrLow = clrLow;
+ imgAttr.clrHigh = clrHigh;
+ imgAttr.clrMap = clrMap;
+ imgAttr.wrapMode = wrapMode;
+ imgAttr.col = col;
+ imgAttr.bClamp = bClamp;
+ imgAttr.clrPalette = clrPalette;
+ imgAttr.bNoOp = bNoOp;
+ return imgAttr;
+ }
+
+
+ public void SetColorMatrix(ColorMatrix newColorMatrix)
+ {
+ SetColorMatrix(newColorMatrix, ColorMatrixFlag.Default,
ColorAdjustType.Default);
+ }
+
+ public void SetColorMatrix(ColorMatrix newColorMatrix,
ColorMatrixFlag flags)
+ {
+ SetColorMatrix(newColorMatrix, flags,
ColorAdjustType.Default);
+ }
+
+ public void SetColorMatrix(ColorMatrix newColorMatrix,
ColorMatrixFlag mode, ColorAdjustType type)
+ {
+ clrMatrix = newColorMatrix;
+ clrMatrixFlag = mode;
+ clrAdjustType = type;
+ }
+
+ public void ClearColorMatrix()
+ {
+ ClearColorMatrix(ColorAdjustType.Default);
+ }
+
+ public void ClearColorMatrix(ColorAdjustType type)
+ {
+ ColorMatrix cm = new ColorMatrix();
+ clrMatrix = cm;
+ clrAdjustType = type;
+ }
+
+ public void SetColorMatrices(ColorMatrix newColorMatrix,
ColorMatrix gMatrix)
+ {
+ SetColorMatrices(newColorMatrix, gMatrix,
ColorMatrixFlag.Default, ColorAdjustType.Default);
+ }
+
+ public void SetColorMatrices(ColorMatrix newColorMatrix,
ColorMatrix gMatrix, ColorMatrixFlag flags)
+ {
+ SetColorMatrices(newColorMatrix, gMatrix, flags,
ColorAdjustType.Default);
+ }
+
+ public void SetColorMatrices(ColorMatrix newColorMatrix,
ColorMatrix gMatrix, ColorMatrixFlag mode, ColorAdjustType type)
+ {
+ clrMatrix = newColorMatrix;
+ this.gMatrix = gMatrix;
+ clrMatrixFlag = mode;
+ clrAdjustType = type;
+ }
+
+ public void SetThreshold(float thresh)
+ {
+ SetThreshold(thresh, ColorAdjustType.Default);
+ }
+
+ public void SetThreshold(float thresh, ColorAdjustType type)
+ {
+ this.thresh = thresh;
+ clrAdjustType = type;
+ }
+
+ public void ClearThreshold()
+ {
+ ClearThreshold(ColorAdjustType.Default);
+ }
+
+ public void ClearThreshold(ColorAdjustType type)
+ {
+ thresh = 1.0F;
+ clrAdjustType = type;
+ }
+
+ public void SetGamma(float gamma)
+ {
+ SetGamma(gamma, ColorAdjustType.Default);
+ }
+
+ public void SetGamma(float gamma, ColorAdjustType type)
+ {
+ this.gamma = gamma;
+ clrAdjustType = type;
+ return;
+ }
+
+ public void ClearGamma()
+ {
+ ClearGamma(ColorAdjustType.Default);
+ }
+
+ public void ClearGamma(ColorAdjustType type)
+ {
+ gamma = 1;
+ clrAdjustType = type;
+ }
+
+ public void SetNoOp()
+ {
+ SetNoOp(ColorAdjustType.Default);
+ }
+
+ public void SetNoOp(ColorAdjustType type)
+ {
+ bNoOp = true;
+ clrAdjustType = type;
+ }
+
+ public void ClearNoOp()
+ {
+ ClearNoOp(ColorAdjustType.Default);
+ }
+
+ public void ClearNoOp(ColorAdjustType type)
+ {
+ bNoOp = false;
+ clrAdjustType = type;
+ }
+
+ public void SetColorKey(Color clrLow, Color clrHigh)
+ {
+ SetColorKey(clrLow, clrHigh, ColorAdjustType.Default);
+ }
+
+ public void SetColorKey(Color clrLow, Color clrHigh,
ColorAdjustType type)
+ {
+ this.clrLow = clrLow;
+ this.clrHigh = clrHigh;
+ clrAdjustType = type;
+ }
+
+ public void ClearColorKey()
+ {
+ ClearColorKey(ColorAdjustType.Default);
+ }
+
+ public void ClearColorKey(ColorAdjustType type)
+ {
+ clrAdjustType = type;
+ }
+
+ public void SetOutputChannel(ColorChannelFlag flags)
+ {
+ SetOutputChannel(flags, ColorAdjustType.Default);
+ }
+
+ public void SetOutputChannel(ColorChannelFlag flags,
ColorAdjustType type)
+ {
+ clrChannelFlags = flags;
+ clrAdjustType = type;
+ }
+
+ public void ClearOutputChannel()
+ {
+ ClearOutputChannel(ColorAdjustType.Default);
+ }
+
+ public void ClearOutputChannel(ColorAdjustType type)
+ {
+ clrAdjustType = type;
+ }
+
+ public void SetOutputChannelColorProfile(String
clrProfileFilename)
+ {
+ SetOutputChannelColorProfile(clrProfileFilename,
ColorAdjustType.Default);
+ }
+
+ public void SetOutputChannelColorProfile(String
clrProfileFilename, ColorAdjustType type)
+ {
+ this.clrProfileFilename = clrProfileFilename;
+ clrAdjustType = type;
+ }
+
+ public void ClearOutputChannelColorProfile()
+ {
+ ClearOutputChannel(ColorAdjustType.Default);
+ }
+
+ public void ClearOutputChannelColorProfile(ColorAdjustType type)
+ {
+ clrProfileFilename = null;
+ clrAdjustType = type;
+ }
+
+ public void SetRemapTable(ColorMap[] map)
+ {
+ SetRemapTable(map, ColorAdjustType.Default);
+ }
+
+ public void SetRemapTable(ColorMap[] map, ColorAdjustType type)
+ {
+ clrMap = map;
+ clrAdjustType = type;
+ }
+
+ public void ClearRemapTable()
+ {
+ ClearRemapTable(ColorAdjustType.Default);
+ }
+
+ public void ClearRemapTable(ColorAdjustType type)
+ {
+ clrMap = null;
+ clrAdjustType = type;
+ }
+
+ public void SetBrushRemapTable(ColorMap []map)
+ {
+ SetRemapTable(map, ColorAdjustType.Brush);
+ }
+
+ public void ClearBrushRemapTable()
+ {
+ ClearRemapTable(ColorAdjustType.Brush);
+ }
+
+ public void SetWrapMode(WrapMode mode)
+ {
+ SetWrapMode(mode, new Color(), false);
+ }
+
+ public void SetWrapMode(WrapMode mode, Color clr)
+ {
+ SetWrapMode(mode, clr, false);
+ }
+
+ public void SetWrapMode(WrapMode mode, Color clr, bool bClamp)
+ {
+ wrapMode = mode;
+ col = clr;
+ this.bClamp = bClamp;
+ }
+
+ public void GetAdjustedPalette(ColorPalette palette,
ColorAdjustType type)
+ {
+ clrPalette = palette;
+ clrAdjustType = type;
+ }
+
+ public ColorMatrix clrMatrix;
+ public ColorMatrixFlag clrMatrixFlag;
+ public ColorAdjustType clrAdjustType;
+ public ColorMatrix gMatrix;
+ public float thresh;
+ public float gamma;
+ public ColorChannelFlag clrChannelFlags;
+ public string clrProfileFilename;
+ public Color clrLow;
+ public Color clrHigh;
+ public ColorMap[] clrMap;
+ public WrapMode wrapMode;
+ public Color col;
+ public bool bClamp;
+ public ColorPalette clrPalette;
+ public bool bNoOp;
+ }
+}
\ No newline at end of file
Property changes on:
trunk/mcs/class/System.Drawing/System.Drawing.Imaging/ImageAttributes.jvm.cs
___________________________________________________________________
Name: svn:executable
+ *
Added:
trunk/mcs/class/System.Drawing/System.Drawing.Imaging/ImageCodecInfo.jvm.cs
===================================================================
--- trunk/mcs/class/System.Drawing/System.Drawing.Imaging/ImageCodecInfo.jvm.cs
2005-08-03 13:48:31 UTC (rev 47958)
+++ trunk/mcs/class/System.Drawing/System.Drawing.Imaging/ImageCodecInfo.jvm.cs
2005-08-03 13:54:01 UTC (rev 47959)
@@ -0,0 +1,155 @@
+//
+// System.Drawing.Imaging.ImageCodecInfo.cs
+//
+// Authors:
+// Everaldo Canuto ([EMAIL PROTECTED])
+// Andreas Nahr ([EMAIL PROTECTED])
+// Dennis Hayes ([EMAIL PROTECTED])
+// Andreas Nahr ([EMAIL PROTECTED])
+// Dennis Hayes ([EMAIL PROTECTED])
+// Jordi Mas i Hernandez ([EMAIL PROTECTED])
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Runtime.InteropServices;
+using System.Collections;
+using System.IO;
+
+namespace System.Drawing.Imaging {
+
+ [ComVisible (false)]
+ public sealed class ImageCodecInfo
+ {
+ private Guid clsid;
+ private string codecName;
+ private string dllName;
+ private string filenameExtension;
+ private ImageCodecFlags flags;
+ private string formatDescription;
+ private Guid formatID;
+ private string mimeType;
+ private byte[][] signatureMasks;
+ private byte[][] signaturePatterns;
+ private int version;
+
+ internal ImageCodecInfo()
+ {
+
+ }
+
+ // methods
+ public static ImageCodecInfo[] GetImageDecoders()
+ {
+ throw new NotImplementedException();
+ }
+
+
+ public static ImageCodecInfo[] GetImageEncoders()
+ {
+ throw new NotImplementedException();
+ }
+
+ // properties
+
+ public Guid Clsid
+ {
+ get { return clsid; }
+ set { clsid = value; }
+ }
+
+
+ public string CodecName
+ {
+ get { return codecName; }
+ set { codecName = value; }
+ }
+
+
+ public string DllName
+ {
+ get { return dllName; }
+ set { dllName = value; }
+ }
+
+
+ public string FilenameExtension
+ {
+ get { return filenameExtension; }
+ set { filenameExtension = value; }
+ }
+
+
+ public ImageCodecFlags Flags
+ {
+ get { return flags; }
+ set { flags = value; }
+ }
+
+ public string FormatDescription
+ {
+ get { return formatDescription; }
+ set { formatDescription = value; }
+ }
+
+ public Guid FormatID
+ {
+ get { return formatID; }
+ set { formatID = value; }
+ }
+
+
+ public string MimeType
+ {
+ get { return mimeType; }
+ set { mimeType = value; }
+ }
+
+
+ [CLSCompliant(false)]
+ public byte[][] SignatureMasks
+ {
+ get { return signatureMasks; }
+ set { signatureMasks = value; }
+ }
+
+ [CLSCompliant(false)]
+ public byte[][] SignaturePatterns
+ {
+ get { return signaturePatterns; }
+ set { signaturePatterns = value; }
+ }
+
+ public int Version
+ {
+ get { return version; }
+ set { version = value; }
+ }
+
+ }
+
+}
Property changes on:
trunk/mcs/class/System.Drawing/System.Drawing.Imaging/ImageCodecInfo.jvm.cs
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/mcs/class/System.Drawing/System.Drawing.Imaging/ImageFormat.jvm.cs
===================================================================
--- trunk/mcs/class/System.Drawing/System.Drawing.Imaging/ImageFormat.jvm.cs
2005-08-03 13:48:31 UTC (rev 47958)
+++ trunk/mcs/class/System.Drawing/System.Drawing.Imaging/ImageFormat.jvm.cs
2005-08-03 13:54:01 UTC (rev 47959)
@@ -0,0 +1,297 @@
+//
+// System.Drawing.Imaging.ImageFormat.cs
+//
+// Authors:
+// Everaldo Canuto ([EMAIL PROTECTED])
+// Andreas Nahr ([EMAIL PROTECTED])
+// Dennis Hayes ([EMAIL PROTECTED])
+// Jordi Mas i Hernandez ([EMAIL PROTECTED])
+//
+// (C) 2002-4 Ximian, Inc. http://www.ximian.com
+//
+
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.ComponentModel;
+using javax.imageio;
+using javax.imageio.spi;
+
+namespace System.Drawing.Imaging {
+
+
+ public sealed class ImageFormat {
+ #region Statics
+ static ImageFormat () {
+ //remember mime according to the beginning of the string
+ //workaround for
com.sun.media.imageioimpl.plugins.bmp.BMPImageReader
+ //which has mimeType="image/bmp, image/x-bmp,
image/x-windows-bmp"
+
+ String [] mimeReaders =
javax.imageio.ImageIO.getReaderMIMETypes ();
+ String [] mimeWriters =
javax.imageio.ImageIO.getWriterMIMETypes ();
+ String [] mimeTypes = new string
[mimeReaders.Length+mimeWriters.Length];
+ mimeReaders.CopyTo (mimeTypes, 0);
+ mimeWriters.CopyTo (mimeTypes, mimeReaders.Length);
+
+ for (int i = 0; i < mimeTypes.Length; i++) {
+ if (mimeTypes [i].StartsWith ("image/bmp"))
+ mimeBmp = mimeTypes [i];
+ else if (mimeTypes [i].StartsWith ("image/gif"))
+ mimeGif = mimeTypes [i];
+ else if (mimeTypes [i].StartsWith
("image/tiff"))
+ mimeTiff = mimeTypes [i];
+ else if (mimeTypes [i].StartsWith ("image/png"))
+ mimePng = mimeTypes [i];
+ else if (mimeTypes [i].StartsWith
("image/x-ico"))
+ mimeIcon = mimeTypes [i];
+ else if (mimeTypes [i].StartsWith
("image/jpeg"))
+ mimeJpeg = mimeTypes [i];
+ }
+
+ BmpImageFormat = new ImageFormat (mimeBmp, guidBmp,
null, null);
+ EmfImageFormat = new ImageFormat (null, guidEmf, null,
null);
+ ExifImageFormat = new ImageFormat (null, guidExif,
null, null);
+ GifImageFormat = new ImageFormat (mimeGif, guidGif,
null, null);
+ TiffImageFormat = new ImageFormat (mimeTiff, guidTiff,
null, null);
+ PngImageFormat = new ImageFormat (mimePng, guidPng,
null, null);
+ MemoryBmpImageFormat = new ImageFormat (null,
guidMemoryBmp, null, null);
+ IconImageFormat = new ImageFormat (mimeIcon, guidIcon,
null, null);
+ JpegImageFormat = new ImageFormat(mimeJpeg, guidJpeg,
null, null);
+ WmfImageFormat = new ImageFormat (null, guidWmf, null,
null);
+ }
+
+ static Guid guidBmp = new Guid
("b96b3cab-0728-11d3-9d7b-0000f81ef32e");
+ static Guid guidEmf = new Guid
("b96b3cac-0728-11d3-9d7b-0000f81ef32e");
+ static Guid guidExif = new Guid
("b96b3cb2-0728-11d3-9d7b-0000f81ef32e");
+ static Guid guidGif = new Guid
("b96b3cb0-0728-11d3-9d7b-0000f81ef32e");
+ static Guid guidTiff = new Guid
("b96b3cb1-0728-11d3-9d7b-0000f81ef32e");
+ static Guid guidPng = new
Guid("b96b3caf-0728-11d3-9d7b-0000f81ef32e");
+ static Guid guidMemoryBmp = new Guid
("b96b3caa-0728-11d3-9d7b-0000f81ef32e");
+ static Guid guidIcon = new Guid
("b96b3cb5-0728-11d3-9d7b-0000f81ef32e");
+ static Guid guidJpeg = new
Guid("b96b3cae-0728-11d3-9d7b-0000f81ef32e");
+ static Guid guidWmf = new Guid
("b96b3cad-0728-11d3-9d7b-0000f81ef32e");
+
+ static string mimeBmp, mimeGif, mimeTiff, mimePng, mimeIcon,
mimeJpeg;
+
+ static ImageFormat BmpImageFormat;
+ static ImageFormat EmfImageFormat;
+ static ImageFormat ExifImageFormat;
+ static ImageFormat GifImageFormat;
+ static ImageFormat TiffImageFormat;
+ static ImageFormat PngImageFormat;
+ static ImageFormat MemoryBmpImageFormat;
+ static ImageFormat IconImageFormat;
+ static ImageFormat JpegImageFormat;
+ static ImageFormat WmfImageFormat;
+
+ static string GuidToMime (Guid guid) {
+ if (guid.Equals (guidBmp))
+ return mimeBmp;
+ if (guid.Equals (guidGif))
+ return mimeGif;
+ if (guid.Equals (guidJpeg))
+ return mimeJpeg;
+ if (guid.Equals (guidPng))
+ return mimePng;
+ if (guid.Equals (guidTiff))
+ return mimeTiff;
+ if (guid.Equals (guidIcon))
+ return mimeIcon;
+ // Default
+ return null;
+ }
+
+ static Guid MimeToGuid (string mime) {
+ if (mime == mimeBmp)
+ return guidBmp;
+ if (mime == mimeGif)
+ return guidGif;
+ if (mime == mimeJpeg)
+ return guidJpeg;
+ if (mime == mimePng)
+ return guidPng;
+ if (mime == mimeTiff)
+ return guidTiff;
+ // Default
+ return Guid.Empty;
+ }
+
+ #endregion
+
+ #region Variables
+ Guid _guid;
+ string _mimeType;
+ ImageReaderSpi _readerSpi;
+ ImageWriterSpi _writerSpi;
+ #endregion
+
+ #region Constructors
+ public ImageFormat (Guid guid)
+ :this (GuidToMime (guid), guid, null, null) {}
+
+ internal ImageFormat (string mimeType, ImageReaderSpi
readerSpi, ImageWriterSpi writerSpi)
+ :this (mimeType, MimeToGuid (mimeType), readerSpi,
writerSpi) {}
+
+ private ImageFormat (string mimeType, Guid guid,
+ ImageReaderSpi readerSpi /*can be null*/,
+ ImageWriterSpi writerSpi /*can be null*/)
+ {
+ _mimeType = mimeType;
+ _guid = guid;
+
+ if (writerSpi == null && mimeType != null) {
+ java.util.Iterator iter =
ImageIO.getImageWritersByMIMEType (mimeType);
+ if (iter.hasNext ()) {
+ ImageWriter writer = (ImageWriter)
iter.next ();
+ _writerSpi =
writer.getOriginatingProvider ();
+ } else
+ _writerSpi = null;
+ } else
+ _writerSpi = writerSpi;
+
+ if (readerSpi == null && mimeType != null) {
+ java.util.Iterator iter =
ImageIO.getImageReadersByMIMEType (mimeType);
+ if (iter.hasNext ()) {
+ ImageReader reader = (ImageReader)
iter.next ();
+ _readerSpi =
reader.getOriginatingProvider ();
+ } else
+ _readerSpi = null;
+ } else
+ _readerSpi = readerSpi;
+ }
+
+ #endregion
+
+ #region Methods
+ public override bool Equals(object o) {
+ ImageFormat f = o as ImageFormat;
+ if (f != null) {
+ if (f._guid == _guid)
+ return true;
+ else if (f._mimeType == _mimeType)
+ return true;
+ else if (f._readerSpi == _readerSpi &&
f._writerSpi == _writerSpi)
+ return true;
+ }
+ return false;
+ }
+
+ public override int GetHashCode() {
+ if (_guid != Guid.Empty)
+ return _guid.GetHashCode ();
+ else if (_mimeType != null)
+ return _mimeType.GetHashCode ();
+ else if (_readerSpi != null)
+ return _readerSpi.GetHashCode();
+ else if (_writerSpi != null)
+ return _writerSpi.GetHashCode ();
+ else
+ return 0;
+ }
+
+ public override string ToString() {
+ if (Guid.Equals (Bmp.Guid))
+ return "Bmp";
+ if (Guid.Equals (Emf.Guid))
+ return "Emf";
+ if (Guid.Equals (Gif.Guid))
+ return "Gif";
+ if (Guid.Equals (Jpeg.Guid))
+ return "Jpeg";
+ if (Guid.Equals (MemoryBmp.Guid))
+ return "MemoryBmp";
+ if (Guid.Equals (Png.Guid))
+ return "Png";
+ if (Guid.Equals (Tiff.Guid))
+ return "Tiff";
+ if (Guid.Equals (Wmf.Guid))
+ return "Wmf";
+ // Default
+ return String.Concat("[ImageFormat: ", _guid, "]");
+ }
+ #endregion
+
+ #region Properties
+ public Guid Guid {
+ get { return _guid; }
+ }
+
+ internal ImageReaderSpi ImageReaderSpi {
+ get {
+ return _readerSpi;
+ }
+ }
+
+ internal ImageWriterSpi ImageWriterSpi {
+ get {
+
+ return _writerSpi;
+ }
+ }
+
+ #endregion
+
+ #region Static properties
+ public static ImageFormat Bmp {
+ get { return BmpImageFormat; }
+ }
+
+ public static ImageFormat Emf {
+ get { return EmfImageFormat; }
+ }
+
+ public static ImageFormat Exif {
+ get { return ExifImageFormat; }
+ }
+
+ public static ImageFormat Gif {
+ get { return GifImageFormat; }
+ }
+
+ public static ImageFormat Icon {
+ get { return IconImageFormat; }
+ }
+
+ public static ImageFormat Jpeg {
+ get { return JpegImageFormat; }
+ }
+
+ public static ImageFormat MemoryBmp {
+ get { return MemoryBmpImageFormat; }
+ }
+
+ public static ImageFormat Png {
+ get { return PngImageFormat; }
+ }
+
+ public static ImageFormat Tiff {
+ get { return TiffImageFormat; }
+ }
+
+ public static ImageFormat Wmf {
+ get { return WmfImageFormat; }
+ }
+ #endregion
+ }
+}
Property changes on:
trunk/mcs/class/System.Drawing/System.Drawing.Imaging/ImageFormat.jvm.cs
___________________________________________________________________
Name: svn:executable
+ *
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches