-Subproject commit bacd19776f77950059586780c871e2214e0703f8
+Subproject commit 89019f5e816873237f1f2c4ce5bb4279b0f0c790
+++ /dev/null
-//
-// System.Drawing.Design.UITypeEditor.cs
-//
-// Authors:
-// Alan Tam Siu Lung <Tam@SiuLung.com>
-// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
-//
-// (C) 2003 Alan Tam Siu Lung <Tam@SiuLung.com>
-// (C) 2003 Andreas Nahr
-// Copyright (C) 2004-2006 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.ComponentModel;
-using System.Collections;
-
-namespace System.Drawing.Design
-{
- public class UITypeEditor {
-
- static UITypeEditor ()
- {
- Hashtable editors = new Hashtable ();
- editors [typeof (Array)] = "System.ComponentModel.Design.ArrayEditor, " + Consts.AssemblySystem_Design;
- editors [typeof (byte [])] = "System.ComponentModel.Design.BinaryEditor, " + Consts.AssemblySystem_Design;
- editors [typeof (DateTime)] = "System.ComponentModel.Design.DateTimeEditor, " + Consts.AssemblySystem_Design;
- editors [typeof (IList)] = "System.ComponentModel.Design.CollectionEditor, " + Consts.AssemblySystem_Design;
- editors [typeof (ICollection)] = "System.ComponentModel.Design.CollectionEditor, " + Consts.AssemblySystem_Design;
- editors [typeof (string[])] = "System.Windows.Forms.Design.StringArrayEditor, " + Consts.AssemblySystem_Design;
-#if !MOBILE
- TypeDescriptor.AddEditorTable (typeof (UITypeEditor), editors);
-#endif
- }
-
- public UITypeEditor()
- {
- }
-
- public virtual object EditValue (ITypeDescriptorContext context,
- IServiceProvider provider, object value)
- {
- // We already stated that we can't edit ;)
- return value;
- }
-
- public object EditValue (IServiceProvider provider, object value)
- {
- return EditValue (null, provider, value);
- }
-
- public virtual UITypeEditorEditStyle GetEditStyle (ITypeDescriptorContext context)
- {
- return UITypeEditorEditStyle.None;
- }
-
- public UITypeEditorEditStyle GetEditStyle ()
- {
- return GetEditStyle (null);
- }
-
- public bool GetPaintValueSupported ()
- {
- return GetPaintValueSupported (null);
- }
-
- public virtual bool GetPaintValueSupported (ITypeDescriptorContext context)
- {
- return false;
- }
- public void PaintValue (object value, Graphics canvas, Rectangle rectangle)
- {
- PaintValue (new PaintValueEventArgs (null, value, canvas, rectangle));
- }
-
- public virtual void PaintValue (PaintValueEventArgs e)
- {
- // LAMESPEC: Did not find info in the docs if this should do something here.
- // Usually you would expect, that this class gets inherited and this overridden,
- // but on the other hand the class is not abstract. Could never observe it did paint anything
- return;
- }
- public virtual bool IsDropDownResizable {
- get { return false; }
- }
- }
-}
+++ /dev/null
-//
-// System.Drawing.Drawing2D.HatchStyle.cs
-//
-// Authors:
-// Stefan Maierhofer <sm@cg.tuwien.ac.at>
-// Dennis Hayes (dennish@Raytek.com)
-// Ravindra (rkumar@novell.com)
-//
-// (C) 2002/3 Ximian, Inc.
-// Copyright (C) 2004,2006 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.Drawing2D {
-
- public enum HatchStyle {
- BackwardDiagonal = 3,
- Cross = LargeGrid,
- DarkDownwardDiagonal = 20,
- DarkHorizontal = 29,
- DarkUpwardDiagonal = 21,
- DarkVertical = 28,
- DashedDownwardDiagonal = 30,
- DashedHorizontal = 32,
- DashedUpwardDiagonal = 31,
- DashedVertical = 33,
- DiagonalBrick = 38,
- DiagonalCross = 5,
- Divot = 42,
- DottedDiamond = 44,
- DottedGrid = 43,
- ForwardDiagonal = 2,
- Horizontal = 0,
- HorizontalBrick = 39,
- LargeCheckerBoard = 50,
- LargeConfetti = 35,
- LargeGrid = 4,
- LightDownwardDiagonal = 18,
- LightHorizontal = 25,
- LightUpwardDiagonal = 19,
- LightVertical = 24,
- Max = 4,
- Min = 0,
- NarrowHorizontal = 27,
- NarrowVertical = 26,
- OutlinedDiamond = 51,
- Percent05 = 6,
- Percent10 = 7,
- Percent20 = 8,
- Percent25 = 9,
- Percent30 = 10,
- Percent40 = 11,
- Percent50 = 12,
- Percent60 = 13,
- Percent70 = 14,
- Percent75 = 15,
- Percent80 = 16,
- Percent90 = 17,
- Plaid = 41,
- Shingle = 45,
- SmallCheckerBoard = 49,
- SmallConfetti = 34,
- SmallGrid = 48,
- SolidDiamond = 52,
- Sphere = 47,
- Trellis = 46,
- Vertical = 1,
- Wave = 37,
- Weave = 40,
- WideDownwardDiagonal = 22,
- WideUpwardDiagonal = 23,
- ZigZag = 36
- }
-}
+++ /dev/null
-//
-// Copyright 2002 Ximian, Inc. http://www.ximian.com
-// Copyright (C) 2004-2006 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.Runtime.InteropServices;
-
-namespace System.Drawing.Imaging
-{
- [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[][] newColorMatrix)
- {
- color00 = newColorMatrix [0][0];
- color01 = newColorMatrix [0][1];
- color02 = newColorMatrix [0][2];
- color03 = newColorMatrix [0][3];
- color04 = newColorMatrix [0][4];
- color10 = newColorMatrix [1][0];
- color11 = newColorMatrix [1][1];
- color12 = newColorMatrix [1][2];
- color13 = newColorMatrix [1][3];
- color14 = newColorMatrix [1][4];
- color20 = newColorMatrix [2][0];
- color21 = newColorMatrix [2][1];
- color22 = newColorMatrix [2][2];
- color23 = newColorMatrix [2][3];
- color24 = newColorMatrix [2][4];
- color30 = newColorMatrix [3][0];
- color31 = newColorMatrix [3][1];
- color32 = newColorMatrix [3][2];
- color33 = newColorMatrix [3][3];
- color34 = newColorMatrix [3][4];
- color40 = newColorMatrix [4][0];
- color41 = newColorMatrix [4][1];
- color42 = newColorMatrix [4][2];
- color43 = newColorMatrix [4][3];
- color44 = newColorMatrix [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; }
- }
-
-
- static internal IntPtr Alloc (ColorMatrix cm)
- {
- if (cm == null)
- return IntPtr.Zero;
-
- IntPtr result = Marshal.AllocHGlobal (Marshal.SizeOf (typeof (ColorMatrix)));
- Marshal.StructureToPtr (cm, result, false);
- return result;
- }
-
- static internal void Free (IntPtr cm)
- {
- if (cm != IntPtr.Zero)
- Marshal.FreeHGlobal (cm);
- }
- }
-}
+++ /dev/null
-//
-// 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 ()
- {
- 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;
- }
- }
- /* 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.ToInt64() + Marshal.SizeOf (palette)), values.Length);
-
- return lfBuffer;
- }
-
- internal void setFromGDIPalette (IntPtr palette)
- {
- IntPtr ptr = palette;
- int cnt, color;
- int offset;
-
- flags = Marshal.ReadInt32 (ptr); ptr = (IntPtr) (ptr.ToInt64() + 4);
- cnt = Marshal.ReadInt32 (ptr); ptr = (IntPtr) (ptr.ToInt64() + 4);
-
- entries = new Color [cnt];
-
- offset = 0;
- for (int i = 0; i < cnt; i++) {
- color = Marshal.ReadInt32 (ptr, offset);
- entries[i] = Color.FromArgb (color);
- offset += 4;
- }
- }
- }
-}
+++ /dev/null
-//
-// 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);
- for (int i = 0; i < valuesCount; i++) {
- Marshal.WriteInt32 (valuePtr, i * 4, (int) numerator[i]);
- Marshal.WriteInt32 (valuePtr, (i + 1) * 4, (int) denominator[i]);
- }
- }
-
- 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, i * 4, (int) rangebegin[i]);
- Marshal.WriteInt32 (dest, (i + 1) * 4, (int) rangeend[i]);
- }
- }
-
- 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 demoninator1, int numerator2, int demoninator2)
- {
- this.encoder = encoder;
- this.valuesCount = 1;
- this.type = EncoderParameterValueType.ValueTypeRationalRange;
- this.valuePtr = Marshal.AllocHGlobal (4 * 4);
- int [] valuearray = { numerator1, demoninator1, numerator2, demoninator2 };
- 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, i * 4, numerator1[i]);
- Marshal.WriteInt32 (dest, (i + 1) * 4, denominator1[i]);
- Marshal.WriteInt32 (dest, (i + 2) * 4, numerator2[i]);
- Marshal.WriteInt32 (dest, (i + 3) * 4, denominator2[i]);
- }
- }
-
- 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;
- }
- }
-}
+++ /dev/null
-//
-// System.Drawing.Imaging.EncoderParameters.cs
-//
-// Author:
-// Ravindra (rkumar@novell.com)
-// Vladimir Vukicevic (vladimir@pobox.com)
-//
-// Copyright (C) 2004, 2008 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);
- }
- 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) (ptr.ToInt64() + 4);
- for (int i = 0; i < parameters.Length; i++) {
- parameters[i].ToNativePtr (ptr);
- ptr = (IntPtr) (ptr.ToInt64 () + 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) (ptr.ToInt64() + 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) (ptr.ToInt64 () + EncoderParameter.NativeSize ());
- }
-
- return result;
- }
- }
-}
+++ /dev/null
-//
-// System.Drawing.Imaging.ImageAttributes.cs
-//
-// Authors:
-// Dennis Hayes (dennish@raytek.com) (stubbed out)
-// Jordi Mas i Hernàndez (jmas@softcatala.org)
-// Sanjay Gupta (gsanjay@novell.com)
-// Sebastien Pouliot <sebastien@ximian.com>
-//
-// (C) 2002-4 Ximian, Inc. http://www.ximian.com
-// Copyright (C) 2004, 2006-2007 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.Drawing.Drawing2D;
-using System.Runtime.InteropServices;
-
-namespace System.Drawing.Imaging {
-
- [StructLayout(LayoutKind.Sequential)]
- public sealed class ImageAttributes : ICloneable, IDisposable {
-
- private IntPtr nativeImageAttr;
-
- internal IntPtr NativeObject {
- get {
- return nativeImageAttr;
- }
- }
-
- // For compatibility with CoreFX sources
- internal IntPtr nativeImageAttributes {
- get {
- return nativeImageAttr;
- }
- }
-
- internal ImageAttributes (IntPtr native)
- {
- nativeImageAttr = native;
- }
-
- public ImageAttributes ()
- {
- Status status = GDIPlus.GdipCreateImageAttributes (out nativeImageAttr);
- GDIPlus.CheckStatus (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,
- IntPtr.Zero, IntPtr.Zero, 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)
- {
- SetColorKey (colorLow, colorHigh, ColorAdjustType.Default);
- }
-
- 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)
- {
- IntPtr cm = ColorMatrix.Alloc (newColorMatrix);
- try {
- Status status = GDIPlus.GdipSetImageAttributesColorMatrix (nativeImageAttr,
- type, true, cm, IntPtr.Zero, mode);
- GDIPlus.CheckStatus (status);
- }
- finally {
- ColorMatrix.Free (cm);
- }
- }
-
- public void Dispose ()
- {
- if (nativeImageAttr != IntPtr.Zero) {
- Status status = GDIPlus.GdipDisposeImageAttributes (nativeImageAttr);
- nativeImageAttr = IntPtr.Zero;
- GDIPlus.CheckStatus (status);
- }
- 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);
- }
-
- [MonoTODO ("Not supported by libgdiplus")]
- public void GetAdjustedPalette (ColorPalette palette, ColorAdjustType type)
- {
- IntPtr colorPalette = palette.getGDIPalette ();
- try {
- Status status = GDIPlus.GdipGetImageAttributesAdjustedPalette (nativeImageAttr, colorPalette, type);
- GDIPlus.CheckStatus (status);
- palette.setFromGDIPalette (colorPalette);
- } finally {
- if (colorPalette != IntPtr.Zero)
- Marshal.FreeHGlobal (colorPalette);
- }
- }
-
- 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);
- try {
- 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.ToInt64() + mapsize);
- }
-
- Status status = GDIPlus.GdipSetImageAttributesRemapTable (nativeImageAttr,
- ColorAdjustType.Brush, true, (uint) map.Length, clrmap);
- GDIPlus.CheckStatus (status);
- }
- finally {
- Marshal.FreeHGlobal (clrmap);
- }
- }
-
- 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)
- {
- SetColorMatrices (newColorMatrix, grayMatrix, ColorMatrixFlag.Default, ColorAdjustType.Default);
- }
-
- public void SetColorMatrices (ColorMatrix newColorMatrix, ColorMatrix grayMatrix, ColorMatrixFlag flags)
- {
- SetColorMatrices (newColorMatrix, grayMatrix, flags, ColorAdjustType.Default);
- }
-
- public void SetColorMatrices (ColorMatrix newColorMatrix, ColorMatrix grayMatrix, ColorMatrixFlag mode, ColorAdjustType type)
- {
- Status status;
- IntPtr cm = ColorMatrix.Alloc (newColorMatrix);
- try {
- if (grayMatrix == null) {
- status = GDIPlus.GdipSetImageAttributesColorMatrix (nativeImageAttr, type, true, cm,
- IntPtr.Zero, mode);
- } else {
- IntPtr gm = ColorMatrix.Alloc (grayMatrix);
- try {
- status = GDIPlus.GdipSetImageAttributesColorMatrix (nativeImageAttr, type, true,
- cm, gm, mode);
- }
- finally {
- ColorMatrix.Free (gm);
- }
- }
- }
- finally {
- ColorMatrix.Free (cm);
- }
- GDIPlus.CheckStatus (status);
- }
-
- public void SetGamma (float gamma)
- {
- SetGamma (gamma, ColorAdjustType.Default);
- }
-
- public void SetGamma (float gamma, ColorAdjustType type)
- {
- Status status = GDIPlus.GdipSetImageAttributesGamma (nativeImageAttr, type, 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);
- }
-
- [MonoTODO ("Not supported by libgdiplus")]
- public void SetOutputChannel (ColorChannelFlag flags)
- {
- SetOutputChannel (flags, ColorAdjustType.Default);
- }
-
- [MonoTODO ("Not supported by libgdiplus")]
- public void SetOutputChannel (ColorChannelFlag flags, ColorAdjustType type)
- {
- Status status = GDIPlus.GdipSetImageAttributesOutputChannel (nativeImageAttr, type, true, flags);
- GDIPlus.CheckStatus (status);
- }
-
- [MonoTODO ("Not supported by libgdiplus")]
- public void SetOutputChannelColorProfile (string colorProfileFilename)
- {
- SetOutputChannelColorProfile (colorProfileFilename, ColorAdjustType.Default);
- }
-
- [MonoTODO ("Not supported by libgdiplus")]
- 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);
- try {
- 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.ToInt64() + mapsize);
- }
-
- Status status = GDIPlus.GdipSetImageAttributesRemapTable (nativeImageAttr,
- type, true, (uint) map.Length, clrmap);
- GDIPlus.CheckStatus (status);
- }
- finally {
- Marshal.FreeHGlobal (clrmap);
- }
- }
-
- [MonoTODO ("Not supported by libgdiplus")]
- public void SetThreshold (float threshold)
- {
- SetThreshold (threshold, ColorAdjustType.Default);
- }
-
- [MonoTODO ("Not supported by libgdiplus")]
- 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);
- }
- }
-}
+++ /dev/null
-//
-// System.Drawing.Imaging.ImageCodecInfo.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)
-// Sebastien Pouliot <sebastien@ximian.com>
-//
-// (C) 2002 Ximian, Inc. http://www.ximian.com
-// Copyright (C) 2004,2006,2007 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.Runtime.InteropServices;
-using System.Collections;
-using System.IO;
-
-namespace System.Drawing.Imaging {
-
- 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);
- try {
- 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]);
- }
- }
- finally {
- 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);
- try {
- 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]);
- }
- }
- finally {
- 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; }
- }
-
- [CLSCompliant(false)]
- public byte[][] SignaturePatterns
- {
- get { return signaturePatterns; }
- set { signaturePatterns = value; }
- }
-
- public int Version
- {
- get { return version; }
- set { version = value; }
- }
- }
-}
+++ /dev/null
-//
-// System.Drawing.Imaging.MetafileFrameUnit.cs
-//
-// Author: 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.
-//
-
-namespace System.Drawing.Imaging {
-
- public enum MetafileFrameUnit {
- Document = 5,
- GdiCompatible = 7,
- Inch = 4,
- Millimeter = 6,
- Pixel = 2,
- Point = 3
- }
-}
../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Internal/GPPOINTF.cs
../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Internal/GPRECT.cs
../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Internal/GPRECTF.cs
+../../../external/corefx/src/System.Drawing.Common/src/AssemblyRef.cs
../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Internal/ISystemEventTracker.cs
System.Drawing/Bitmap.cs
../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/BitmapSuffixInSameAssemblyAttribute.cs
../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Design/ToolboxComponentsCreatingEventHandler.cs
../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Design/ToolboxItemCreatorCallback.cs
System.Drawing.Design/ToolboxItem.cs
-System.Drawing.Design/UITypeEditor.cs
+ ../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Design/UITypeEditor.cs
../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Design/ToolboxItemCollection.cs
../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Drawing2D/AdjustableArrowCap.cs
../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Drawing2D/Blend.cs
../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/ColorChannelFlags.cs
../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/ColorMap.cs
../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/ColorMapType.cs
-System.Drawing.Imaging/ColorMatrix.cs
+../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/ColorMatrix.cs
../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/ColorMatrixFlags.cs
../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/ColorMode.cs
-System.Drawing.Imaging/ColorPalette.cs
+../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/ColorPalette.cs
../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/EmfPlusRecordType.cs
../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/EmfType.cs
../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/EmfPlusFlags.cs
../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/Encoder.cs
-System.Drawing.Imaging/EncoderParameter.cs
-System.Drawing.Imaging/EncoderParameters.cs
+../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/EncoderParameter.cs
+../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/EncoderParameters.cs
../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/EncoderParameterValueType.cs
../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/EncoderValue.cs
../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/FrameDimension.cs
-System.Drawing.Imaging/ImageAttributes.cs
+../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/ImageAttributes.cs
../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/ImageCodecFlags.cs
-System.Drawing.Imaging/ImageCodecInfo.cs
+../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/ImageCodecInfo.cs
+../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/ImageCodecInfoPrivate.cs
../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/ImageFlags.cs
System.Drawing.Imaging/ImageFormat.cs
../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/ImageLockMode.cs
System.Drawing.Imaging/Metafile.cs
-System.Drawing.Imaging/MetafileFrameUnit.cs
+../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/MetafileFrameUnit.cs
System.Drawing.Imaging/MetafileHeader.cs
../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/MetafileHeaderWmf.cs
../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/MetafileHeaderEmf.cs
Status status = GDIPlus.GdipDrawImagePointsRectI (nativeObject, image.NativeObject,
destPoints, destPoints.Length , srcRect.X, srcRect.Y,
srcRect.Width, srcRect.Height, srcUnit,
- imageAttr != null ? imageAttr.NativeObject : IntPtr.Zero, null, IntPtr.Zero);
+ imageAttr != null ? imageAttr.nativeImageAttributes : IntPtr.Zero, null, IntPtr.Zero);
GDIPlus.CheckStatus (status);
}
Status status = GDIPlus.GdipDrawImagePointsRect (nativeObject, image.NativeObject,
destPoints, destPoints.Length , srcRect.X, srcRect.Y,
srcRect.Width, srcRect.Height, srcUnit,
- imageAttr != null ? imageAttr.NativeObject : IntPtr.Zero, null, IntPtr.Zero);
+ imageAttr != null ? imageAttr.nativeImageAttributes : IntPtr.Zero, null, IntPtr.Zero);
GDIPlus.CheckStatus (status);
}
Status status = GDIPlus.GdipDrawImagePointsRect (nativeObject, image.NativeObject,
destPoints, destPoints.Length , srcRect.X, srcRect.Y,
srcRect.Width, srcRect.Height, srcUnit,
- imageAttr != null ? imageAttr.NativeObject : IntPtr.Zero, callback, IntPtr.Zero);
+ imageAttr != null ? imageAttr.nativeImageAttributes : IntPtr.Zero, callback, IntPtr.Zero);
GDIPlus.CheckStatus (status);
}
Status status = GDIPlus.GdipDrawImagePointsRectI (nativeObject, image.NativeObject,
destPoints, destPoints.Length , srcRect.X, srcRect.Y,
srcRect.Width, srcRect.Height, srcUnit,
- imageAttr != null ? imageAttr.NativeObject : IntPtr.Zero, callback, IntPtr.Zero);
+ imageAttr != null ? imageAttr.nativeImageAttributes : IntPtr.Zero, callback, IntPtr.Zero);
GDIPlus.CheckStatus (status);
}
Status status = GDIPlus.GdipDrawImagePointsRectI (nativeObject, image.NativeObject,
destPoints, destPoints.Length , srcRect.X, srcRect.Y,
srcRect.Width, srcRect.Height, srcUnit,
- imageAttr != null ? imageAttr.NativeObject : IntPtr.Zero, callback, (IntPtr) callbackData);
+ imageAttr != null ? imageAttr.nativeImageAttributes : IntPtr.Zero, callback, (IntPtr) callbackData);
GDIPlus.CheckStatus (status);
}
destRect.X, destRect.Y, destRect.Width, destRect.Height,
srcX, srcY, srcWidth, srcHeight, srcUnit, IntPtr.Zero,
null, IntPtr.Zero);
- GDIPlus.CheckStatus (status);
+ GDIPlus.CheckStatus (status);
}
public void DrawImage (Image image, PointF [] destPoints, RectangleF srcRect, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback, int callbackData)
Status status = GDIPlus.GdipDrawImagePointsRect (nativeObject, image.NativeObject,
destPoints, destPoints.Length , srcRect.X, srcRect.Y,
srcRect.Width, srcRect.Height, srcUnit,
- imageAttr != null ? imageAttr.NativeObject : IntPtr.Zero, callback, (IntPtr) callbackData);
+ imageAttr != null ? imageAttr.nativeImageAttributes : IntPtr.Zero, callback, (IntPtr) callbackData);
GDIPlus.CheckStatus (status);
}
Status status = GDIPlus.GdipDrawImageRectRect (nativeObject, image.NativeObject,
destRect.X, destRect.Y, destRect.Width, destRect.Height,
srcX, srcY, srcWidth, srcHeight, srcUnit,
- imageAttrs != null ? imageAttrs.NativeObject : IntPtr.Zero, null, IntPtr.Zero);
+ imageAttrs != null ? imageAttrs.nativeImageAttributes : IntPtr.Zero, null, IntPtr.Zero);
GDIPlus.CheckStatus (status);
}
Status status = GDIPlus.GdipDrawImageRectRectI (nativeObject, image.NativeObject,
destRect.X, destRect.Y, destRect.Width,
destRect.Height, srcX, srcY, srcWidth, srcHeight,
- srcUnit, imageAttr != null ? imageAttr.NativeObject : IntPtr.Zero, null, IntPtr.Zero);
+ srcUnit, imageAttr != null ? imageAttr.nativeImageAttributes : IntPtr.Zero, null, IntPtr.Zero);
GDIPlus.CheckStatus (status);
}
Status status = GDIPlus.GdipDrawImageRectRectI (nativeObject, image.NativeObject,
destRect.X, destRect.Y, destRect.Width,
destRect.Height, srcX, srcY, srcWidth, srcHeight,
- srcUnit, imageAttr != null ? imageAttr.NativeObject : IntPtr.Zero, callback,
+ srcUnit, imageAttr != null ? imageAttr.nativeImageAttributes : IntPtr.Zero, callback,
IntPtr.Zero);
GDIPlus.CheckStatus (status);
}
Status status = GDIPlus.GdipDrawImageRectRect (nativeObject, image.NativeObject,
destRect.X, destRect.Y, destRect.Width,
destRect.Height, srcX, srcY, srcWidth, srcHeight,
- srcUnit, imageAttrs != null ? imageAttrs.NativeObject : IntPtr.Zero,
+ srcUnit, imageAttrs != null ? imageAttrs.nativeImageAttributes : IntPtr.Zero,
callback, IntPtr.Zero);
GDIPlus.CheckStatus (status);
}
Status status = GDIPlus.GdipDrawImageRectRect (nativeObject, image.NativeObject,
destRect.X, destRect.Y, destRect.Width, destRect.Height,
srcX, srcY, srcWidth, srcHeight, srcUnit,
- imageAttrs != null ? imageAttrs.NativeObject : IntPtr.Zero, callback, callbackData);
+ imageAttrs != null ? imageAttrs.nativeImageAttributes : IntPtr.Zero, callback, callbackData);
GDIPlus.CheckStatus (status);
}
Status status = GDIPlus.GdipDrawImageRectRect (nativeObject, image.NativeObject,
destRect.X, destRect.Y, destRect.Width, destRect.Height,
srcX, srcY, srcWidth, srcHeight, srcUnit,
- imageAttrs != null ? imageAttrs.NativeObject : IntPtr.Zero, callback, callbackData);
+ imageAttrs != null ? imageAttrs.nativeImageAttributes : IntPtr.Zero, callback, callbackData);
GDIPlus.CheckStatus (status);
}
try {
status = GDIPlus.GdipGetEncoderParameterList (nativeObject, ref encoder, sz, rawEPList);
- eps = EncoderParameters.FromNativePtr (rawEPList);
+ eps = EncoderParameters.ConvertFromMemory (rawEPList);
GDIPlus.CheckStatus (status);
}
finally {
if (encoderParams == null) {
st = GDIPlus.GdipSaveImageToFile (nativeObject, filename, ref guid, IntPtr.Zero);
} else {
- IntPtr nativeEncoderParams = encoderParams.ToNativePtr ();
+ IntPtr nativeEncoderParams = encoderParams.ConvertToMemory ();
st = GDIPlus.GdipSaveImageToFile (nativeObject, filename, ref guid, nativeEncoderParams);
Marshal.FreeHGlobal (nativeEncoderParams);
}
if (encoderParams == null)
nativeEncoderParams = IntPtr.Zero;
else
- nativeEncoderParams = encoderParams.ToNativePtr ();
+ nativeEncoderParams = encoderParams.ConvertToMemory ();
try {
if (GDIPlus.RunningOnUnix ()) {
{
Status st;
- IntPtr nativeEncoderParams = encoderParams.ToNativePtr ();
+ IntPtr nativeEncoderParams = encoderParams.ConvertToMemory ();
st = GDIPlus.GdipSaveAdd (nativeObject, nativeEncoderParams);
Marshal.FreeHGlobal (nativeEncoderParams);
GDIPlus.CheckStatus (st);
{
Status st;
- IntPtr nativeEncoderParams = encoderParams.ToNativePtr ();
+ IntPtr nativeEncoderParams = encoderParams.ConvertToMemory ();
st = GDIPlus.GdipSaveAddImage (nativeObject, image.NativeObject, nativeEncoderParams);
Marshal.FreeHGlobal (nativeEncoderParams);
GDIPlus.CheckStatus (st);
try {
st = GDIPlus.GdipGetImagePalette (nativeObject, palette_data, bytes);
GDIPlus.CheckStatus (st);
- ret.setFromGDIPalette (palette_data);
+ ret.ConvertFromMemory (palette_data);
return ret;
}
if (palette == null) {
throw new ArgumentNullException("palette");
}
- IntPtr palette_data = palette.getGDIPalette();
+ IntPtr palette_data = palette.ConvertToMemory ();
if (palette_data == IntPtr.Zero) {
return;
}