diff options
Diffstat (limited to 'mcs/class/System.Drawing/System.Drawing.Imaging')
39 files changed, 6042 insertions, 0 deletions
diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/BitmapData.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/BitmapData.cs new file mode 100644 index 00000000000..bf937143559 --- /dev/null +++ b/mcs/class/System.Drawing/System.Drawing.Imaging/BitmapData.cs @@ -0,0 +1,120 @@ +// +// System.Drawing.Imaging.BitmapData.cs +// +// Author: +// Miguel de Icaza (miguel@ximian.com) +// Vladimir Vukicevic (vladimir@pobox.com) +// +// (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.IO; + +namespace System.Drawing.Imaging +{ + // MUST BE KEPT IN SYNC WITH gdip.h in libgdiplus! +#if TARGET_JVM + [MonoTODO] +#endif + [StructLayout(LayoutKind.Sequential)] + public sealed class BitmapData { + internal int width; + internal int height; + internal int stride; + internal PixelFormat pixel_format; // int + internal IntPtr address; + internal int reserved; + + // following added to keep track of frames + internal int top; + internal int left; + internal int byteCount; + internal IntPtr bytes; + + public int Height { + get { + return height; + } + + set { + height = value; + } + } + + public int Width { + get { + return width; + } + + set { + width = value; + } + } + + public PixelFormat PixelFormat { + get { + + return pixel_format; + } + + set { + pixel_format = value; + } + } + + public int Reserved { + get { + return reserved; + } + + set { + reserved = value; + } + } + + public IntPtr Scan0 { + get { + return address; + } + + set { + address = value; + } + } + + public int Stride { + get { + return stride; + } + + set { + stride = value; + } + } + } +} diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/ChangeLog b/mcs/class/System.Drawing/System.Drawing.Imaging/ChangeLog new file mode 100644 index 00000000000..7bb92d72a8d --- /dev/null +++ b/mcs/class/System.Drawing/System.Drawing.Imaging/ChangeLog @@ -0,0 +1,412 @@ +2005-11-23 Vladimir Krasnov <vladimirk@mainsoft.com> + + * ImageCodec.jvm.cs: fixed ProcessOneCodec, sometime it was failed + on parsing version of codec + +2005-11-17 Vladimir Krasnov <vladimirk@mainsoft.com> + + * ImageCodec.jvm.cs: fixed WriteImage, removed flush + of native output + +2005-11-17 Raja R Harinath <rharinath@novell.com> + + * ColorMatrix.cs: Make it have Sequential layout. + +2005-11-16 Konstantin Triger <kostat@mainsoft.com> + + * ImageCodec.jvm.cs: refactoring. + +2005-11-14 Vladimir Krasnov <vladimirk@mainsoft.com> + + * ImageCodec.jvm.cs: Fixed error handling in codecs emumeration flow + +2005-11-13 Kornél Pál <kornelpal@hotmail.com> + + * ImageFormat.cs: Fixed ToString to use this.Equals to reflect argument + changes to ImageFormat objects. Added Exif and Icon strings to ToString + and reordered formats to match declaration. + +2005-11-13 Konstantin Triger <kostat@mainsoft.com> + + * ImageCodec.jvm.cs: throw an exception if codec is not found. + +2005-10-31 Jordi Mas i Hernandez <jordi@ximian.com> + + * ImageFormat.cs: Fixes ToString method + +2005-09-27 Vladimir Krasnov <vladimirk@mainsoft.com> + + * ImageCodec.jvm.cs: implemented IDsposable, + fixed NativeReader, NativeWriter, NativeStream + +2005-10-20 Konstantin Triger <kostat@mainsoft.com> + + * Metafile.jvm.cs: implement abstact Clone + +2005-10-04 Peter Dennis Bartok <pbartok@novell.com> + + * EncoderParameter.cs, EncoderParameters.cs: Calling GC.SuppressFinalize + from the Dispose method; fixes bug #76329 + +2005-09-21 Vladimir Krasnov <vladimirk@mainsoft.com> + + * ImageCodec.jvm.cs: refactoring of read/write methods, members access levels + +2005-09-14 Vladimir Krasnov <vladimirk@mainsoft.com> + + * ImageCodecInfo.jvm.cs: fixed ImageCodec namespace + * ImageCodec.jvm.cs: refactoring of read/write methods + +2005-09-07 Vladimir Krasnov <vladimirk@mainsoft.com> + + * ImageCodecInfo.jvm.cs: fixed GetValueFromMetadata, SetResolution + +2005-09-07 Vladimir Krasnov <vladimirk@mainsoft.com> + + * ImageCodecInfo.jvm.cs: Refactoring + * Added ImageCodec.jvm.cs + +2005-08-28 Vladimir Krasnov <vladimirk@mainsoft.com> + + * ImageCodecInfo.jvm.cs: Fixed Iterate + +2005-08-03 Andrew Skiba <andrews@mainsoft.com> + + * ImageCodecInfo.jvm.cs: implement via java imageio, add internal APIs for + fast read-only requests + * Methafile.jvm.cs: change in not implemented api to match image.jvm.cs + +2005-08-03 Andrew Skiba <andrews@mainsoft.com> + + * Metafile.jvm.cs: add TARGET_JVM implementation + +2005-08-03 Andrew Skiba <andrews@mainsoft.com> + + * 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 <jordi@ximian.com> + + * ColorPalette.cs: fixes ColorPalette marshaling + +2004-03-21 Jordi Mas i Hernadez <jordi@ximian.com> + + * ColorMatrix.cs: fixes Matrix00 init + * ImageAttributes.cs: fixes dispose method and signature + +2004-02-25 Jordi Mas i Hernadez <jordi@ximian.com> + + * ColorMatrix.cs: rewritten to be able to marshall it properly + +2004-12-27 Zoltan Varga <vargaz@freemail.hu> + + * ImageCodecInfo.cs: Fix marshalling of arrays on amd64. + +2004-11-25 Marek Safar <marek.safar@seznam.cz> + + * ColorPalette.cs: Add CheckStatus to GetAdjustedPalette.
+
+2004-11-03 Miguel de Icaza <miguel@ximian.com> + + * ColorPalette.cs: Add internal Clone method + +2004-10-08 Ravindra <rkumar@novell.com> + + * BitmapData.cs: Synchronized the class with BitmapData struct + in libgdiplus. + +2004-06-13 Gert Driesen <drieseng@users.sourceforge.net> + + * EmfPlusRecordType.cs: fixed mismatches in enum field values + +2004-05-18 Jordi Mas i Hernadez <jordi@ximian.com> + * ImageAttributes.cs: SetBrushRemapTable and SetRemapTable were + passing bad parameters to GDI+ causing them not to work + +2004-05-16 Gert Driesen (drieseng@users.sourceforge.net) + + * EncoderParameterValueType.cs: fix Windows build (CSC), + MCS bug #58571 + + * EncoderParameter.cs: removed ctors taking int value, + to fix public API + +2004-05-14 Vladimir Vukicevic <vladimir@pobox.com> + + * EncoderParameters.cs: Added ToNativePtr() method to marshal + struct correctly to a native struct. Resulting data should be + FreeHGlobal'd when finished. + + * EncoderParameter.cs: Changed data storage to correspond to + native code layout (so we can pass these structs directly to + native code). Also changed layout to match native layout. + + * EncoderParameterValueType.cs: force EncoderParameterValueType to + be Int32 + +2004-05-13 Jordi Mas i Hernadez <jordi@ximian.com> + + * ColorMatrix.cs:Make private data private + * ColorPalette.cs: Make private data private + * Encoder.cs: Make private data private + * EncoderParameter.cs: Make private data private + * EncoderParameters.cs: Make private data private + * MetaHeader.cs: Make private data private + * PropertyItem.cs: Make private data private + +2004-05-04 Vladimir Vukicevic <vladimir@pobox.com> + + * BitmapData.cs: re-synchronized with libgdiplus; also + removed memory deallocs here (as the data is always owned + by libgdiplus) + +2004-04-28 Sanjay Gupta <gsanjay@novell.com> + + Modified files from dos2unix format. + +2004-04-27 Ravindra <rkumar@novell.com> + + * ImageAttributes.cs: Implemented SetWrapMode(WrapMode) method. + +2004-04-27 Jordi Mas i Hernadez <jordi@ximian.com> + + * ImageFormat.cs: completed missimg members + * ImageCodecInfo.cs: Use GDI+ calls instead of native C# + +2004-04-27 Sanjay Gupta <gsanjay@novell.com> + * ImageFormat.cs: Implemented Equals() method. + +2004-04-27 Sanjay Gupta <gsanjay@novell.com> + * ImageFormat.cs: Implemented ToString() method. + +2004-04-06 Vladimir Vukicevic <vladimir@pobox.com> + + * BitmapData.cs: synced up data structure with libgdiplus + + * BmpCodec.cs, JPEGCodec.cs, PNGCodec.cs: Removed codec impls, + left just codecinfo getters; the codecs are in libgdiplus + + * ImageCodecInfo.cs: removed encode/decode delegates + +2004-03-31 Jordi Mas i Hernadez <jordi@ximian.com> + * FrameDimension.cs: added missing members + +2004-03-26 Jordi Mas i Hernadez <jordi@ximian.com> + * ImageAttributes.cs: added missing members and complete the wrapper + +2004-03-04 Jordi Mas i Hernadez <jordi@ximian.com> + * BmpCodec.cs: fixes DPI in BMP + * Image.cs: gets DPI using GDI+ api + +2004-03-04 Jordi Mas i Hernadez <jordi@ximian.com> + * BmpCodec.cs + Added support for diffent formats + Fixed bugs in import and export + Support for OS/2 and palettes + * Image.cs + Palettes + +2004-03-04 Sanjay Gupta <gsanjay@novell.com> + * Metafile.cs: Added constructor with correct signature. + +2004-03-04 Nick Drochak <ndrochak@ieee.org> + + * Metafile.cs: Fix build, remove duplicate member. + +2004-03-03 Sanjay Gupta <gsanjay@novell.com> + *ImageAttributes.cs: Added few missing functions + *Metafile.cs: Added stubs for missing constructors and functions + +2004-03-03 Nick Drochak <ndrochak@ieee.org> + + * BmpCodec.cs: Remove unsed variable. + +2004-02-17 Ravindra <rkumar@novell.com> + * EncoderParameter.cs: Did few bug fixes and changed the file + format to unix. + +2004-02-13 Sanjay Gupta <gsanjay@novell.com> + * FrameDimension.cs: Implemented missing functionalities + +2004-02-12 Ravindra <rkumar@novell.com> + * EncoderParameters.cs: Implemented. + * EncoderParameter.cs: Implemented. + +2004-01-21 Jordi Mas i Hernà dez <jmas@softcatala.org> + * BmpBitmap.cs: fixed encoding and decoding problems + * ImageAttributes.cs: implemented + +2004-01-19 Ravindra <rkumar@novell.com> + + * Encoder.cs: Implemented. + +2004-01-10 Ravindra <rkumar@novell.com> + + * All Enums: Made serializable. + + * ImageAttributes.cs: Implements ICloneable. + + * Metafile.cs: Made serializable and invisible to COM. + +2003-11-13 Andreas Nahr <ClassDevelopment@A-SoftTech.com> + + * ColorMap.cs: Implemented + * ColorMatrix.cs: Implemented, Removed unneccesary members + * ImageAttributes.cs: Fixed signature + * ImageCodecInfo.cs: Added missing attribure, hide constructor + * ImageFormat.cs: Implemented, Added attribute + * MetaHeader.cs: Implemented + * PropertyItem.cs: Implemented + * ImageFlags.cs: Added Attribute + * ImageCodecFlags.cs: Added Attribute + * EmfPlusRecordType.cs: Added missing members + +2003-11-12 Alexandre Pigolkine <pigolkine@gmx.de> + * BitmapData.cs new function to convert BRG to RGB + * JPEGCodec.cs convert BRG to RBG + * PNGCodec.cs + + +2003-11-02 Alexandre Pigolkine <pigolkine@gmx.de> + * BmpCodec.cs + * ImageCodecInfo.cs + * JPEGCodec.cs + * PNGCodec.cs + codec can select pixel format of bitmap + +2003-10-23 Miguel de Icaza <miguel@ximian.com> + + * JPEGCodec.cs (JSAMPARRAY): Do not allocate memory here anymore, + we will just have the JPEG library copy directly into our buffer. + + (Encode, Decode): Ported to the new model which avoid copies, and + eliminates InternalImageInfo. + + TODO: need to port the PNG coder/decoder, and add support for RGBA + images which got dropped from this version + + * BmpCodec.cs: Rework this one to use BitmapData and Image. Do + not use the RawBytes property, instead pull the data one line at a + time, and write that out. + + * ImageCodecInfo.cs: Make the encoding and decoding delegates take + a Image parameter; + + * BmpCodec.cs: + + * BitmapData.cs: Make this one sequential, and also mimic the + layout of GdiPlus.h so we can use this instead of making copies + back and forth. + +2003-10-12 Alexandre Pigolkine + * BmpCodec.cs warning removed + +2003-07-23 Alexandre Pigolkine + * JPEGCodec.cs + * PNGCodec.cs + * BmpCodec.cs cosmetic changes + +2003-07-22 Alexandre Pigolkine + * ImageCodecInfo.cs + * ImageFormat.cs + * JPEGCodec.cs + changes for PNG codec + + * PNGCodec.cs added + +2003-07-21 Andreas Nahr <ClassDevelopment@A-SoftTech.com> + + * Metafile.cs: Inherits from image (fix for System.Drawing.Design) + +2003-06-29 Alexandre Pigolkine + * BmpCodec.cs handle 32bpp images + * JPEGCodec.cs small fix + +2003-06-27 Alexandre Pigolkine <pigolkine@gmx.de> + * JPEGCodec.cs encode 32 bpp images + +2003-06-23 Alexandre Pigolkine <pigolkine@gmx.de> + * JPEGCodec.cs set pixel format in InternalImageInfo + +2003-06-23 Alexandre Pigolkine <pigolkine@gmx.de> + * BmpCodec.cs pixel format check added + * JPEGCodec.cs encoder implemented + +2003-06-15 Alexandre Pigolkine <pigolkine@gmx.de> + * ColorPalette.cs + * ImageCodecInfo.cs + * ImageFormat.cs + implementation added + + * BmpCodec.cs + * JPEGCodec.cs + added + +2002-9-2 DennisHayes <dennish@raytek.com> + +* PropertyItem.cs t +* MetaHeader.cs t +* MetafileHeader.cs t +* Metafile.cs t +* ImageFormat.cs t +* ImageCodecInfo.cs t +* ColorMatrix.cs t +* ColorMap.cs t +* WmfPlaceableFileHeader.cs t +* Added todos back + +2002-9-2 DennisHayes <dennish@raytek.com> + * checked in for Everaldo Canuto (everaldo.canuto@bol,com.br) + * BitmapData.cs + * ColorAdjustType.cs + * ColorChannelFlag.cs + * ColorMap.cs + * ColorMapType.cs + * ColorMatrix.cs + * ColorMatrixFlag.cs + * ColorMode.cs + * EmfPlusRecordType.cs + * EmfType.cs + * EncoderParameterValueType.cs + * EncoderValue.cs + * ImageCodecFlags.cs + * ImageCodecInfo.cs + * ImageFlags.cs + * ImageFormat.cs + * ImageLockMode.cs + * MetafileFrameUnit.cs + * MetafileHeader.cs + * MetaHeader.cs + * PaletteFlags.cs + * PixelFormat.cs + * PlayRecordCallback.cs + * PropertyItem.cs + * WmfPlaceableFileHeader.cs + * Added null classes for most/all classes, Many stubs, and some implmentation + +2002-9-2 DennisHayes <dennish@raytek.com> + + * ColorPalette.cs + * FrameDimension.cs + * Metafile.cs + * Added stubs, implmentation + +2002-05-03 Mike Kestner <mkestner@speakeasy.net> + + * Metafile.cs : Use System.IO. Fix exception typos. + +2002-04-27 Christian Meyer <Christian.Meyer@cs.tum.edu> + + * Metafile.cs: Copyright now holds Ximian. + +2002-04-21 Dennis Hayes <dennish@raytek.com> + + * corrected emum values. + +2002-04-14 Christian Meyer <Christian.Meyer@cs.tum.edu> + + * ChangeLog: created. + * Metafile.cs: Added. Wrote some ctors. No impl done, yet. + diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/ColorAdjustType.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/ColorAdjustType.cs new file mode 100644 index 00000000000..7244eb94ad5 --- /dev/null +++ b/mcs/class/System.Drawing/System.Drawing.Imaging/ColorAdjustType.cs @@ -0,0 +1,43 @@ +// +// System.Drawing.Imaging.ColorAdjustType.cs +// +// (C) 2002 Ximian, Inc. http://www.ximian.com +// Author: Dennis Hayes (dennish@raytek.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; +namespace System.Drawing.Imaging +{ + [Serializable] + public enum ColorAdjustType { + Any = 6, + Bitmap = 1, + Brush = 2, + Count = 5, + Default = 0, + Pen = 3, + Text = 4 + } +} diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/ColorChannelFlag.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/ColorChannelFlag.cs new file mode 100644 index 00000000000..2c7800080c9 --- /dev/null +++ b/mcs/class/System.Drawing/System.Drawing.Imaging/ColorChannelFlag.cs @@ -0,0 +1,41 @@ +// +// System.Drawing.Imaging.ColorChannelFlag.cs +// +// (C) 2002 Ximian, Inc. http://www.ximian.com +// Author: Dennis Hayes (dennish@raytek.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; +namespace System.Drawing.Imaging +{ + [Serializable] + public enum ColorChannelFlag { + ColorChannelC = 0, + ColorChannelK = 3, + ColorChannelLast = 4, + ColorChannelM = 1, + ColorChannelY = 2 + } +} diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/ColorMap.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/ColorMap.cs new file mode 100644 index 00000000000..602434eedbb --- /dev/null +++ b/mcs/class/System.Drawing/System.Drawing.Imaging/ColorMap.cs @@ -0,0 +1,64 @@ +// +// System.Drawing.Imaging.ColorMap.cs +// +// Authors: +// Everaldo Canuto (everaldo.canuto@bol.com.br) +// Andreas Nahr (ClassDevelopment@A-SoftTech.com) +// Dennis Hayes (dennish@raytek.com) +// +// (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.IO; +using System.Reflection; + +namespace System.Drawing.Imaging { +#if TARGET_JVM + [MonoTODO] +#endif + public sealed class ColorMap { + + private Color newColor; + private Color oldColor; + + // constructors + public ColorMap() { + } + + // properties + public Color NewColor { + get { return newColor; } + set { newColor = value; } + } + + public Color OldColor { + get { return oldColor; } + set { oldColor = value; } + } + } + +} diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/ColorMapType.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/ColorMapType.cs new file mode 100644 index 00000000000..59317e0be89 --- /dev/null +++ b/mcs/class/System.Drawing/System.Drawing.Imaging/ColorMapType.cs @@ -0,0 +1,38 @@ +// +// System.Drawing.Imaging.ColorMapType.cs +// +// (C) 2002 Ximian, Inc. http://www.ximian.com +// Author: Dennis Hayes (dennish@raytek.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; +namespace System.Drawing.Imaging +{ + [Serializable] + public enum ColorMapType{//check + Brush = 1, + Default = 0 + } +} diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/ColorMatrix.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/ColorMatrix.cs new file mode 100644 index 00000000000..a9e64359ded --- /dev/null +++ b/mcs/class/System.Drawing/System.Drawing.Imaging/ColorMatrix.cs @@ -0,0 +1,372 @@ +// +// Copyright 2002 Ximian, Inc. http://www.ximian.com +// Copyright (C) 2004-2005 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. +// +// +// Authors: +// Jordi Mas i Hernandez (jordi@ximian.com) +// +// Partially based on work by: +// +// Everaldo Canuto (everaldo.canuto@bol.com.br) +// Andreas Nahr (ClassDevelopment@A-SoftTech.com) +// Dennis Hayes (dennish@raytek.com) +// + + +using System; +using System.Runtime.InteropServices; + +namespace System.Drawing.Imaging +{ +#if TARGET_JVM + [MonoTODO] +#endif + [StructLayout (LayoutKind.Sequential)] + public sealed class ColorMatrix + { + private float color00; + private float color01; + private float color02; + private float color03; + private float color04; + private float color10; + private float color11; + private float color12; + private float color13; + private float color14; + private float color20; + private float color21; + private float color22; + private float color23; + private float color24; + private float color30; + private float color31; + private float color32; + private float color33; + private float color34; + private float color40; + private float color41; + private float color42; + private float color43; + private float color44; + + // constructors + public ColorMatrix () + { + color01 = color02 = color03 = color04 = 0; + color10 = color12 = color13 = color14 = 0; + color20 = color21 = color23 = color24 = 0; + color30 = color31 = color32 = color34 = 0; + color40 = color41 = color42 = color43 = 0; + color00 = color11 = color22 = color33 = color44 = 1; + } + + [CLSCompliant(false)] + public ColorMatrix (float[][] matrix) + { + color00 = matrix [0][0]; + color01 = matrix [0][1]; + color02 = matrix [0][2]; + color03 = matrix [0][3]; + color04 = matrix [0][4]; + color10 = matrix [1][0]; + color11 = matrix [1][1]; + color12 = matrix [1][2]; + color13 = matrix [1][3]; + color14 = matrix [1][4]; + color20 = matrix [2][0]; + color21 = matrix [2][1]; + color22 = matrix [2][2]; + color23 = matrix [2][3]; + color24 = matrix [2][4]; + color30 = matrix [3][0]; + color31 = matrix [3][1]; + color32 = matrix [3][2]; + color33 = matrix [3][3]; + color34 = matrix [3][4]; + color40 = matrix [4][0]; + color41 = matrix [4][1]; + color42 = matrix [4][2]; + color43 = matrix [4][3]; + color44 = matrix [4][4]; + } + + // properties + public float this[int row, int column] { + get { + switch (row) { + case 0: { + switch (column) { + case 0: return color00; + case 1: return color01; + case 2: return color02; + case 3: return color03; + case 4: return color04; + default: break; + } + break; + } + case 1: { + switch (column) { + case 0: return color10; + case 1: return color11; + case 2: return color12; + case 3: return color13; + case 4: return color14; + default: break; + } + break; + } + case 2: { + switch (column) { + case 0: return color20; + case 1: return color21; + case 2: return color22; + case 3: return color23; + case 4: return color24; + default: break; + } + break; + } + case 3: { + switch (column) { + case 0: return color30; + case 1: return color31; + case 2: return color32; + case 3: return color33; + case 4: return color34; + default: break; + } + break; + } + case 4: { + switch (column) { + case 0: return color40; + case 1: return color41; + case 2: return color42; + case 3: return color43; + case 4: return color44; + default: break; + } + break; + } + default: + break; + } + + throw new IndexOutOfRangeException ("Index was outside the bounds of the array"); + } + + set { + switch (row) { + case 0: { + switch (column) { + case 0: color00 = value; return; + case 1: color01 = value; return; + case 2: color02 = value; return; + case 3: color03 = value; return; + case 4: color04 = value; return; + default: break; + } + break; + } + case 1: { + switch (column) { + case 0: color10 = value; return; + case 1: color11 = value; return; + case 2: color12 = value; return; + case 3: color13 = value; return; + case 4: color14 = value; return; + default: break; + } + break; + } + case 2: { + switch (column) { + case 0: color20 = value; return; + case 1: color21 = value; return; + case 2: color22 = value; return; + case 3: color23 = value; return; + case 4: color24 = value; return; + default: break; + } + break; + } + case 3: { + switch (column) { + case 0: color30 = value; return; + case 1: color31 = value; return; + case 2: color32 = value; return; + case 3: color33 = value; return; + case 4: color34 = value; return; + default: break; + } + break; + } + case 4: { + switch (column) { + case 0: color40 = value; return; + case 1: color41 = value; return; + case 2: color42 = value; return; + case 3: color43 = value; return; + case 4: color44 = value; return; + default: break; + } + break; + } + default: + break; + } + + throw new IndexOutOfRangeException ("Index was outside the bounds of the array"); + } + } + + + public float Matrix00 { + get { return color00; } + set { color00 = value; } + } + + public float Matrix01 { + get { return color01; } + set { color01 = value; } + } + + public float Matrix02 { + get { return color02; } + set { color02 = value; } + } + + public float Matrix03 { + get { return color03; } + set { color03 = value; } + } + + public float Matrix04 { + get { return color04; } + set { color04 = value; } + } + + public float Matrix10 { + get { return color10; } + set { color10 = value; } + } + + public float Matrix11 { + get { return color11; } + set { color11 = value; } + } + + public float Matrix12 { + get { return color12; } + set { color12 = value; } + } + + public float Matrix13 { + get { return color13; } + set { color13 = value; } + } + + public float Matrix14 { + get { return color14; } + set { color14 = value; } + } + + public float Matrix20 { + get { return color20; } + set { color20 = value; } + } + + public float Matrix21 { + get { return color21; } + set { color21 = value; } + } + + public float Matrix22 { + get { return color22; } + set { color22 = value; } + } + + public float Matrix23 { + get { return color23; } + set { color23 = value; } + } + + public float Matrix24 { + get { return color24; } + set { color24 = value; } + } + + public float Matrix30 { + get { return color30; } + set { color30 = value; } + } + + public float Matrix31 { + get { return color31; } + set { color31 = value; } + } + + public float Matrix32 { + get { return color32; } + set { color32 = value; } + } + + public float Matrix33 { + get { return color33; } + set { color33 = value; } + } + + public float Matrix34 { + get { return color34; } + set { color34 = value; } + } + + public float Matrix40 { + get { return color40; } + set { color40 = value; } + } + + public float Matrix41 { + get { return color41; } + set { color41 = value; } + } + + public float Matrix42 { + get { return color42; } + set { color42 = value; } + } + + public float Matrix43 { + get { return color43; } + set { color43 = value; } + } + + public float Matrix44 { + get { return color44; } + set { color44 = value; } + } + + } +} diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/ColorMatrixFlag.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/ColorMatrixFlag.cs new file mode 100644 index 00000000000..3b5b678805c --- /dev/null +++ b/mcs/class/System.Drawing/System.Drawing.Imaging/ColorMatrixFlag.cs @@ -0,0 +1,39 @@ +// +// System.Drawing.Imaging.ColorMatrixFlag.cs +// +// (C) 2002 Ximian, Inc. http://www.ximian.com +// Author: Dennis Hayes (dennish@raytek.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; +namespace System.Drawing.Imaging +{ + [Serializable] + public enum ColorMatrixFlag{ + AltGrays = 2, + Default = 0, + SkipGrays = 1 + } +} diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/ColorMode.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/ColorMode.cs new file mode 100644 index 00000000000..46408177f22 --- /dev/null +++ b/mcs/class/System.Drawing/System.Drawing.Imaging/ColorMode.cs @@ -0,0 +1,38 @@ +// +// System.Drawing.Imaging.ColorMode.cs +// +// (C) 2002 Ximian, Inc. http://www.ximian.com +// Author: Dennis Hayes (dennish@raytek.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; +namespace System.Drawing.Imaging +{ + [Serializable] + public enum ColorMode { + Argb32Mode = 0, + Argb64Mode = 1 + } +} diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/ColorPalette.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/ColorPalette.cs new file mode 100644 index 00000000000..7b231135537 --- /dev/null +++ b/mcs/class/System.Drawing/System.Drawing.Imaging/ColorPalette.cs @@ -0,0 +1,116 @@ +// +// System.Drawing.Imaging.ColorPalette.cs +// +// (C) 2002 Ximian, Inc. http://www.ximian.com +// +// Author: +// Miguel de Icaza (miguel@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.Drawing; +using System.Runtime.InteropServices; + +namespace System.Drawing.Imaging +{ + public sealed class ColorPalette { + // 0x1: the color values in the array contain alpha information + // 0x2: the color values are grayscale values. + // 0x4: the colors in the array are halftone values. + + private int flags; + private Color [] entries; + + // + // There is no public constructor, this will be used somewhere in the + // drawing code + // + internal ColorPalette () + { + flags = 0; + entries = new Color [0]; + } + + internal ColorPalette (int flags, Color[] colors) { + this.flags = flags; + entries = colors; + } + + public Color [] Entries { + get { + return entries; + } + } + + public int Flags { + get { + return flags; + } + } +#if !TARGET_JVM + /* Caller should call FreeHGlobal*/ + internal IntPtr getGDIPalette() + { + GdiColorPalette palette = new GdiColorPalette (); + Color[] entries = Entries; + int entry = 0; + int size = Marshal.SizeOf (palette) + (Marshal.SizeOf (entry) * entries.Length); + IntPtr lfBuffer = Marshal.AllocHGlobal(size); + + palette.Flags = Flags; + palette.Count = entries.Length; + + int[] values = new int[palette.Count]; + + for (int i = 0; i < values.Length; i++) { + values[i] = entries[i].ToArgb(); + } + + Marshal.StructureToPtr (palette, lfBuffer, false); + Marshal.Copy (values, 0, (IntPtr) (lfBuffer.ToInt32() + Marshal.SizeOf (palette)), values.Length); + + return lfBuffer; + } + + internal void setFromGDIPalette (IntPtr palette) + { + IntPtr ptr = palette; + int cnt, color; + + flags = Marshal.ReadInt32 (ptr); ptr = (IntPtr) (ptr.ToInt32() + 4); + cnt = Marshal.ReadInt32 (ptr); ptr = (IntPtr) (ptr.ToInt32() + 4); + + entries = new Color [cnt]; + + for (int i = 0; i < cnt; i++) { + color = Marshal.ReadInt32 (ptr); + entries[i] = Color.FromArgb (color); + ptr = (IntPtr) (ptr.ToInt32() + 4); + } + } +#endif + } +} diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/EmfPlusRecordType.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/EmfPlusRecordType.cs new file mode 100644 index 00000000000..f068a4afcb2 --- /dev/null +++ b/mcs/class/System.Drawing/System.Drawing.Imaging/EmfPlusRecordType.cs @@ -0,0 +1,289 @@ +// +// System.Drawing.Imaging.EmfPlusRecordType.cs +// +// (C) 2002 Ximian, Inc. http://www.ximian.com +// Author: Dennis Hayes (dennish@raytek.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; +namespace System.Drawing.Imaging +{ + [Serializable] + public enum EmfPlusRecordType { + BeginContainer = 16423, + BeginContainerNoParams = 16424, + Clear = 16393, + Comment = 16387, + DrawArc = 16402, + DrawBeziers = 16409, + DrawClosedCurve = 16407, + DrawCurve = 16408, + DrawDriverString = 16438, + DrawEllipse = 16399, + DrawImage = 16410, + DrawImagePoints = 16411, + DrawLines = 16397, + DrawPath = 16405, + DrawPie = 16401, + DrawRects = 16395, + DrawString = 16412, + EmfAbortPath = 68, + EmfAlphaBlend = 114, + EmfAngleArc = 41, + EmfArcTo = 55, + EmfBeginPath = 59, + EmfBitBlt = 76, + EmfChord = 46, + EmfCloseFigure = 61, + EmfColorCorrectPalette = 111, + EmfColorMatchToTargetW = 121, + EmfCreateBrushIndirect = 39, + EmfCreateColorSpace = 99, + EmfCreateColorSpaceW = 122, + EmfCreateDibPatternBrushPt = 94, + EmfCreateMonoBrush = 93, + EmfCreatePalette = 49, + EmfCreatePen = 38, + EmfDeleteColorSpace = 101, + EmfDeleteObject = 40, + EmfDrawEscape = 105, + EmfEllipse = 42, + EmfEndPath = 60, + EmfEof = 14, + EmfExcludeClipRect = 29, + EmfExtCreateFontIndirect = 82, + EmfExtCreatePen = 95, + EmfExtEscape = 106, + EmfExtFloodFill = 53, + EmfExtSelectClipRgn = 75, + EmfExtTextOutA = 83, + EmfExtTextOutW = 84, + EmfFillPath = 62, + EmfFillRgn = 71, + EmfFlattenPath = 65, + EmfForceUfiMapping = 109, + EmfFrameRgn = 72, + EmfGdiComment = 70, + EmfGlsBoundedRecord = 103, + EmfGlsRecord = 102, + EmfGradientFill = 118, + EmfHeader = 1, + EmfIntersectClipRect = 30, + EmfInvertRgn = 73, + EmfLineTo = 54, + EmfMaskBlt = 78, + EmfMax = 122, + EmfMin = 1, + EmfModifyWorldTransform = 36, + EmfMoveToEx = 27, + EmfNamedEscpae = 110, + EmfOffsetClipRgn = 26, + EmfPaintRgn = 74, + EmfPie = 47, + EmfPixelFormat = 104, + EmfPlgBlt = 79, + EmfPlusRecordBase = 16384, + EmfPolyBezier = 2, + EmfPolyBezier16 = 85, + EmfPolyBezierTo = 5, + EmfPolyBezierTo16 = 88, + EmfPolyDraw = 56, + EmfPolyDraw16 = 92, + EmfPolygon = 3, + EmfPolygon16 = 86, + EmfPolyline = 4, + EmfPolyPolygon16 = 91, + EmfPolyPolyline = 7, + EmfPolyline16 = 87, + EmfPolyPolygon = 8, + EmfPolyPolyline16 = 90, + EmfPolyTextOutA = 96, + EmfPolyTextOutW = 97, + EmfRealizePalette = 52, + EmfRectangle = 43, + EmfReserved069 = 69, + EmfReserved117 = 117, + EmfResizePalette = 51, + EmfRestoreDC = 34, + EmfRoundArc = 45, + EmfRoundRect = 44, + EmfSaveDC = 33, + EmfScaleViewportExtEx = 31, + EmfScaleWindowExtEx = 32, + EmfSelectClipPath = 67, + EmfSelectObject = 37, + EmfSelectPalette = 48, + EmfSetArcDirection = 57, + EmfSetBkColor = 25, + EmfSetBkMode = 18, + EmfSetBrushOrgEx = 13, + EmfSetColorAdjustment = 23, + EmfSetColorSpace = 100, + EmfSetDIBitsToDevice = 80, + EmfSetIcmMode = 98, + EmfSetIcmProfileA = 112, + EmfSetIcmProfileW = 113, + EmfSetLayout = 115, + EmfSetLinkedUfis = 119, + EmfSetMapMode = 17, + EmfSetMapperFlags = 16, + EmfSetMetaRgn = 28, + EmfSetMiterLimit = 58, + EmfSetPaletteEntries = 50, + EmfSetPixelV = 15, + EmfSetPolyFillMode = 19, + EmfSetROP2 = 20, + EmfSetStretchBltMode = 21, + EmfSetTextAlign = 22, + EmfSetTextColor = 24, + EmfSetTextJustification =120 , + EmfSetViewportExtEx = 11, + EmfSetViewportOrgEx = 12, + EmfSetWindowExtEx = 9, + EmfSetWindowOrgEx = 10, + EmfSetWorldTransform = 35, + EmfSmallTextOut = 108, + EmfStartDoc = 107, + EmfStretchBlt = 77, + EmfStretchDIBits = 81, + EmfStrokeAndFillPath = 63, + EmfStrokePath = 64, + EmfTransparentBlt = 116, + EmfWidenPath = 66, + EndContainer = 16425, + EndOfFile = 16386, + FillClosedCurve = 16406, + FillEllipse = 16398, + FillPath = 16404, + FillPie = 16400, + FillPolygon = 16396, + FillRects = 16394, + FillRegion = 16403, + GetDC = 16388, + Header = 16385, + Invalid = 16384, + Max = 16438, + Min = 16385, + MultiFormatEnd = 16391, + MultiFormatSection = 16390, + MultiFormatStart = 16389, + MultiplyWorldTransform = 16428, + Object = 16392, + OffsetClip = 16437, + ResetClip = 16433, + ResetWorldTransform = 16427, + Restore = 16422, + RotateWorldTransform = 16431, + Save = 16421, + ScaleWorldTransform = 16430, + SetAntiAliasMode = 16414, + SetClipPath = 16435, + SetClipRect = 16434, + SetClipRegion = 16436, + SetCompositingMode = 16419, + SetCompositingQuality = 16420, + SetInterpolationMode = 16417, + SetPageTransform = 16432, + SetPixelOffsetMode = 16418, + SetRenderingOrigin = 16413, + SetTextContrast = 16416, + SetTextRenderingHint = 16415, + SetWorldTransform = 16426, + Total = 16439, + TranslateWorldTransform = 16429, + WmfAnimatePalette = 66614, + WmfArc = 67607, + WmfBitBlt = 67874, + WmfChord = 67632, + WmfCreateBrushIndirect = 66300, + WmfCreateFontIndirect = 66299, + WmfCreatePalette = 65783, + WmfCreatePatternBrush = 66041, + WmfCreatePenIndirect = 66298, + WmfCreateRegion = 67327, + WmfDeleteObject = 66032, + WmfDibBitBlt = 67904, + WmfDibCreatePatternBrush = 65858, + WmfFillRegion = 66088, + WmfFloodFill = 66585, + WmfFrameRegion = 66601, + WmfIntersectClipRect = 66582, + WmfInvertRegion = 65834, + WmfLineTo = 66067, + WmfMoveTo = 66068, + WmfOffsetCilpRgn = 66080, + WmfOffsetViewportOrg = 66065, + WmfOffsetWindowOrg = 66063, + WmfPaintRegion = 65835, + WmfPatBlt = 67101, + WmfPie = 67610, + WmfPolygon = 66340, + WmfPolyline = 66341, + WmfPolyPolygon = 66872, + WmfRealizePalette = 65589, + WmfRecordBase = 65536, + WmfRectangle = 66587, + WmfResizePalette = 65849, + WmfRestoreDC = 65831, + WmfRoundRect = 67100, + WmfSaveDC = 65566, + WmfScaleViewportExt = 66578, + WmfScaleWindowExt = 66576, + WmfSelectClipRegion = 65836, + WmfSelectObject = 65837, + WmfSelectPalette = 66100, + WmfSetBkColor = 66049, + WmfSetBkMode = 65794, + WmfSetDibToDev = 68915, + WmfSetLayout = 65865, + WmfSetMapMode = 65795, + WmfSetMapperFlags = 66097, + WmfSetPalEntries = 65591, + WmfSetPixel = 66591, + WmfSetPolyFillMode = 65798, + WmfSetRelAbs = 65797, + WmfSetROP2 = 65796, + WmfSetStretchBltMode = 65799, + WmfSetTextAlign = 65838, + WmfSetTextCharExtra = 65800, + WmfSetTextColor = 66057, + WmfSetTextJustification = 66058, + WmfSetViewportExt = 66062, + WmfSetViewportOrg = 66061, + WmfSetWindowExt = 66060, + WmfSetWindowOrg = 66059, + WmfStretchBlt = 68387, + WmfStretchDib = 69443, + WmfTextOut = 66849, + EmfPolyLineTo = 6, + EmfPolylineTo16 = 89, + WmfDibStretchBlt = 68417, + WmfEllipse = 66584, + WmfEscape = 67110, + WmfExcludeClipRect = 66581, + WmfExtFloodFill = 66888, + WmfExtTextOut = 68146 + } +} diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/EmfType.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/EmfType.cs new file mode 100644 index 00000000000..76287fd72c3 --- /dev/null +++ b/mcs/class/System.Drawing/System.Drawing.Imaging/EmfType.cs @@ -0,0 +1,39 @@ +// +// System.Drawing.Imaging.EmfType.cs +// +// (C) 2002 Ximian, Inc. http://www.ximian.com +// Author: Dennis Hayes (dennish@raytek.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; +namespace System.Drawing.Imaging +{ + [Serializable] + public enum EmfType { + EmfOnly = 3, + EmfPlusDual = 5, + EmfPlusOnly = 4 + } +} diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/Encoder.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/Encoder.cs new file mode 100644 index 00000000000..e085b6c7fbe --- /dev/null +++ b/mcs/class/System.Drawing/System.Drawing.Imaging/Encoder.cs @@ -0,0 +1,79 @@ +// +// System.Drawing.Imaging.Encoder.cs +// +// (C) 2004 Novell, Inc. http://www.novell.com +// Author: Ravindra (rkumar@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; + +namespace System.Drawing.Imaging +{ + public sealed class Encoder + { + private Guid guid; + + public static readonly Encoder ChrominanceTable; + public static readonly Encoder ColorDepth; + public static readonly Encoder Compression; + public static readonly Encoder LuminanceTable; + public static readonly Encoder Quality; + public static readonly Encoder RenderMethod; + public static readonly Encoder SaveFlag; + public static readonly Encoder ScanMethod; + public static readonly Encoder Transformation; + public static readonly Encoder Version; + + static Encoder () + { + // GUID values are taken from my windows machine. + ChrominanceTable = new Encoder ("f2e455dc-09b3-4316-8260-676ada32481c"); + ColorDepth = new Encoder ("66087055-ad66-4c7c-9a18-38a2310b8337"); + Compression = new Encoder ("e09d739d-ccd4-44ee-8eba-3fbf8be4fc58"); + LuminanceTable = new Encoder ("edb33bce-0266-4a77-b904-27216099e717"); + Quality = new Encoder ("1d5be4b5-fa4a-452d-9cdd-5db35105e7eb"); + RenderMethod = new Encoder ("6d42c53a-229a-4825-8bb7-5c99e2b9a8b8"); + SaveFlag = new Encoder ("292266fc-ac40-47bf-8cfc-a85b89a655de"); + ScanMethod = new Encoder ("3a4e2661-3109-4e56-8536-42c156e7dcfa"); + Transformation = new Encoder ("8d0eb2d1-a58e-4ea8-aa14-108074b7b6f9"); + Version = new Encoder ("24d18c76-814a-41a4-bf53-1c219cccf797"); + } + + internal Encoder (String guid) { + this.guid = new Guid (guid); + } + + public Encoder (Guid guid) { + this.guid = guid; + } + + public Guid Guid { + get { + return guid; + } + } + } +} diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/EncoderParameter.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/EncoderParameter.cs new file mode 100644 index 00000000000..d11bf4ecce3 --- /dev/null +++ b/mcs/class/System.Drawing/System.Drawing.Imaging/EncoderParameter.cs @@ -0,0 +1,358 @@ +// +// System.Drawing.Imaging.EncoderParameter.cs +// +// Author: +// Ravindra (rkumar@novell.com) +// Vladimir Vukicevic (vladimir@pobox.com) +// +// (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 { + + [StructLayout(LayoutKind.Sequential)] + public sealed class EncoderParameter : IDisposable { + + private Encoder encoder; + private int valuesCount; + private EncoderParameterValueType type; + private IntPtr valuePtr; + + internal EncoderParameter () + { + } + + public EncoderParameter (Encoder encoder, byte value) + { + this.encoder = encoder; + this.valuesCount = 1; + this.type = EncoderParameterValueType.ValueTypeByte; + this.valuePtr = Marshal.AllocHGlobal (1); + Marshal.WriteByte (this.valuePtr, value); + } + + public EncoderParameter (Encoder encoder, byte[] value) + { + this.encoder = encoder; + this.valuesCount = value.Length; + this.type = EncoderParameterValueType.ValueTypeByte; + this.valuePtr = Marshal.AllocHGlobal (1 * valuesCount); + Marshal.Copy (value, 0, this.valuePtr, valuesCount); + } + + public EncoderParameter (Encoder encoder, short value) + { + this.encoder = encoder; + this.valuesCount = 1; + this.type = EncoderParameterValueType.ValueTypeShort; + this.valuePtr = Marshal.AllocHGlobal (2); + Marshal.WriteInt16 (this.valuePtr, value); + } + + public EncoderParameter (Encoder encoder, short[] value) + { + this.encoder = encoder; + this.valuesCount = value.Length; + this.type = EncoderParameterValueType.ValueTypeShort; + this.valuePtr = Marshal.AllocHGlobal (2 * valuesCount); + Marshal.Copy (value, 0, this.valuePtr, valuesCount); + } + + + public EncoderParameter (Encoder encoder, long value) + { + this.encoder = encoder; + this.valuesCount = 1; + this.type = EncoderParameterValueType.ValueTypeLong; + this.valuePtr = Marshal.AllocHGlobal (4); + Marshal.WriteInt32 (this.valuePtr, (int) value); + } + + public EncoderParameter (Encoder encoder, long[] value) + { + this.encoder = encoder; + this.valuesCount = value.Length; + this.type = EncoderParameterValueType.ValueTypeLong; + this.valuePtr = Marshal.AllocHGlobal (4 * valuesCount); + int [] ivals = new int[value.Length]; + for (int i = 0; i < value.Length; i++) ivals[i] = (int) value[i]; + Marshal.Copy (ivals, 0, this.valuePtr, valuesCount); + } + + public EncoderParameter (Encoder encoder, string value) + { + this.encoder = encoder; + + ASCIIEncoding ascii = new ASCIIEncoding (); + int asciiByteCount = ascii.GetByteCount (value); + byte[] bytes = new byte [asciiByteCount]; + ascii.GetBytes (value, 0, value.Length, bytes, 0); + + this.valuesCount = bytes.Length; + this.type = EncoderParameterValueType.ValueTypeAscii; + this.valuePtr = Marshal.AllocHGlobal (valuesCount); + Marshal.Copy (bytes, 0, this.valuePtr, valuesCount); + } + + public EncoderParameter (Encoder encoder, byte value, bool undefined) + { + this.encoder = encoder; + this.valuesCount = 1; + if (undefined) + this.type = EncoderParameterValueType.ValueTypeUndefined; + else + this.type = EncoderParameterValueType.ValueTypeByte; + this.valuePtr = Marshal.AllocHGlobal (1); + Marshal.WriteByte (this.valuePtr, value); + } + + public EncoderParameter (Encoder encoder, byte[] value, bool undefined) + { + this.encoder = encoder; + this.valuesCount = value.Length; + if (undefined) + this.type = EncoderParameterValueType.ValueTypeUndefined; + else + this.type = EncoderParameterValueType.ValueTypeByte; + this.valuePtr = Marshal.AllocHGlobal (valuesCount); + Marshal.Copy (value, 0, this.valuePtr, valuesCount); + } + + public EncoderParameter (Encoder encoder, int numerator, int denominator) + { + this.encoder = encoder; + this.valuesCount = 1; + this.type = EncoderParameterValueType.ValueTypeRational; + this.valuePtr = Marshal.AllocHGlobal (8); + int [] valuearray = { numerator, denominator }; + Marshal.Copy (valuearray, 0, this.valuePtr, valuearray.Length); + } + + public EncoderParameter (Encoder encoder, int[] numerator, int[] denominator) + { + if (numerator.Length != denominator.Length) + throw new ArgumentException ("Invalid parameter used."); + + this.encoder = encoder; + this.valuesCount = numerator.Length; + this.type = EncoderParameterValueType.ValueTypeRational; + this.valuePtr = Marshal.AllocHGlobal (4 * valuesCount * 2); + IntPtr dest = this.valuePtr; + for (int i = 0; i < valuesCount; i++) { + Marshal.WriteInt32 (dest, (int) numerator[i]); + dest = (IntPtr) ((int) dest + 4); + Marshal.WriteInt32 (dest, (int) denominator[i]); + dest = (IntPtr) ((int) dest + 4); + } + } + + public EncoderParameter (Encoder encoder, long rangebegin, long rangeend) + { + this.encoder = encoder; + this.valuesCount = 1; + this.type = EncoderParameterValueType.ValueTypeLongRange; + this.valuePtr = Marshal.AllocHGlobal (8); + int [] valuearray = { (int) rangebegin, (int) rangeend }; + Marshal.Copy (valuearray, 0, this.valuePtr, valuearray.Length); + } + + public EncoderParameter (Encoder encoder, long[] rangebegin, long[] rangeend) + { + if (rangebegin.Length != rangeend.Length) + throw new ArgumentException ("Invalid parameter used."); + + this.encoder = encoder; + this.valuesCount = rangebegin.Length; + this.type = EncoderParameterValueType.ValueTypeLongRange; + + this.valuePtr = Marshal.AllocHGlobal (4 * valuesCount * 2); + IntPtr dest = this.valuePtr; + for (int i = 0; i < valuesCount; i++) { + Marshal.WriteInt32 (dest, (int) rangebegin[i]); + dest = (IntPtr) ((int) dest + 4); + Marshal.WriteInt32 (dest, (int) rangeend[i]); + dest = (IntPtr) ((int) dest + 4); + } + } + + public EncoderParameter (Encoder encoder, int numberOfValues, int type, int value) + { + this.encoder = encoder; + this.valuePtr = (IntPtr) value; + this.valuesCount = numberOfValues; + this.type = (EncoderParameterValueType) type; + } + + public EncoderParameter (Encoder encoder, int numerator1, int denominator1, int numerator2, int denominator2) + { + this.encoder = encoder; + this.valuesCount = 1; + this.type = EncoderParameterValueType.ValueTypeRationalRange; + this.valuePtr = Marshal.AllocHGlobal (4 * 4); + int [] valuearray = { numerator1, denominator1, numerator2, denominator2 }; + Marshal.Copy (valuearray, 0, this.valuePtr, 4); + } + + public EncoderParameter (Encoder encoder, int[] numerator1, int[] denominator1, int[] numerator2, int[] denominator2) + { + if (numerator1.Length != denominator1.Length || + numerator2.Length != denominator2.Length || + numerator1.Length != numerator2.Length) + throw new ArgumentException ("Invalid parameter used."); + + this.encoder = encoder; + this.valuesCount = numerator1.Length; + this.type = EncoderParameterValueType.ValueTypeRationalRange; + + this.valuePtr = Marshal.AllocHGlobal (4 * valuesCount * 4); + IntPtr dest = this.valuePtr; + for (int i = 0; i < valuesCount; i++) { + Marshal.WriteInt32 (dest, numerator1[i]); + dest = (IntPtr) ((int) dest + 4); + Marshal.WriteInt32 (dest, denominator1[i]); + dest = (IntPtr) ((int) dest + 4); + Marshal.WriteInt32 (dest, numerator2[i]); + dest = (IntPtr) ((int) dest + 4); + Marshal.WriteInt32 (dest, denominator2[i]); + dest = (IntPtr) ((int) dest + 4); + } + } + + 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) { + if (valuePtr != IntPtr.Zero) { + Marshal.FreeHGlobal (valuePtr); + valuePtr = IntPtr.Zero; + } + } + + public void Dispose () { + Dispose (true); + GC.SuppressFinalize(this); + } + + ~EncoderParameter () { + Dispose (false); + } + + internal static int NativeSize () { + return Marshal.SizeOf (typeof(GdipEncoderParameter)); + } + + internal void ToNativePtr (IntPtr epPtr) { + GdipEncoderParameter ep = new GdipEncoderParameter (); + ep.guid = this.encoder.Guid; + ep.numberOfValues = (uint) this.valuesCount; + ep.type = this.type; + ep.value = this.valuePtr; + Marshal.StructureToPtr (ep, epPtr, false); + } + + internal static EncoderParameter FromNativePtr (IntPtr epPtr) { + GdipEncoderParameter ep; + ep = (GdipEncoderParameter) Marshal.PtrToStructure (epPtr, typeof(GdipEncoderParameter)); + + Type valType; + uint valCount; + + switch (ep.type) { + case EncoderParameterValueType.ValueTypeAscii: + case EncoderParameterValueType.ValueTypeByte: + case EncoderParameterValueType.ValueTypeUndefined: + valType = typeof(byte); + valCount = ep.numberOfValues; + break; + case EncoderParameterValueType.ValueTypeShort: + valType = typeof(short); + valCount = ep.numberOfValues; + break; + case EncoderParameterValueType.ValueTypeLong: + valType = typeof(int); + valCount = ep.numberOfValues; + break; + case EncoderParameterValueType.ValueTypeLongRange: + case EncoderParameterValueType.ValueTypeRational: + valType = typeof(int); + valCount = ep.numberOfValues * 2; + break; + case EncoderParameterValueType.ValueTypeRationalRange: + valType = typeof(int); + valCount = ep.numberOfValues * 4; + break; + default: + return null; + } + + EncoderParameter eparam = new EncoderParameter(); + eparam.encoder = new Encoder(ep.guid); + eparam.valuesCount = (int) ep.numberOfValues; + eparam.type = ep.type; + eparam.valuePtr = Marshal.AllocHGlobal ((int)(valCount * Marshal.SizeOf(valType))); + + /* There's nothing in Marshal to do a memcpy() between two IntPtrs. This sucks. */ + unsafe { + byte *s = (byte *) ep.value; + byte *d = (byte *) eparam.valuePtr; + for (int i = 0; i < valCount * Marshal.SizeOf(valType); i++) + *d++ = *s++; + } + + return eparam; + } + } +} diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/EncoderParameter.jvm.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/EncoderParameter.jvm.cs new file mode 100755 index 00000000000..0f9d42b85f1 --- /dev/null +++ b/mcs/class/System.Drawing/System.Drawing.Imaging/EncoderParameter.jvm.cs @@ -0,0 +1,189 @@ +// +// System.Drawing.Imaging.EncoderParameter.cs +// +// Author: +// Ravindra (rkumar@novell.com) +// Vladimir Vukicevic (vladimir@pobox.com) +// +// (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 { + + [MonoTODO] + public sealed class EncoderParameter : IDisposable { + + private Encoder encoder; + private int valuesCount; + private EncoderParameterValueType type; + + internal EncoderParameter () + { + } + + [MonoTODO] + public EncoderParameter (Encoder encoder, byte value) + { + throw new NotImplementedException(); + } + + [MonoTODO] + public EncoderParameter (Encoder encoder, byte[] value) + { + throw new NotImplementedException(); + } + + [MonoTODO] + public EncoderParameter (Encoder encoder, short value) + { + throw new NotImplementedException(); + } + + [MonoTODO] + public EncoderParameter (Encoder encoder, short[] value) + { + throw new NotImplementedException(); + } + + [MonoTODO] + public EncoderParameter (Encoder encoder, long value) + { + throw new NotImplementedException(); + } + + [MonoTODO] + public EncoderParameter (Encoder encoder, long[] value) + { + throw new NotImplementedException(); + } + + [MonoTODO] + public EncoderParameter (Encoder encoder, string value) + { + throw new NotImplementedException(); + } + + [MonoTODO] + public EncoderParameter (Encoder encoder, byte value, bool undefined) + { + throw new NotImplementedException(); + } + + [MonoTODO] + public EncoderParameter (Encoder encoder, byte[] value, bool undefined) + { + throw new NotImplementedException(); + } + + [MonoTODO] + public EncoderParameter (Encoder encoder, int numerator, int denominator) + { + throw new NotImplementedException(); + } + + [MonoTODO] + public EncoderParameter (Encoder encoder, int[] numerator, int[] denominator) + { + throw new NotImplementedException(); + } + + [MonoTODO] + public EncoderParameter (Encoder encoder, long rangebegin, long rangeend) + { + throw new NotImplementedException(); + } + + [MonoTODO] + public EncoderParameter (Encoder encoder, long[] rangebegin, long[] rangeend) + { + throw new NotImplementedException(); + } + + [MonoTODO] + public EncoderParameter (Encoder encoder, int numberOfValues, int type, int value) + { + throw new NotImplementedException(); + } + + [MonoTODO] + public EncoderParameter (Encoder encoder, int numerator1, int denominator1, int numerator2, int denominator2) + { + throw new NotImplementedException(); + } + + [MonoTODO] + 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); + } + + } +} diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/EncoderParameterValueType.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/EncoderParameterValueType.cs new file mode 100644 index 00000000000..e1b72c937ab --- /dev/null +++ b/mcs/class/System.Drawing/System.Drawing.Imaging/EncoderParameterValueType.cs @@ -0,0 +1,44 @@ +// +// System.Drawing.Imaging.EncoderParameterValueType.cs +// +// (C) 2002 Ximian, Inc. http://www.ximian.com +// Author: Dennis Hayes (dennish@raytek.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; +namespace System.Drawing.Imaging +{ + [Serializable] + public enum EncoderParameterValueType : int { + ValueTypeAscii = 2, + ValueTypeByte = 1, + ValueTypeLong = 4, + ValueTypeLongRange = 6, + ValueTypeRational = 5, + ValueTypeRationalRange = 8, + ValueTypeShort = 3, + ValueTypeUndefined = 7 + } +} diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/EncoderParameters.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/EncoderParameters.cs new file mode 100644 index 00000000000..dd5dada5f8c --- /dev/null +++ b/mcs/class/System.Drawing/System.Drawing.Imaging/EncoderParameters.cs @@ -0,0 +1,115 @@ +// +// System.Drawing.Imaging.EncoderParameters.cs +// +// Author: +// Ravindra (rkumar@novell.com) +// Vladimir Vukicevic (vladimir@pobox.com) +// +// (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.Runtime.InteropServices; + +namespace System.Drawing.Imaging +{ + public sealed class EncoderParameters : IDisposable + { + private EncoderParameter[] parameters; + + public EncoderParameters () { + parameters = new EncoderParameter[1]; + } + + public EncoderParameters (int count) { + parameters = new EncoderParameter[count]; + } + + public EncoderParameter[] Param { + get { + return parameters; + } + + set { + parameters = value; + } + } + + public void Dispose () { + // Nothing + GC.SuppressFinalize(this); + } +#if !TARGET_JVM + internal IntPtr ToNativePtr () { + IntPtr result; + IntPtr ptr; + + // 4 is the initial int32 "count" value + result = Marshal.AllocHGlobal (4 + parameters.Length * EncoderParameter.NativeSize()); + + ptr = result; + Marshal.WriteInt32 (ptr, parameters.Length); + + ptr = (IntPtr) ((int) ptr + 4); + for (int i = 0; i < parameters.Length; i++) { + parameters[i].ToNativePtr (ptr); + ptr = (IntPtr) ((int) ptr + EncoderParameter.NativeSize()); + } + + return result; + } + + /* The IntPtr passed in here is a blob returned from + * GdipImageGetEncoderParameterList. Its internal pointers + * (i.e. the Value pointers in the EncoderParameter entries) + * point to areas within this block of memeory; this means + * that we need to free it as a whole, and also means that + * we can't Marshal.PtrToStruct our way to victory. + */ + internal static EncoderParameters FromNativePtr (IntPtr epPtr) { + if (epPtr == IntPtr.Zero) + return null; + + IntPtr ptr = epPtr; + + int count = Marshal.ReadInt32 (ptr); + ptr = (IntPtr) ((int) ptr + 4); + + if (count == 0) + return null; + + EncoderParameters result = new EncoderParameters (count); + + for (int i = 0; i < count; i++) { + result.parameters[i] = EncoderParameter.FromNativePtr (ptr); + ptr = (IntPtr) ((int) ptr + EncoderParameter.NativeSize()); + } + + return result; + } +#endif + } +} diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/EncoderValue.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/EncoderValue.cs new file mode 100644 index 00000000000..6f054fe5af3 --- /dev/null +++ b/mcs/class/System.Drawing/System.Drawing.Imaging/EncoderValue.cs @@ -0,0 +1,60 @@ +// +// System.Drawing.Imaging.EncoderValue.cs +// +// (C) 2002 Ximian, Inc. http://www.ximian.com +// Author: Dennis Hayes (dennish@raytek.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; +namespace System.Drawing.Imaging +{ + [Serializable] + public enum EncoderValue { + ColorTypeCMYK = 0, + ColorTypeYCCK = 1, + CompressionCCITT3 = 3, + CompressionCCITT4 = 4, + CompressionLZW = 2, + CompressionNone = 6, + CompressionRle = 5, + Flush = 20, + FrameDimensionPage = 23, + FrameDimensionResolution = 22, + FrameDimensionTime = 21, + LastFrame = 19, + MultiFrame = 18, + RenderNonProgressive = 12, + RenderProgressive = 11, + ScanMethodInterlaced = 7, + ScanMethodNonInterlaced = 8, + TransformFlipHorizontal = 16, + TransformFlipVertical = 17, + TransformRotate180 = 14, + TransformRotate270 = 15, + TransformRotate90 = 13, + VersionGif87 = 9, + VersionGif89 = 10 + } +} diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/FrameDimension.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/FrameDimension.cs new file mode 100644 index 00000000000..ad6f7feb37a --- /dev/null +++ b/mcs/class/System.Drawing/System.Drawing.Imaging/FrameDimension.cs @@ -0,0 +1,93 @@ +// created on 21.02.2002 at 17:06 +// +// FrameDimension.cs +// +// Author: Christian Meyer +// eMail: Christian.Meyer@cs.tum.edu +// Dennis Hayes (dennish@raytek.com) +// Sanjay Gupta <gsanjay@novell.com> +// Jordi Mas i Hernanez (jordi@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. +// + +namespace System.Drawing.Imaging { + +using System; + +public sealed class FrameDimension { + + readonly Guid guid; + + // constructor + public FrameDimension(Guid guid) + { + this.guid = guid; + } + + //properties + public Guid Guid { + get { + return guid; + } + } + + public static FrameDimension Page { + get { + return new FrameDimension (new Guid ("7462dc86-6180-4c7e-8e3f-ee7333a7a483")); + } + } + + public static FrameDimension Resolution { + get { + return new FrameDimension (new Guid ("84236f7b-3bd3-428f-8dab-4ea1439ca315" )); + } + } + + public static FrameDimension Time { + get { + return new FrameDimension (new Guid ("6aedbd6d-3fb5-418a-83a6-7f45229dc872" )); + } + } + + //methods + public override bool Equals(object o) + { + if (!(o is FrameDimension)) + return false; + + return (guid == ((FrameDimension)o).guid); + } + + public override int GetHashCode() + { + return guid.GetHashCode (); + } + + public override string ToString() + { + return "FrameDimension :" + guid; + } + +} +} diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/ImageAttributes.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/ImageAttributes.cs new file mode 100644 index 00000000000..380756f17e0 --- /dev/null +++ b/mcs/class/System.Drawing/System.Drawing.Imaging/ImageAttributes.cs @@ -0,0 +1,433 @@ +// +// System.Drawing.Imaging.ImageAttributes.cs +// +// Author: +// Dennis Hayes (dennish@raytek.com) (stubbed out) +// Jordi Mas i Hernàndez (jmas@softcatala.org) +// Sanjay Gupta (gsanjay@novell.com) +// +// (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.Drawing; +using System.Drawing.Drawing2D; +using System.Runtime.InteropServices; + +namespace System.Drawing.Imaging +{ + /// <summary> + /// Summary description for ImageAttributes. + /// </summary> + [StructLayout(LayoutKind.Sequential)] + public sealed class ImageAttributes : ICloneable, IDisposable { + + private IntPtr nativeImageAttr = IntPtr.Zero; + + internal IntPtr NativeObject{ + get{ + return nativeImageAttr; + } + } + + internal ImageAttributes(IntPtr native) + { + nativeImageAttr = native; + } + + public ImageAttributes() { + + Status status = GDIPlus.GdipCreateImageAttributes(out nativeImageAttr); + + if (status != Status.Ok) + throw new Exception ("Error calling GDIPlus.GdipCreateImageAttributes:" +status); + + } + + public void ClearBrushRemapTable() + { + ClearRemapTable (ColorAdjustType.Brush); + } + + //Clears the color keys for all GDI+ objects + public void ClearColorKey() + { + ClearColorKey (ColorAdjustType.Default); + } + + public void ClearColorKey(ColorAdjustType type) + { + Status status = GDIPlus.GdipSetImageAttributesColorKeys (nativeImageAttr, + type, false, 0, 0); + + GDIPlus.CheckStatus (status); + } + + public void ClearColorMatrix() + { + ClearColorMatrix (ColorAdjustType.Default); + } + + public void ClearColorMatrix(ColorAdjustType type) + { + Status status = GDIPlus.GdipSetImageAttributesColorMatrix (nativeImageAttr, + type, false, null, null, ColorMatrixFlag.Default); + + GDIPlus.CheckStatus (status); + } + + public void ClearGamma() + { + ClearGamma (ColorAdjustType.Default); + } + + public void ClearGamma(ColorAdjustType type) + { + Status status = GDIPlus.GdipSetImageAttributesGamma (nativeImageAttr, type, false, 0); + + GDIPlus.CheckStatus (status); + } + + public void ClearNoOp() + { + ClearNoOp (ColorAdjustType.Default); + } + + public void ClearNoOp(ColorAdjustType type) + { + Status status = GDIPlus.GdipSetImageAttributesNoOp (nativeImageAttr, type, false); + + GDIPlus.CheckStatus (status); + } + + public void ClearOutputChannel() + { + ClearOutputChannel (ColorAdjustType.Default); + } + + public void ClearOutputChannel(ColorAdjustType type) + { + Status status = GDIPlus.GdipSetImageAttributesOutputChannel (nativeImageAttr, + type, false, ColorChannelFlag.ColorChannelLast); + + GDIPlus.CheckStatus (status); + } + + public void ClearOutputChannelColorProfile() + { + ClearOutputChannelColorProfile (ColorAdjustType.Default); + } + + public void ClearOutputChannelColorProfile(ColorAdjustType type) + { + Status status = GDIPlus.GdipSetImageAttributesOutputChannelColorProfile (nativeImageAttr, + type, false, null); + + GDIPlus.CheckStatus (status); + } + + public void ClearRemapTable() + { + ClearRemapTable (ColorAdjustType.Default); + } + + public void ClearRemapTable(ColorAdjustType type) + { + Status status = GDIPlus.GdipSetImageAttributesRemapTable (nativeImageAttr, + type, false, 0, IntPtr.Zero); + + GDIPlus.CheckStatus (status); + } + + public void ClearThreshold() + { + ClearThreshold (ColorAdjustType.Default); + } + + public void ClearThreshold(ColorAdjustType type) + { + Status status = GDIPlus.GdipSetImageAttributesThreshold (nativeImageAttr, + type, false, 0); + + GDIPlus.CheckStatus (status); + } + + //Sets the color keys for all GDI+ objects + public void SetColorKey(Color colorLow, Color colorHigh) + { + + Status status = GDIPlus.GdipSetImageAttributesColorKeys(nativeImageAttr, + ColorAdjustType.Default, true, colorLow.ToArgb(), colorHigh.ToArgb()); + + if (status != Status.Ok) + throw new Exception ("Error calling GDIPlus.GdipSetImageAttributesColorKeys:" +status); + } + + public void SetColorMatrix(ColorMatrix colorMatrix) + { + + Status status = GDIPlus.GdipSetImageAttributesColorMatrix(nativeImageAttr, ColorAdjustType.Default, + true, colorMatrix, (ColorMatrix)null, ColorMatrixFlag.Default); + + if (status != Status.Ok) + throw new Exception ("Error calling GDIPlus.SetColorMatrix:" +status); + } + + public void SetColorMatrix(ColorMatrix colorMatrix, ColorMatrixFlag colorMatrixFlag) + { + + Status status = GDIPlus.GdipSetImageAttributesColorMatrix(nativeImageAttr, ColorAdjustType.Default, + true, colorMatrix, (ColorMatrix)null, colorMatrixFlag); + if (status != Status.Ok) + throw new Exception ("Error calling GDIPlus.SetColorMatrix:" +status); + + } + + public void SetColorMatrix(ColorMatrix colorMatrix, ColorMatrixFlag colorMatrixFlag, ColorAdjustType colorAdjustType) { + + Status status = GDIPlus.GdipSetImageAttributesColorMatrix(nativeImageAttr,colorAdjustType, + true, colorMatrix, (ColorMatrix)null, colorMatrixFlag); + + if (status != Status.Ok) + throw new Exception ("Error calling GDIPlus.SetColorMatrix:" +status); + } + + public void Dispose() + { + if (nativeImageAttr != IntPtr.Zero) { + + Status status = GDIPlus.GdipDisposeImageAttributes(nativeImageAttr); + GDIPlus.CheckStatus (status); + nativeImageAttr = IntPtr.Zero; + } + + System.GC.SuppressFinalize (this); + } + + ~ImageAttributes() + { + Dispose (); + } + + public object Clone() + { + IntPtr imgclone; + + Status status = GDIPlus.GdipCloneImageAttributes (nativeImageAttr, out imgclone); + GDIPlus.CheckStatus (status); + + return new ImageAttributes (imgclone); + } + + public void GetAdjustedPalette(ColorPalette palette, ColorAdjustType type) + { + IntPtr colorPalette; + + Status status = GDIPlus.GdipGetImageAttributesAdjustedPalette (nativeImageAttr, + out colorPalette, type); + + palette.setFromGDIPalette (colorPalette); + GDIPlus.CheckStatus (status); + } + + public void SetBrushRemapTable(ColorMap[] map) + { + GdiColorMap gdiclr = new GdiColorMap (); + IntPtr clrmap, lpPointer; + int mapsize = Marshal.SizeOf (gdiclr); + int size = mapsize * map.Length; + clrmap = lpPointer = Marshal.AllocHGlobal (size); + + for (int i=0; i < map.Length; i++) + { + gdiclr.from = map[i].OldColor.ToArgb(); + gdiclr.to = map[i].NewColor.ToArgb(); + + Marshal.StructureToPtr (gdiclr, lpPointer, false); + lpPointer = (IntPtr) (lpPointer.ToInt32() + mapsize); + } + + Status status = GDIPlus.GdipSetImageAttributesRemapTable (nativeImageAttr, + ColorAdjustType.Brush, true, (uint) map.Length, clrmap); + + Marshal.FreeHGlobal (clrmap); + + GDIPlus.CheckStatus (status); + } + + + public void SetColorKey(Color colorLow, Color colorHigh, ColorAdjustType type) + { + Status status = GDIPlus.GdipSetImageAttributesColorKeys (nativeImageAttr, + type, true, colorLow.ToArgb (), colorHigh.ToArgb ()); + + GDIPlus.CheckStatus (status); + } + + + public void SetColorMatrices(ColorMatrix newColorMatrix, ColorMatrix grayMatrix) + { + Status status = GDIPlus.GdipSetImageAttributesColorMatrix (nativeImageAttr, + ColorAdjustType.Default, true, newColorMatrix, grayMatrix, ColorMatrixFlag.Default); + + GDIPlus.CheckStatus (status); + } + + public void SetColorMatrices(ColorMatrix newColorMatrix, ColorMatrix grayMatrix, ColorMatrixFlag flags) + { + Status status = GDIPlus.GdipSetImageAttributesColorMatrix (nativeImageAttr, + ColorAdjustType.Default, true, newColorMatrix, grayMatrix, flags); + + GDIPlus.CheckStatus (status); + } + + public void SetColorMatrices(ColorMatrix newColorMatrix, ColorMatrix grayMatrix, ColorMatrixFlag mode, ColorAdjustType type) + { + Status status = GDIPlus.GdipSetImageAttributesColorMatrix (nativeImageAttr, + ColorAdjustType.Default, true, newColorMatrix, grayMatrix, mode); + + GDIPlus.CheckStatus (status); + } + + public void SetGamma(float gamma) + { + SetGamma (gamma, ColorAdjustType.Default); + } + + public void SetGamma(float gamma, ColorAdjustType coloradjust) + { + Status status = GDIPlus.GdipSetImageAttributesGamma (nativeImageAttr, coloradjust, true, + gamma); + + GDIPlus.CheckStatus (status); + } + + public void SetNoOp() + { + SetNoOp (ColorAdjustType.Default); + } + + public void SetNoOp(ColorAdjustType type) + { + Status status = GDIPlus.GdipSetImageAttributesNoOp (nativeImageAttr, + type, true); + + GDIPlus.CheckStatus (status); + } + + public void SetOutputChannel(ColorChannelFlag flags) + { + SetOutputChannel (flags, ColorAdjustType.Default); + } + + public void SetOutputChannel(ColorChannelFlag flags, ColorAdjustType type) + { + Status status = GDIPlus.GdipSetImageAttributesOutputChannel (nativeImageAttr, + type, true, flags); + + GDIPlus.CheckStatus (status); + } + + public void SetOutputChannelColorProfile(string colorProfileFilename) + { + SetOutputChannelColorProfile (colorProfileFilename, ColorAdjustType.Default); + } + + public void SetOutputChannelColorProfile(string colorProfileFilename, ColorAdjustType type) + { + Status status = GDIPlus.GdipSetImageAttributesOutputChannelColorProfile (nativeImageAttr, + type, true, colorProfileFilename); + + GDIPlus.CheckStatus (status); + } + + public void SetRemapTable(ColorMap[] map) + { + SetRemapTable (map, ColorAdjustType.Default); + } + + + public void SetRemapTable(ColorMap[] map, ColorAdjustType type) + { + GdiColorMap gdiclr = new GdiColorMap (); + IntPtr clrmap, lpPointer; + int mapsize = Marshal.SizeOf (gdiclr); + int size = mapsize * map.Length; + clrmap = lpPointer = Marshal.AllocHGlobal (size); + + for (int i=0; i < map.Length; i++) + { + gdiclr.from = map[i].OldColor.ToArgb(); + gdiclr.to = map[i].NewColor.ToArgb(); + + Marshal.StructureToPtr (gdiclr, lpPointer, false); + lpPointer = (IntPtr) (lpPointer.ToInt32() + mapsize); + } + + Status status = GDIPlus.GdipSetImageAttributesRemapTable (nativeImageAttr, + type, true, (uint) map.Length, clrmap); + + Marshal.FreeHGlobal (clrmap); + + GDIPlus.CheckStatus (status); + + } + + public void SetThreshold(float threshold) + { + SetThreshold (threshold, ColorAdjustType.Default); + } + + public void SetThreshold(float threshold, ColorAdjustType type) + { + Status status = GDIPlus.GdipSetImageAttributesThreshold (nativeImageAttr, + type, true, 0); + + GDIPlus.CheckStatus (status); + } + + public void SetWrapMode(WrapMode mode) + { + SetWrapMode (mode, Color.Black); + } + + + public void SetWrapMode(WrapMode mode, Color color) + { + SetWrapMode (mode, color, false); + } + + + public void SetWrapMode(WrapMode mode, Color color, bool clamp) + { + Status status = GDIPlus.GdipSetImageAttributesWrapMode (nativeImageAttr, mode, + color.ToArgb(), clamp); + + GDIPlus.CheckStatus (status); + } + + } +} diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/ImageAttributes.jvm.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/ImageAttributes.jvm.cs new file mode 100755 index 00000000000..fde74ff8cf0 --- /dev/null +++ b/mcs/class/System.Drawing/System.Drawing.Imaging/ImageAttributes.jvm.cs @@ -0,0 +1,298 @@ + +using System; +using System.Drawing; +using System.Drawing.Drawing2D; + +namespace System.Drawing.Imaging +{ + /// <summary> + /// Summary description for ImageAttributes. + /// </summary>
+ ///
+ [MonoTODO]
+ public sealed class ImageAttributes : ICloneable, IDisposable
+ {
+ [MonoTODO]
+ public ImageAttributes()
+ {
+ }
+
+ public void 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 diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/ImageCodec.jvm.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/ImageCodec.jvm.cs new file mode 100644 index 00000000000..2eff947138a --- /dev/null +++ b/mcs/class/System.Drawing/System.Drawing.Imaging/ImageCodec.jvm.cs @@ -0,0 +1,700 @@ +using System;
+using System.Configuration;
+using System.Collections;
+using System.Collections.Specialized;
+using System.Drawing.Imaging;
+using System.Xml;
+using Mainsoft.Drawing.Configuration;
+
+using imageio = javax.imageio;
+using stream = javax.imageio.stream;
+using awt = java.awt;
+using image = java.awt.image;
+using spi = javax.imageio.spi;
+using dom = org.w3c.dom;
+
+namespace Mainsoft.Drawing.Imaging {
+ /// <summary>
+ /// Summary description for ImageCodec.
+ /// </summary>
+ public class ImageCodec : IDisposable {
+
+ #region Members
+
+ imageio.ImageReader _nativeReader = null;
+ imageio.ImageWriter _nativeWriter = null;
+ stream.ImageInputStream _nativeStream = null;
+
+ ImageFormat _imageFormat = null;
+
+ int _currentFrame = 0;
+
+ #endregion
+
+ #region Constructros
+
+ protected ImageCodec() {
+ }
+
+ static ImageCodec() {
+ }
+
+ #endregion
+
+ #region Internal properties
+
+ internal imageio.ImageReader NativeReader {
+ get { return _nativeReader; }
+ set {
+ _nativeReader = value;
+ if (value == null)
+ return;
+ _imageFormat = MimeTypesToImageFormat( value.getOriginatingProvider().getMIMETypes() );
+ }
+ }
+ internal imageio.ImageWriter NativeWriter {
+ get { return _nativeWriter; }
+ set {
+ _nativeWriter = value;
+ if (value == null)
+ return;
+ _imageFormat = MimeTypesToImageFormat( value.getOriginatingProvider().getMIMETypes() );
+ }
+ }
+
+ internal stream.ImageInputStream NativeStream {
+ get { return _nativeStream; }
+ set {
+ _nativeStream = value;
+ if (value == null)
+ return;
+
+ if (NativeReader != null)
+ NativeReader.setInput( value );
+
+ if (NativeWriter != null)
+ NativeWriter.setOutput( value );
+ }
+ }
+
+ #endregion
+
+ #region ImageCodec factory methods
+
+ public static ImageCodec CreateReader(stream.ImageInputStream inputStream) {
+ java.util.Iterator iter = imageio.ImageIO.getImageReaders( inputStream );
+ return CreateReader(iter);
+ }
+
+ public static ImageCodec CreateReader(ImageFormat imageFormat) {
+ return CreateReader( ImageFormatToClsid( imageFormat ) );
+ }
+
+ public static ImageCodec CreateReader(Guid clsid) {
+ ImageCodec codec = null;
+ try {
+ ImageCodecInfo codecInfo = FindDecoder(clsid);
+ java.util.Iterator iter = imageio.ImageIO.getImageReadersByMIMEType( codecInfo.MimeType );
+ codec = CreateReader(iter);
+ }
+ catch {}
+
+ if (codec == null) {
+ ImageFormat format = ClsidToImageFormat(clsid);
+ string name = (format != null) ? format.ToString() : clsid.ToString();
+ throw new NotSupportedException(String.Format("The '{0}' format decoder is not installed.", name));
+ }
+
+ return codec;
+ }
+
+ private static ImageCodec CreateReader(java.util.Iterator iter) {
+ if ( !iter.hasNext() ) + return null; +
+ ImageCodec imageCodec = new ImageCodec();
+ imageCodec.NativeReader = (imageio.ImageReader) iter.next();
+ return imageCodec;
+ }
+
+ public static ImageCodec CreateWriter(ImageFormat imageFormat) {
+ return CreateWriter( ImageFormatToClsid( imageFormat ) );
+ }
+
+ public static ImageCodec CreateWriter(Guid clsid) {
+ ImageCodec codec = null;
+ try {
+ ImageCodecInfo codecInfo = FindEncoder(clsid);
+ java.util.Iterator iter = imageio.ImageIO.getImageWritersByMIMEType( codecInfo.MimeType );
+ codec = CreateWriter(iter);
+ }
+ catch {}
+
+ if (codec == null) {
+ ImageFormat format = ClsidToImageFormat(clsid);
+ string name = (format != null) ? format.ToString() : clsid.ToString();
+ throw new NotSupportedException(String.Format("The '{0}' format encoder is not installed.", name));
+ }
+
+ return codec;
+ }
+
+ private static ImageCodec CreateWriter(java.util.Iterator iter) {
+ if ( !iter.hasNext() ) + return null; +
+ ImageCodec imageCodec = new ImageCodec();
+ imageCodec.NativeWriter = (imageio.ImageWriter) iter.next();
+ return imageCodec;
+ }
+
+ #endregion
+
+ #region Codec enumerations
+
+ internal static Hashtable Decoders { + get { + const string MYNAME = "System.Drawing.Imaging.ImageCodecInfo.decoders"; + Hashtable o = (Hashtable) AppDomain.CurrentDomain.GetData (MYNAME); + if (o != null) + return o; + o = new ReaderSpiIterator().Iterate(); + AppDomain.CurrentDomain.SetData(MYNAME, o); + return o; + } + } + + internal static Hashtable Encoders { + get { + const string MYNAME = "System.Drawing.Imaging.ImageCodecInfo.encoders"; + Hashtable o = (Hashtable) AppDomain.CurrentDomain.GetData (MYNAME); + if (o != null) + return o; + o = new WriterSpiIterator().Iterate(); + AppDomain.CurrentDomain.SetData(MYNAME, o); + return o; + } + } + + internal static ImageCodecInfo FindEncoder (Guid clsid) { + ImageCodecInfo codec = (ImageCodecInfo) Encoders[clsid]; + if (codec == null) { + // .net saves in png if cannot find requested encoder. atc id 316563 + codec = (ImageCodecInfo) Encoders[ ImageCodec.PngClsid ]; + } + return codec; + } + + internal static ImageCodecInfo FindDecoder (Guid clsid) { + ImageCodecInfo codec = (ImageCodecInfo) Decoders[clsid]; + if (codec == null) {
+ ImageFormat format = ClsidToImageFormat(clsid);
+ string name = (format != null) ? format.ToString() : clsid.ToString();
+ throw new NotSupportedException(String.Format("The '{0}' format decoder is not installed.", name));
+ }
+ return codec;
+ } +
+ #endregion
+
+ #region SpiIterators + + abstract class BaseSpiIterator { + protected abstract java.util.Iterator GetIterator (string mimeType); + protected abstract spi.ImageReaderWriterSpi GetNext (java.util.Iterator iter); + + #region ProcessOneCodec + private ImageCodecInfo ProcessOneCodec (Guid clsid, Guid formatID, string mimeType) { + ImageCodecInfo ici = new ImageCodecInfo (); + ici.Clsid = clsid; + ici.FormatID = formatID; + ici.MimeType = mimeType; + java.util.Iterator iter = null; + try { + iter = GetIterator (mimeType); + } + catch(Exception) { + return null; + } + while (iter.hasNext ()) { + spi.ImageReaderWriterSpi rw = GetNext (iter); + + ici.CodecName = rw.getDescription (java.util.Locale.getDefault ()); + //ici.DllName = null; + foreach (string suffix in rw.getFileSuffixes ()) { + if (ici.FilenameExtension != null) + ici.FilenameExtension += ";"; + ici.FilenameExtension += "*."+suffix; + } + ici.Flags = ImageCodecFlags.Builtin|ImageCodecFlags.SupportBitmap; + if (rw is spi.ImageReaderSpi) + ici.Flags |= ImageCodecFlags.Decoder; + + if (rw is spi.ImageWriterSpi) + ici.Flags |= ImageCodecFlags.Encoder; + + ici.FormatDescription = string.Join(";", + rw.getFormatNames()); + try { + ici.Version = (int)Convert.ToDouble(rw.getVersion ()); + } + catch (Exception) { + ici.Version = 1; + } + break; + } + return ici; + } + #endregion + + internal Hashtable Iterate () { + // TBD: Insert Exception handling here + NameValueCollection nvc = (NameValueCollection) System.Configuration.ConfigurationSettings + .GetConfig ("system.drawing/codecs"); + Hashtable codecs = new Hashtable (10); + + for (int i=0; i<nvc.Count; i++) { + Guid clsid = new Guid (nvc.GetKey (i)); + ImageFormat format = ClsidToImageFormat (clsid); + ImageCodecInfo codec = ProcessOneCodec (clsid, format.Guid, nvc[i]); + if ((codec != null) && (codec.FilenameExtension != null)) + codecs [clsid] = codec; + } + return codecs; + } + } + + class ReaderSpiIterator: BaseSpiIterator { + protected override java.util.Iterator GetIterator(string mimeType) {
+ return imageio.ImageIO.getImageReadersByMIMEType (mimeType);
+ }
+ protected override javax.imageio.spi.ImageReaderWriterSpi GetNext(java.util.Iterator iter) {
+ imageio.ImageReader r = (imageio.ImageReader) iter.next ();
+ return r.getOriginatingProvider ();
+ }
+ } + + class WriterSpiIterator: BaseSpiIterator { + protected override java.util.Iterator GetIterator(string mimeType) {
+ return imageio.ImageIO.getImageWritersByMIMEType (mimeType);
+ }
+ protected override javax.imageio.spi.ImageReaderWriterSpi GetNext(java.util.Iterator iter) {
+ imageio.ImageWriter w = (imageio.ImageWriter) iter.next ();
+ return w.getOriginatingProvider ();
+ }
+ } + #endregion +
+ #region Clsid and FormatID + static Guid BmpClsid = new Guid ("557cf400-1a04-11d3-9a73-0000f81ef32e"); + static Guid JpegClsid = new Guid ("557cf401-1a04-11d3-9a73-0000f81ef32e"); + static Guid GifClsid = new Guid ("557cf402-1a04-11d3-9a73-0000f81ef32e"); + static Guid EmfClsid = new Guid ("557cf403-1a04-11d3-9a73-0000f81ef32e"); + static Guid WmfClsid = new Guid ("557cf404-1a04-11d3-9a73-0000f81ef32e"); + static Guid TiffClsid = new Guid ("557cf405-1a04-11d3-9a73-0000f81ef32e"); + static Guid PngClsid = new Guid ("557cf406-1a04-11d3-9a73-0000f81ef32e"); + static Guid IconClsid = new Guid ("557cf407-1a04-11d3-9a73-0000f81ef32e"); + + private static ImageFormat MimeTypesToImageFormat (string [] mimeTypes) { + foreach (ImageCodecInfo codec in Decoders.Values) + for (int i=0; i<mimeTypes.Length; i++) + if (codec.MimeType == mimeTypes [i]) + return new ImageFormat (codec.FormatID); + return null; + } + + internal static ImageFormat ClsidToImageFormat (Guid clsid) { + if (clsid.Equals (BmpClsid)) + return ImageFormat.Bmp; + else if (clsid.Equals (JpegClsid)) + return ImageFormat.Jpeg; + else if (clsid.Equals (GifClsid)) + return ImageFormat.Gif; + else if (clsid.Equals (EmfClsid)) + return ImageFormat.Emf; + else if (clsid.Equals (WmfClsid)) + return ImageFormat.Wmf; + else if (clsid.Equals (TiffClsid)) + return ImageFormat.Tiff; + else if (clsid.Equals (PngClsid)) + return ImageFormat.Png; + else if (clsid.Equals (IconClsid)) + return ImageFormat.Icon; + else + return null; + } + + internal static Guid ImageFormatToClsid (ImageFormat format) { + if (format == null) + return Guid.Empty; + + if (format.Guid.Equals (ImageFormat.Bmp.Guid)) + return BmpClsid; + else if (format.Guid.Equals (ImageFormat.Jpeg.Guid)) + return JpegClsid; + else if (format.Guid.Equals (ImageFormat.Gif)) + return GifClsid; + else if (format.Guid.Equals (ImageFormat.Emf.Guid)) + return EmfClsid; + else if (format.Guid.Equals (ImageFormat.Wmf.Guid)) + return WmfClsid; + else if (format.Guid.Equals (ImageFormat.Tiff.Guid)) + return TiffClsid; + else if (format.Guid.Equals (ImageFormat.Png.Guid)) + return PngClsid; + else if (format.Guid.Equals (ImageFormat.Icon.Guid)) + return IconClsid; + else + return Guid.Empty; + } + + private FrameDimension FormatFrameDimesion { + get { + if (ImageFormat == null) + return FrameDimension.Page; + + if (ImageFormat.Guid.Equals (ImageFormat.Bmp.Guid)) + return FrameDimension.Page; + else if (ImageFormat.Guid.Equals (ImageFormat.Jpeg.Guid)) + return FrameDimension.Page; + else if (ImageFormat.Guid.Equals (ImageFormat.Gif)) + return FrameDimension.Time; + else if (ImageFormat.Guid.Equals (ImageFormat.Emf.Guid)) + return FrameDimension.Page; + else if (ImageFormat.Guid.Equals (ImageFormat.Wmf.Guid)) + return FrameDimension.Page; + else if (ImageFormat.Guid.Equals (ImageFormat.Tiff.Guid)) + return FrameDimension.Page; + else if (ImageFormat.Guid.Equals (ImageFormat.Png.Guid)) + return FrameDimension.Page; + else if (ImageFormat.Guid.Equals (ImageFormat.Icon.Guid)) + return FrameDimension.Resolution; + else + return FrameDimension.Page; + } + } + + #endregion +
+ #region Image read/write methods
+
+ internal PlainImage ReadPlainImage() {
+ awt.Image img = ReadImage( _currentFrame );
+ if (img == null)
+ return null;
+
+ // its possible to fail to load thumbnails and metadata, but image is ok.
+ awt.Image [] th = null;
+#if THUMBNAIL_SUPPORTED
+ try {
+ th = ReadThumbnails( _currentFrame );
+ }
+ catch (Exception) {}
+#endif
+
+ XmlDocument md = null;
+ imageio.metadata.IIOMetadata nativeMd = null;
+ try {
+ nativeMd = ReadImageMetadata( _currentFrame );
+ md = ConvertImageMetadata( nativeMd );
+ }
+ catch (Exception) {}
+
+ float [] resolution = GetResolution( md );
+
+ PlainImage pi = new PlainImage( img, th, ImageFormat, resolution[0], resolution[1], FormatFrameDimesion );
+ pi.NativeMetadata = nativeMd;
+ return pi;
+ }
+
+ internal PlainImage ReadNextPlainImage() {
+ _currentFrame++;
+ return ReadPlainImage();
+ }
+
+ private awt.Image ReadImage(int frame) {
+ if (NativeStream == null)
+ throw new Exception("Input stream not specified");
+
+ try {
+ return NativeReader.read (frame); + } + catch (java.lang.IndexOutOfBoundsException) { + return null; + } + catch (java.io.IOException ex) { + throw new System.IO.IOException(ex.Message, ex); + } + }
+
+#if THUMBNAIL_SUPPORTED
+ private awt.Image [] ReadThumbnails(int frameIndex) {
+ awt.Image [] thArray = null; + + try { + if (NativeReader.readerSupportsThumbnails()) { + int tmbNumber = NativeReader.getNumThumbnails(frameIndex); + + if (tmbNumber > 0) { + thArray = new awt.Image[ tmbNumber ]; + + for (int i = 0; i < tmbNumber; i++) { + thArray[i] = NativeReader.readThumbnail(frameIndex, i); + } + } + }
+ return thArray;
+ }
+ catch (java.io.IOException ex) { + throw new System.IO.IOException(ex.Message, ex); + } + }
+#endif
+ internal void WritePlainImage(PlainImageCollection pic) {
+ if ((pic == null) || (pic.Count == 0))
+ return;
+
+ if (pic.Count == 1) {
+ WritePlainImage( pic[0] );
+ return;
+ }
+
+ try {
+ if (NativeWriter.canWriteSequence ()) {
+ NativeWriter.prepareWriteSequence (null);
+ for (int i=0; i < pic.Count; i++) {
+ imageio.IIOImage iio = GetIIOImageContainer( pic[i] );
+ NativeWriter.writeToSequence (iio, null);
+ }
+ NativeWriter.endWriteSequence ();
+ }
+ else
+ WritePlainImage( pic[0] );
+ }
+ catch (java.io.IOException ex) { + throw new System.IO.IOException(ex.Message, ex); + } + }
+
+ internal void WritePlainImage(PlainImage pi) {
+ try {
+ imageio.IIOImage iio = GetIIOImageContainer( pi );
+ WriteImage( iio );
+ }
+ catch (java.io.IOException ex) { + throw new System.IO.IOException(ex.Message, ex); + }
+ }
+
+ private void WriteImage(imageio.IIOImage iio) {
+ if (NativeStream == null)
+ throw new Exception("Output stream not specified");
+
+ NativeWriter.write( iio );
+ }
+
+ private imageio.IIOImage GetIIOImageContainer(PlainImage pi) {
+ java.util.ArrayList al = null;
+
+ // prepare thumbnails list
+ if (pi.Thumbnails != null) {
+ al = new java.util.ArrayList( pi.Thumbnails.Length );
+ for (int i=0; i < pi.Thumbnails.Length; i++)
+ al.add(pi.Thumbnails[i]);
+ }
+
+ // prepare IIOImage container
+ if (pi.NativeImage is image.BufferedImage) {
+ imageio.IIOImage iio = new javax.imageio.IIOImage(
+ (image.BufferedImage)pi.NativeImage, al, null /*pi.NativeMetadata*/);
+ return iio;
+ }
+ else
+ // TBD: This codec is for raster formats only
+ throw new NotSupportedException("Only raster formats are supported");
+ }
+
+
+ private imageio.metadata.IIOMetadata ReadImageMetadata(int frameIndex) {
+ if (NativeStream == null)
+ throw new Exception("Input stream not specified");
+
+ try {
+ imageio.metadata.IIOMetadata md = NativeReader.getImageMetadata( frameIndex );
+ return md;
+ }
+ catch (java.io.IOException ex) { + throw new System.IO.IOException(ex.Message, ex); + } + }
+
+ #endregion
+
+ #region Extra properties
+
+ public ImageFormat ImageFormat {
+ get { return _imageFormat; }
+ }
+
+ #endregion
+
+ #region Metadata parse
+
+ private float [] GetResolution(XmlDocument metaData) {
+ if (metaData == null)
+ return new float[]{0, 0};
+
+ ResolutionConfigurationCollection rcc = + (ResolutionConfigurationCollection) + ConfigurationSettings.GetConfig("system.drawing/codecsmetadata"); + + if (rcc == null) + throw new ConfigurationException("Configuration section codecsmetadata not found"); + + ResolutionConfiguration rc = rcc[ ImageFormat.ToString() ]; + + if (rc == null) + return new float[]{0, 0}; + + // Horizontal resolution + string xResPath = rc.XResPath; + string xRes; + + if (xResPath == string.Empty) + xRes = rc.XResDefault; + else + xRes = GetValueFromMetadata(metaData, xResPath); + + if ((xRes == null) || (xRes == string.Empty)) + xRes = rc.XResDefault; + + // Vertical resolution + string yResPath = rc.YResPath; + string yRes; + + if (yResPath == string.Empty) + yRes = rc.YResDefault; + else + yRes = GetValueFromMetadata(metaData, yResPath); + + if ((yRes == null) || (yRes == string.Empty)) + yRes = rc.YResDefault; + + // Resolution units + string resUnitsPath = rc.UnitsTypePath; + string resUnitsType; + + if (resUnitsPath == string.Empty) + resUnitsType = rc.UnitsTypeDefault; + else + resUnitsType = GetValueFromMetadata(metaData, resUnitsPath); + + if (resUnitsType == null) + resUnitsType = rc.UnitsTypeDefault; + + // Unit scale + string unitScale = rc.UnitsScale[resUnitsType].ToString(); + + // Adjust resolution to its units + float [] res = new float[2]; + res[0] = ParseFloatValue(xRes) * ParseFloatValue(unitScale); + res[1] = ParseFloatValue(yRes) * ParseFloatValue(unitScale); + + return res; + }
+
+ private string GetValueFromMetadata(XmlDocument metaData, string path) {
+ XmlNode n = metaData.SelectSingleNode(path);
+ if (n == null)
+ return null;
+
+ return n.InnerText;
+ }
+
+ private XmlDocument ConvertImageMetadata(imageio.metadata.IIOMetadata metaData) {
+ string [] formatNames = metaData.getMetadataFormatNames(); + dom.Element rootNode = (dom.Element) metaData.getAsTree(formatNames[0]); + + XmlDocument _metadataDocument = new XmlDocument();
+ XmlConvert(rootNode, _metadataDocument);
+
+ return _metadataDocument;
+ }
+
+ private void XmlConvert(dom.Node jNode, XmlNode nNode) {
+ XmlDocument document = nNode.OwnerDocument;
+ if (document == null)
+ document = (XmlDocument)nNode;
+
+ XmlNode n = null;
+ switch (jNode.getNodeType()) {
+ case 1 :
+ n = document.CreateNode(XmlNodeType.Element, jNode.getNodeName(), jNode.getNamespaceURI());
+ break;
+
+ case 4 :
+ n = document.CreateNode(XmlNodeType.CDATA, jNode.getNodeName(), jNode.getNamespaceURI());
+ break;
+
+ default:
+ return;
+ }
+ //set value
+ n.InnerText = jNode.getNodeValue();
+ nNode.AppendChild( n );
+
+ //copy attributes
+ org.w3c.dom.NamedNodeMap nm = jNode.getAttributes();
+ for (int i=0; i<nm.getLength(); i++) {
+ XmlAttribute a = document.CreateAttribute( nm.item(i).getNodeName() );
+ a.Value = nm.item(i).getNodeValue();
+ n.Attributes.Append( a );
+ }
+
+ //copy childs
+ org.w3c.dom.NodeList nl = jNode.getChildNodes();
+ for (int i=0; i<nl.getLength(); i++) {
+ XmlConvert(nl.item(i), n);
+ }
+ }
+
+ protected virtual float ParseFloatValue(string strValue) {
+ try {
+ if ((strValue != null) && (strValue != "")) { + int dividerPos = strValue.IndexOf("/"); + + if (dividerPos < 0) { + return float.Parse(strValue); + } + else { + return float.Parse(strValue.Substring( 0, dividerPos )) / + float.Parse(strValue.Substring( dividerPos + 1 )); + } + }
+ return float.NaN;
+ }
+ catch (Exception) {
+ return float.NaN;
+ }
+ }
+
+ #endregion
+
+ #region IDisposable members
+
+ public void Dispose() {
+ if (NativeReader != null) {
+ NativeReader.dispose();
+ NativeReader = null;
+ }
+
+ if (NativeWriter != null) {
+ NativeWriter.dispose();
+ NativeWriter = null;
+ }
+ }
+
+ #endregion
+
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/ImageCodecFlags.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/ImageCodecFlags.cs new file mode 100644 index 00000000000..671afe49689 --- /dev/null +++ b/mcs/class/System.Drawing/System.Drawing.Imaging/ImageCodecFlags.cs @@ -0,0 +1,46 @@ +// +// System.Drawing.Imaging.ImageCodecFlags.cs +// +// (C) 2002 Ximian, Inc. http://www.ximian.com +// Author: Dennis Hayes (dennish@raytek.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; +namespace System.Drawing.Imaging +{ + [Flags] + [Serializable] + public enum ImageCodecFlags { + BlockingDecode = 32, + Builtin = 65536, + Decoder = 2, + Encoder = 1, + SeekableEncode = 16, + SupportBitmap = 4, + SupportVector = 8, + System = 131072, + User = 262144 + } +} diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/ImageCodecInfo.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/ImageCodecInfo.cs new file mode 100644 index 00000000000..9acb4236407 --- /dev/null +++ b/mcs/class/System.Drawing/System.Drawing.Imaging/ImageCodecInfo.cs @@ -0,0 +1,217 @@ +// +// System.Drawing.Imaging.ImageCodecInfo.cs +// +// Authors: +// Everaldo Canuto (everaldo.canuto@bol.com.br) +// Andreas Nahr (ClassDevelopment@A-SoftTech.com) +// Dennis Hayes (dennish@raytek.com) +// Andreas Nahr (ClassDevelopment@A-SoftTech.com) +// Dennis Hayes (dennish@raytek.com) +// Jordi Mas i Hernandez (jordi@ximian.com) +// +// (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() + { + int decoderNums, arraySize, decoder_size; + IntPtr decoders, decoder_ptr; + ImageCodecInfo[] result; + GdipImageCodecInfo gdipdecoder = new GdipImageCodecInfo(); + Status status; + + status = GDIPlus.GdipGetImageDecodersSize (out decoderNums, out arraySize); + GDIPlus.CheckStatus (status); + + result = new ImageCodecInfo [decoderNums]; + + if (decoderNums == 0) + return result; + + /* Get decoders list*/ + decoders = Marshal.AllocHGlobal (arraySize); + status = GDIPlus.GdipGetImageDecoders (decoderNums, arraySize, decoders); + GDIPlus.CheckStatus (status); + + decoder_size = Marshal.SizeOf (gdipdecoder); + decoder_ptr = decoders; + + for (int i = 0; i < decoderNums; i++, decoder_ptr = new IntPtr (decoder_ptr.ToInt64 () + decoder_size)) + { + gdipdecoder = (GdipImageCodecInfo) Marshal.PtrToStructure (decoder_ptr, typeof (GdipImageCodecInfo)); + result[i] = new ImageCodecInfo (); + GdipImageCodecInfo.MarshalTo (gdipdecoder, result[i]); + } + + Marshal.FreeHGlobal (decoders); + return result; + } + + + public static ImageCodecInfo[] GetImageEncoders() + { + int encoderNums, arraySize, encoder_size; + IntPtr encoders, encoder_ptr; + ImageCodecInfo[] result; + GdipImageCodecInfo gdipencoder = new GdipImageCodecInfo(); + Status status; + + status = GDIPlus.GdipGetImageEncodersSize (out encoderNums, out arraySize); + GDIPlus.CheckStatus (status); + + result = new ImageCodecInfo [encoderNums]; + + if (encoderNums == 0) + return result; + + /* Get encoders list*/ + encoders = Marshal.AllocHGlobal (arraySize); + + status = GDIPlus.GdipGetImageEncoders (encoderNums, arraySize, encoders); + GDIPlus.CheckStatus (status); + + encoder_size = Marshal.SizeOf (gdipencoder); + encoder_ptr = encoders; + + for (int i = 0; i < encoderNums; i++, encoder_ptr = new IntPtr (encoder_ptr.ToInt64 () + encoder_size)) + { + gdipencoder = (GdipImageCodecInfo) Marshal.PtrToStructure (encoder_ptr, typeof (GdipImageCodecInfo)); + result[i] = new ImageCodecInfo (); + GdipImageCodecInfo.MarshalTo (gdipencoder, result[i]); + } + + Marshal.FreeHGlobal (encoders); + return result; + } + + // 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; } + } + + [MonoTODO] + [CLSCompliant(false)] + public byte[][] SignaturePatterns + { + get { return signaturePatterns; } + set { signaturePatterns = value; } + } + + public int Version + { + get { return version; } + set { version = value; } + } + + } + +} diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/ImageCodecInfo.jvm.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/ImageCodecInfo.jvm.cs new file mode 100755 index 00000000000..0ab16b81f6a --- /dev/null +++ b/mcs/class/System.Drawing/System.Drawing.Imaging/ImageCodecInfo.jvm.cs @@ -0,0 +1,181 @@ +// +// System.Drawing.Imaging.ImageCodecInfo.cs +// +// Authors: +// Everaldo Canuto (everaldo.canuto@bol.com.br) +// Andreas Nahr (ClassDevelopment@A-SoftTech.com) +// Dennis Hayes (dennish@raytek.com) +// Andreas Nahr (ClassDevelopment@A-SoftTech.com) +// Dennis Hayes (dennish@raytek.com) +// Jordi Mas i Hernandez (jordi@ximian.com) +// +// (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.Collections.Specialized; +using System.Configuration; +using System.IO; +using Mainsoft.Drawing.Imaging; + +using imageio = javax.imageio; +using spi = javax.imageio.spi; + +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; + + public static ImageCodecInfo[] GetImageDecoders () + { + Hashtable oldInfo = ImageCodec.Decoders; + ImageCodecInfo [] newInfo = new ImageCodecInfo [oldInfo.Count]; + int i=0; + foreach (ImageCodecInfo codec in oldInfo.Values) { + newInfo [i++] = (ImageCodecInfo) codec.MemberwiseClone (); + }
+ return newInfo; + } + + internal ImageCodecInfo () { + } + + public static ImageCodecInfo[] GetImageEncoders () + { + Hashtable oldInfo = ImageCodec.Encoders; + ImageCodecInfo [] newInfo = new ImageCodecInfo [oldInfo.Count]; + int i=0; + foreach (ImageCodecInfo codec in oldInfo.Values) { + //newInfo [i++] = (ImageCodecInfo) codec.MemberwiseClone (); + newInfo [i] = new ImageCodecInfo (); + newInfo [i].clsid = codec.clsid; + newInfo [i].formatID = codec.formatID; + newInfo [i].codecName = codec.codecName; + newInfo [i].dllName = codec.dllName; + newInfo [i].flags = codec.flags; + newInfo [i].filenameExtension = codec.filenameExtension; + newInfo [i].formatDescription = codec.formatDescription; + newInfo [i].mimeType = codec.mimeType; + newInfo [i].signatureMasks = codec.signatureMasks; + newInfo [i].signaturePatterns = codec.signaturePatterns; + newInfo [i++].version = codec.version; + } + return newInfo; + } + + // 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 { throw new NotSupportedException(); } + } + + + 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; } + } + + } + +} diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/ImageFlags.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/ImageFlags.cs new file mode 100644 index 00000000000..bc00d1bd168 --- /dev/null +++ b/mcs/class/System.Drawing/System.Drawing.Imaging/ImageFlags.cs @@ -0,0 +1,51 @@ +// +// System.Drawing.Imaging.ImageFlags.cs +// +// (C) 2002 Ximian, Inc. http://www.ximian.com +// Author: Dennis Hayes (dennish@raytek.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; +namespace System.Drawing.Imaging +{ + [Flags] + [Serializable] + public enum ImageFlags { + Caching = 131072, + ColorSpaceCmyk = 32, + ColorSpaceGray = 64, + ColorSpaceRgb = 16, + ColorSpaceYcbcr = 128, + ColorSpaceYcck = 256, + HasAlpha = 2, + HasRealDpi = 4096, + HasRealPixelSize = 8192, + HasTranslucent = 4, + None = 0, + PartiallyScalable = 8, + ReadOnly = 65536, + Scalable = 1 + } +} diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/ImageFormat.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/ImageFormat.cs new file mode 100644 index 00000000000..1a7e94043b4 --- /dev/null +++ b/mcs/class/System.Drawing/System.Drawing.Imaging/ImageFormat.cs @@ -0,0 +1,187 @@ +// +// System.Drawing.Imaging.ImageFormat.cs +// +// Authors: +// Everaldo Canuto (everaldo.canuto@bol.com.br) +// Andreas Nahr (ClassDevelopment@A-SoftTech.com) +// Dennis Hayes (dennish@raytek.com) +// Jordi Mas i Hernandez (jordi@ximian.com) +// +// (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; + +namespace System.Drawing.Imaging { + + [TypeConverter (typeof (ImageFormatConverter))] + public sealed class ImageFormat + { + private Guid guid; + private static ImageFormat BmpImageFormat = new ImageFormat (new Guid ("b96b3cab-0728-11d3-9d7b-0000f81ef32e")); + private static ImageFormat EmfImageFormat = new ImageFormat (new Guid ("b96b3cac-0728-11d3-9d7b-0000f81ef32e")); + private static ImageFormat ExifImageFormat = new ImageFormat (new Guid ("b96b3cb2-0728-11d3-9d7b-0000f81ef32e")); + private static ImageFormat GifImageFormat = new ImageFormat (new Guid ("b96b3cb0-0728-11d3-9d7b-0000f81ef32e")); + private static ImageFormat TiffImageFormat = new ImageFormat (new Guid ("b96b3cb1-0728-11d3-9d7b-0000f81ef32e")); + private static ImageFormat PngImageFormat = new ImageFormat(new Guid("b96b3caf-0728-11d3-9d7b-0000f81ef32e")); + private static ImageFormat MemoryBmpImageFormat = new ImageFormat (new Guid ("b96b3caa-0728-11d3-9d7b-0000f81ef32e")); + private static ImageFormat IconImageFormat = new ImageFormat (new Guid ("b96b3cb5-0728-11d3-9d7b-0000f81ef32e")); + private static ImageFormat JpegImageFormat = new ImageFormat(new Guid("b96b3cae-0728-11d3-9d7b-0000f81ef32e")); + private static ImageFormat WmfImageFormat = new ImageFormat (new Guid ("b96b3cad-0728-11d3-9d7b-0000f81ef32e")); + + + // constructors + public ImageFormat (Guid guid) + { + this.guid = guid; + } + + + // methods + public override bool Equals(object o) { + + if (o is ImageFormat) + if ( ((ImageFormat)o).Guid.Equals(this.Guid)) + return true; + return false; + + } + + + public override int GetHashCode() + { + return guid.GetHashCode(); + } + + + public override string ToString() + { + if (this.Equals (Bmp)) + return "Bmp"; + + if (this.Equals (Emf)) + return "Emf"; + + if (this.Equals (Exif)) + return "Exif"; + + if (this.Equals (Gif)) + return "Gif"; + + if (this.Equals (Tiff)) + return "Tiff"; + + if (this.Equals (Png)) + return "Png"; + + if (this.Equals (MemoryBmp)) + return "MemoryBmp"; + + if (this.Equals (Icon)) + return "Icon"; + + if (this.Equals (Jpeg)) + return "Jpeg"; + + if (this.Equals (Wmf)) + return "Wmf"; + + // Default + return ("[ImageFormat: " + Guid.ToString () + "]");
+ + + } + + // properties + public Guid Guid + { + get { return guid; } + } + + + 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; } + } + + } + +} diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/ImageLockMode.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/ImageLockMode.cs new file mode 100644 index 00000000000..0f810254199 --- /dev/null +++ b/mcs/class/System.Drawing/System.Drawing.Imaging/ImageLockMode.cs @@ -0,0 +1,40 @@ +// +// System.Drawing.Imaging.ImageLockMode.cs +// +// (C) 2002 Ximian, Inc. http://www.ximian.com +// Author: Dennis Hayes (dennish@raytek.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; +namespace System.Drawing.Imaging +{ + [Serializable] + public enum ImageLockMode { + ReadOnly = 1, + ReadWrite = 3, + UserInputBuffer = 4, + WriteOnly = 2 + } +} diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/MetaHeader.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/MetaHeader.cs new file mode 100644 index 00000000000..61af60d417b --- /dev/null +++ b/mcs/class/System.Drawing/System.Drawing.Imaging/MetaHeader.cs @@ -0,0 +1,94 @@ +// +// System.Drawing.Imaging.MetaHeader.cs +// +// Authors: +// Everaldo Canuto (everaldo.canuto@bol.com.br) +// Andreas Nahr (ClassDevelopment@A-SoftTech.com) +// Dennis Hayes (dennish@raytek.com) +// +// (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; + +namespace System.Drawing.Imaging { + + [StructLayout(LayoutKind.Sequential)] + public sealed class MetaHeader { + + private short headerSize; + private int maxRecord; + private short noObjects; + private short noParameters; + private int size; + private short type; + private short version; + + // constructors + public MetaHeader() + { + } + + // properties + public short HeaderSize { + get { return headerSize; } + set { headerSize = value; } + } + + public int MaxRecord { + get { return maxRecord; } + set { maxRecord = value; } + } + + public short NoObjects { + get { return noObjects; } + set { noObjects = value; } + } + + public short NoParameters { + get { return noParameters; } + set { noParameters = value; } + } + + public int Size { + get { return size; } + set { size = value; } + } + + public short Type { + get { return type; } + set { type = value; } + } + + public short Version { + get { return version; } + set { version = value; } + } + + } + +} diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/Metafile.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/Metafile.cs new file mode 100644 index 00000000000..711d80509ed --- /dev/null +++ b/mcs/class/System.Drawing/System.Drawing.Imaging/Metafile.cs @@ -0,0 +1,328 @@ +// +// System.Drawing.Imaging.Metafile.cs +// +// (C) 2002 Ximian, Inc. http://www.ximian.com +// Author: Christian Meyer +// eMail: Christian.Meyer@cs.tum.edu +// Dennis Hayes (dennish@raytek.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.IO; +using System.Reflection; +using System.ComponentModel; +using System.Runtime.InteropServices; + +namespace System.Drawing.Imaging { + + [Serializable] + [ComVisible (false)] + [Editor ("System.Drawing.Design.MetafileEditor, " + Consts.AssemblySystem_Drawing_Design, typeof (System.Drawing.Design.UITypeEditor))] + public sealed class Metafile : Image { + + // constructors + [MonoTODO] + public Metafile (Stream stream) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public Metafile (string filename) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public Metafile (IntPtr henhmetafile, bool deleteEmf) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public Metafile (IntPtr referenceHtc, EmfType emfType) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public Metafile (IntPtr referenceHtc, Rectangle frameRect) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public Metafile (IntPtr referenceHtc, RectangleF frameRect) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public Metafile (IntPtr hmetafile, WmfPlaceableFileHeader wmfHeader) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public Metafile (Stream stream, IntPtr referenceHtc) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public Metafile (String fileName, IntPtr referenceHtc) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public Metafile (IntPtr referenceHdc, EmfType emfType, string description) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public Metafile (IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public Metafile (IntPtr referenceHdc, RectangleF frameRect, MetafileFrameUnit frameUnit) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public Metafile (IntPtr hmetafile, WmfPlaceableFileHeader wmfHeader, bool deleteWmf) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public Metafile (Stream stream, IntPtr referenceHdc, EmfType type) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public Metafile (Stream stream, IntPtr referenceHdc, Rectangle frameRect) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public Metafile (Stream stream, IntPtr referenceHdc, RectangleF frameRect) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public Metafile (string fileName, IntPtr referenceHdc, EmfType type) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public Metafile (string fileName, IntPtr referenceHdc, Rectangle frameRect) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public Metafile (string fileName, IntPtr referenceHdc, RectangleF frameRect) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public Metafile (IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit, EmfType type) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public Metafile (IntPtr referenceHdc, RectangleF frameRect, MetafileFrameUnit frameUnit, EmfType type) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public Metafile (Stream stream, IntPtr referenceHtc, EmfType type, string description) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public Metafile (Stream stream, IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public Metafile (Stream stream, IntPtr referenceHdc, RectangleF frameRect, MetafileFrameUnit frameUnit) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public Metafile (string fileName, IntPtr referenceHdc, EmfType type, string description) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public Metafile (string fileName, IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public Metafile (string fileName, IntPtr referenceHdc, RectangleF frameRect, MetafileFrameUnit frameUnit) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public Metafile (IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit, EmfType type, string description) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public Metafile (IntPtr referenceHdc, RectangleF frameRect, MetafileFrameUnit frameUnit, EmfType type, string description) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public Metafile (Stream stream, IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit, EmfType type) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public Metafile (Stream stream, IntPtr referenceHdc, RectangleF frameRect, MetafileFrameUnit frameUnit, EmfType type) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public Metafile (string fileName, IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit, EmfType type) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public Metafile (string fileName, IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit, string description) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public Metafile (string fileName, IntPtr referenceHdc, RectangleF frameRect, MetafileFrameUnit frameUnit, EmfType type) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public Metafile (string fileName, IntPtr referenceHdc, RectangleF frameRect, MetafileFrameUnit frameUnit, string description) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public Metafile (Stream stream, IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit, EmfType type, + string description) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public Metafile (Stream stream, IntPtr referenceHdc, RectangleF frameRect, MetafileFrameUnit frameUnit, EmfType type, + string description) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public Metafile (string fileName, IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit, EmfType type, + string description) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public Metafile (string fileName, IntPtr referenceHdc, RectangleF frameRect, MetafileFrameUnit frameUnit, EmfType type, + string description) + { + throw new NotImplementedException (); + } + + // methods + [MonoTODO] + public IntPtr GetHenhmetafile() + { + throw new NotImplementedException (); + } + + public MetafileHeader GetMetafileHeader() + { + return GetMetafileHeader (GetHenhmetafile () ); + } + + [MonoTODO] + public static MetafileHeader GetMetafileHeader(IntPtr henhmetafile) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public static MetafileHeader GetMetafileHeader(Stream stream) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public static MetafileHeader GetMetafileHeader(string fileName) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public static MetafileHeader GetMetafileHeader(IntPtr henhmetafile, WmfPlaceableFileHeader wmfHeader) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public void PlayRecord(EmfPlusRecordType recordType, int flags, int dataSize, byte[] datawmfHeader) + { + throw new NotImplementedException (); + } + // properties + } + +} diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/Metafile.jvm.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/Metafile.jvm.cs new file mode 100644 index 00000000000..78a28c40755 --- /dev/null +++ b/mcs/class/System.Drawing/System.Drawing.Imaging/Metafile.jvm.cs @@ -0,0 +1,362 @@ +// +// System.Drawing.Imaging.Metafile.cs +// +// (C) 2002 Ximian, Inc. http://www.ximian.com +// Author: Christian Meyer +// eMail: Christian.Meyer@cs.tum.edu +// Dennis Hayes (dennish@raytek.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.IO; +using System.Reflection; +using System.ComponentModel; +using System.Runtime.InteropServices; + +namespace System.Drawing.Imaging { + + [Serializable] + [ComVisible (false)] +#if SYSTEM_DRAWING_DESIGN_SUPPORT + [Editor ("System.Drawing.Design.MetafileEditor, " + Consts.AssemblySystem_Drawing_Design, typeof (System.Drawing.Design.UITypeEditor))] +#endif + [MonoTODO] + public sealed class Metafile : Image { + + // constructors + [MonoTODO] + public Metafile (Stream stream) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public Metafile (string filename) + { + throw new NotImplementedException (); + } + +#if INTPTR_SUPPORT + + [MonoTODO] + public Metafile (IntPtr henhmetafile, bool deleteEmf) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public Metafile (IntPtr referenceHtc, EmfType emfType) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public Metafile (IntPtr referenceHtc, Rectangle frameRect) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public Metafile (IntPtr referenceHtc, RectangleF frameRect) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public Metafile (IntPtr hmetafile, WmfPlaceableFileHeader wmfHeader) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public Metafile (Stream stream, IntPtr referenceHtc) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public Metafile (String fileName, IntPtr referenceHtc) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public Metafile (IntPtr referenceHdc, EmfType emfType, string description) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public Metafile (IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public Metafile (IntPtr referenceHdc, RectangleF frameRect, MetafileFrameUnit frameUnit) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public Metafile (IntPtr hmetafile, WmfPlaceableFileHeader wmfHeader, bool deleteWmf) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public Metafile (Stream stream, IntPtr referenceHdc, EmfType type) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public Metafile (Stream stream, IntPtr referenceHdc, Rectangle frameRect) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public Metafile (Stream stream, IntPtr referenceHdc, RectangleF frameRect) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public Metafile (string fileName, IntPtr referenceHdc, EmfType type) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public Metafile (string fileName, IntPtr referenceHdc, Rectangle frameRect) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public Metafile (string fileName, IntPtr referenceHdc, RectangleF frameRect) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public Metafile (IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit, EmfType type) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public Metafile (IntPtr referenceHdc, RectangleF frameRect, MetafileFrameUnit frameUnit, EmfType type) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public Metafile (Stream stream, IntPtr referenceHtc, EmfType type, string description) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public Metafile (Stream stream, IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public Metafile (Stream stream, IntPtr referenceHdc, RectangleF frameRect, MetafileFrameUnit frameUnit) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public Metafile (string fileName, IntPtr referenceHdc, EmfType type, string description) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public Metafile (string fileName, IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public Metafile (string fileName, IntPtr referenceHdc, RectangleF frameRect, MetafileFrameUnit frameUnit) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public Metafile (IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit, EmfType type, string description) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public Metafile (IntPtr referenceHdc, RectangleF frameRect, MetafileFrameUnit frameUnit, EmfType type, string description) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public Metafile (Stream stream, IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit, EmfType type) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public Metafile (Stream stream, IntPtr referenceHdc, RectangleF frameRect, MetafileFrameUnit frameUnit, EmfType type) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public Metafile (string fileName, IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit, EmfType type) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public Metafile (string fileName, IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit, string description) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public Metafile (string fileName, IntPtr referenceHdc, RectangleF frameRect, MetafileFrameUnit frameUnit, EmfType type) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public Metafile (string fileName, IntPtr referenceHdc, RectangleF frameRect, MetafileFrameUnit frameUnit, string description) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public Metafile (Stream stream, IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit, EmfType type, + string description) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public Metafile (Stream stream, IntPtr referenceHdc, RectangleF frameRect, MetafileFrameUnit frameUnit, EmfType type, + string description) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public Metafile (string fileName, IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit, EmfType type, + string description) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public Metafile (string fileName, IntPtr referenceHdc, RectangleF frameRect, MetafileFrameUnit frameUnit, EmfType type, + string description) + { + throw new NotImplementedException (); + } + + // methods + [MonoTODO] + public IntPtr GetHenhmetafile() + { + throw new NotImplementedException (); + } +#endif + + [MonoTODO] + public MetafileHeader GetMetafileHeader() + { + throw new NotFiniteNumberException(); + } + +#if INTPTR_SUPPORT + [MonoTODO] + public static MetafileHeader GetMetafileHeader(IntPtr henhmetafile) + { + throw new NotImplementedException (); + } +#endif + [MonoTODO] + public static MetafileHeader GetMetafileHeader(Stream stream) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public static MetafileHeader GetMetafileHeader(string fileName) + { + throw new NotImplementedException (); + } + +#if INTPTR_SUPPORT + [MonoTODO] + public static MetafileHeader GetMetafileHeader(IntPtr henhmetafile, WmfPlaceableFileHeader wmfHeader) + { + throw new NotImplementedException (); + } +#endif + [MonoTODO] + public void PlayRecord(EmfPlusRecordType recordType, int flags, int dataSize, byte[] datawmfHeader) + { + throw new NotImplementedException (); + } + // properties + + [MonoTODO] + protected override void InternalSave (javax.imageio.stream.ImageOutputStream output, Guid clsid) { + throw new NotImplementedException (); + } + + [MonoTODO] + protected override PixelFormat InternalPixelFormat { + get { + throw new NotImplementedException (); + } + } + + [MonoTODO] + protected override java.awt.Image[] CloneNativeObjects(java.awt.Image[] src) { + throw new NotImplementedException (); + } + + #region Clone + [MonoTODO] + public override object Clone() { + throw new NotImplementedException (); + } + #endregion + + } + +} diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/MetafileFrameUnit.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/MetafileFrameUnit.cs new file mode 100644 index 00000000000..2635952099d --- /dev/null +++ b/mcs/class/System.Drawing/System.Drawing.Imaging/MetafileFrameUnit.cs @@ -0,0 +1,42 @@ +// +// System.Drawing.Imaging.MetafileFrameUnit.cs +// +// (C) 2002 Ximian, Inc. http://www.ximian.com +// Author: Dennis Hayes (dennish@raytek.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; +namespace System.Drawing.Imaging +{ + [Serializable] + public enum MetafileFrameUnit { + Document = 5, + GdiCompatible = 7, + Inch = 4, + Millimeter = 6, + Pixel = 2, + Point = 3 + } +} diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/MetafileHeader.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/MetafileHeader.cs new file mode 100644 index 00000000000..a248d74cc39 --- /dev/null +++ b/mcs/class/System.Drawing/System.Drawing.Imaging/MetafileHeader.cs @@ -0,0 +1,144 @@ +// +// System.Drawing.Imaging.MetafileHeader.cs +// +// (C) 2002 Ximian, Inc. http://www.ximian.com +// Author: Everaldo Canuto +// eMail: everaldo.canuto@bol.com.br +// Dennis Hayes (dennish@raytek.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; + +namespace System.Drawing.Imaging { + + [MonoTODO] +#if !TARGET_JVM + [StructLayout(LayoutKind.Sequential)] +#endif + public sealed class MetafileHeader + { + + //constructor + internal MetafileHeader() + { + //Nothing to be done here + } + + // methods + [MonoTODO] + public bool IsDisplay() { + throw new NotImplementedException (); + } + + [MonoTODO] + public bool IsEmf() { + throw new NotImplementedException (); + } + + [MonoTODO] + public bool IsEmfOrEmfPlus() { + throw new NotImplementedException (); + } + + [MonoTODO] + public bool IsEmfPlus() { + throw new NotImplementedException (); + } + + [MonoTODO] + public bool IsEmfPlusDual() { + throw new NotImplementedException (); + } + + [MonoTODO] + public bool IsEmfPlusOnly() { + throw new NotImplementedException (); + } + + [MonoTODO] + public bool IsWmf() { + throw new NotImplementedException (); + } + + [MonoTODO] + public bool IsWmfPlaceable() { + throw new NotImplementedException (); + } + + // properties + [MonoTODO] + public Rectangle Bounds { + get { throw new NotImplementedException (); } + } + + [MonoTODO] + public float DpiX { + get { throw new NotImplementedException (); } + } + + [MonoTODO] + public float DpiY { + get { throw new NotImplementedException (); } + } + + [MonoTODO] + public int EmfPlusHeaderSize { + get { throw new NotImplementedException (); } + } + + [MonoTODO] + public int LogicalDpiX { + get { throw new NotImplementedException (); } + } + + [MonoTODO] + public int LogicalDpiY { + get { throw new NotImplementedException (); } + } + + [MonoTODO] + public int MetafileSize { + get { throw new NotImplementedException (); } + } + + [MonoTODO] + public MetafileType Type { + get { throw new NotImplementedException (); } + } + + [MonoTODO] + public int Version { + get { throw new NotImplementedException (); } + } + + [MonoTODO] + public MetaHeader WmfHeader { + get { throw new NotImplementedException (); } + } + + } + +} diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/MetafileType.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/MetafileType.cs new file mode 100644 index 00000000000..24415c002ee --- /dev/null +++ b/mcs/class/System.Drawing/System.Drawing.Imaging/MetafileType.cs @@ -0,0 +1,46 @@ +// +// System.Drawing.Imaging.MetafileType +// +// Authors: +// Gonzalo Paniagua Javier (gonzalo@ximian.com) +// +// (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. +// + +namespace System.Drawing.Imaging +{ + [Serializable] + public enum MetafileType + { + Invalid = 0, + Wmf = 1, + WmfPlaceable = 2, + Emf = 3, + EmfPlusOnly = 4, + EmfPlusDual = 5 + } +} + diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/PaletteFlags.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/PaletteFlags.cs new file mode 100644 index 00000000000..11b968b47af --- /dev/null +++ b/mcs/class/System.Drawing/System.Drawing.Imaging/PaletteFlags.cs @@ -0,0 +1,39 @@ +// +// System.Drawing.Imaging.PaletteFlags.cs +// +// (C) 2002 Ximian, Inc. http://www.ximian.com +// Author: Dennis Hayes (dennish@raytek.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; +namespace System.Drawing.Imaging +{ + [Serializable] + public enum PaletteFlags { + GrayScale = 2, + Halftone = 4, + HasAlpha = 1 + } +} diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/PixelFormat.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/PixelFormat.cs new file mode 100644 index 00000000000..44a69aa6ebf --- /dev/null +++ b/mcs/class/System.Drawing/System.Drawing.Imaging/PixelFormat.cs @@ -0,0 +1,63 @@ +// created on 20.02.2002 at 21:18 +// +// Image.cs +// +// (C) 2002 Ximian, Inc. http://www.ximian.com +// Author: Christian Meyer +// eMail: Christian.Meyer@cs.tum.edu +// Dennis Hayes +// dennish@raytek.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. +// +namespace System.Drawing.Imaging { + + [Serializable] + public enum PixelFormat { + Alpha = 262144, + Canonical = 2097152, + DontCare = 0, + Extended = 1048576, + Format16bppArgb1555 = 397319, + Format16bppGrayScale = 1052676, + Format16bppRgb555 = 135173, + Format16bppRgb565 = 135174, + Format1bppIndexed = 196865, + Format24bppRgb = 137224, + Format32bppArgb = 2498570, + Format32bppPArgb = 925707, + Format32bppRgb = 139273, + Format48bppRgb = 1060876, + Format4bppIndexed = 197634, + Format64bppArgb = 3424269, + Format64bppPArgb = 1851406, + Format8bppIndexed = 198659, + Gdi = 131072, + Indexed = 65536, + Max = 15, + PAlpha = 524288, + Undefined = 0 //shows up in enumcheck as second "dontcare". + } +} diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/PlayRecordCallback.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/PlayRecordCallback.cs new file mode 100644 index 00000000000..7d7ac421726 --- /dev/null +++ b/mcs/class/System.Drawing/System.Drawing.Imaging/PlayRecordCallback.cs @@ -0,0 +1,42 @@ +// +// System.Drawing.Imaging.PlayRecordCallback.cs +// +// (C) 2002 Ximian, Inc. http://www.ximian.com +// Author: Everaldo Canuto +// eMail: everaldo.canuto@bol.com.br +// + +// +// 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; + +namespace System.Drawing.Imaging { + + [Serializable] + public delegate void PlayRecordCallback( + EmfPlusRecordType recordType, + int flags, + int dataSize, + IntPtr recordData + ); +} diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/PropertyItem.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/PropertyItem.cs new file mode 100644 index 00000000000..46b6ac51061 --- /dev/null +++ b/mcs/class/System.Drawing/System.Drawing.Imaging/PropertyItem.cs @@ -0,0 +1,77 @@ +// +// System.Drawing.Imaging.PropertyItem.cs +// +// Authors: +// Everaldo Canuto (everaldo.canuto@bol.com.br) +// Andreas Nahr (ClassDevelopment@A-SoftTech.com) +// Dennis Hayes (dennish@raytek.com) +// +// (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; + +namespace System.Drawing.Imaging { + + public sealed class PropertyItem + { + + private int id; + private int len; + private short type; + private byte[] value; + + //constructor + internal PropertyItem() + { + //Nothing to be done here + } + + + // properties + public int Id { + get { return id; } + set { id = value; } + } + + public int Len { + get { return len; } + set { len = value; } + } + + public short Type { + get { return type; } + set { type = value; } + } + + public byte[] Value { + get { return this.value; } + set { this.value = value; } + } + + } + +} diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/WmfPlaceableFileHeader.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/WmfPlaceableFileHeader.cs new file mode 100644 index 00000000000..b9c896313a3 --- /dev/null +++ b/mcs/class/System.Drawing/System.Drawing.Imaging/WmfPlaceableFileHeader.cs @@ -0,0 +1,103 @@ +// +// System.Drawing.Imaging.WmfPlaceableFileHeader.cs +// +// (C) 2002 Ximian, Inc. http://www.ximian.com +// Author: Everaldo Canuto +// eMail: everaldo.canuto@bol.com.br +// Dennis Hayes (dennish@raytek.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; + +namespace System.Drawing.Imaging { + + [StructLayout(LayoutKind.Sequential)] + public sealed class WmfPlaceableFileHeader { + + // constructors + [MonoTODO] + public WmfPlaceableFileHeader() { + throw new NotImplementedException (); + } + + // properties + [MonoTODO] + public short BboxBottom { + get { throw new NotImplementedException (); } + set { throw new NotImplementedException (); } + } + + [MonoTODO] + public short BboxLeft { + get { throw new NotImplementedException (); } + set { throw new NotImplementedException (); } + } + + [MonoTODO] + public short BboxRight { + get { throw new NotImplementedException (); } + set { throw new NotImplementedException (); } + } + + [MonoTODO] + public short BboxTop { + get { throw new NotImplementedException (); } + set { throw new NotImplementedException (); } + } + + [MonoTODO] + public short Checksum { + get { throw new NotImplementedException (); } + set { throw new NotImplementedException (); } + } + + [MonoTODO] + public short Hmf { + get { throw new NotImplementedException (); } + set { throw new NotImplementedException (); } + } + + [MonoTODO] + public short Inch { + get { throw new NotImplementedException (); } + set { throw new NotImplementedException (); } + } + + [MonoTODO] + public int Key { + get { throw new NotImplementedException (); } + set { throw new NotImplementedException (); } + } + + [MonoTODO] + public int Reserved { + get { throw new NotImplementedException (); } + set { throw new NotImplementedException (); } + } + + } + +} |