You've already forked linux-packaging-mono
Imported Upstream version 5.8.0.22
Former-commit-id: df344e34b07851d296efb3e6604c8db42b6f7aa3
This commit is contained in:
parent
5f4a27cc8a
commit
7d05485754
@@ -1,40 +0,0 @@
|
||||
//
|
||||
// System.Drawing.Imaging.ColorAdjustType.cs
|
||||
//
|
||||
// Author: Dennis Hayes (dennish@raytek.com)
|
||||
//
|
||||
// (C) 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.
|
||||
//
|
||||
|
||||
namespace System.Drawing.Imaging {
|
||||
|
||||
public enum ColorAdjustType {
|
||||
Any = 6,
|
||||
Bitmap = 1,
|
||||
Brush = 2,
|
||||
Count = 5,
|
||||
Default = 0,
|
||||
Pen = 3,
|
||||
Text = 4
|
||||
}
|
||||
}
|
@@ -1,38 +0,0 @@
|
||||
//
|
||||
// System.Drawing.Imaging.ColorChannelFlag.cs
|
||||
//
|
||||
// Author: Dennis Hayes (dennish@raytek.com)
|
||||
//
|
||||
// (C) 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.
|
||||
//
|
||||
|
||||
namespace System.Drawing.Imaging {
|
||||
|
||||
public enum ColorChannelFlag {
|
||||
ColorChannelC = 0,
|
||||
ColorChannelK = 3,
|
||||
ColorChannelLast = 4,
|
||||
ColorChannelM = 1,
|
||||
ColorChannelY = 2
|
||||
}
|
||||
}
|
@@ -1,61 +0,0 @@
|
||||
//
|
||||
// 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 {
|
||||
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; }
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -1,35 +0,0 @@
|
||||
//
|
||||
// System.Drawing.Imaging.ColorMapType.cs
|
||||
//
|
||||
// Author: Dennis Hayes (dennish@raytek.com)
|
||||
//
|
||||
// (C) 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.
|
||||
//
|
||||
|
||||
namespace System.Drawing.Imaging {
|
||||
|
||||
public enum ColorMapType {
|
||||
Brush = 1,
|
||||
Default = 0
|
||||
}
|
||||
}
|
@@ -1,383 +0,0 @@
|
||||
//
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,36 +0,0 @@
|
||||
//
|
||||
// System.Drawing.Imaging.ColorMatrixFlag.cs
|
||||
//
|
||||
// Author: Dennis Hayes (dennish@raytek.com)
|
||||
//
|
||||
// (C) 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.
|
||||
//
|
||||
|
||||
namespace System.Drawing.Imaging {
|
||||
|
||||
public enum ColorMatrixFlag{
|
||||
AltGrays = 2,
|
||||
Default = 0,
|
||||
SkipGrays = 1
|
||||
}
|
||||
}
|
@@ -1,35 +0,0 @@
|
||||
//
|
||||
// System.Drawing.Imaging.ColorMode.cs
|
||||
//
|
||||
// Author: Dennis Hayes (dennish@raytek.com)
|
||||
//
|
||||
// (C) 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.
|
||||
//
|
||||
|
||||
namespace System.Drawing.Imaging {
|
||||
|
||||
public enum ColorMode {
|
||||
Argb32Mode = 0,
|
||||
Argb64Mode = 1
|
||||
}
|
||||
}
|
@@ -1,115 +0,0 @@
|
||||
//
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,286 +0,0 @@
|
||||
//
|
||||
// System.Drawing.Imaging.EmfPlusRecordType.cs
|
||||
//
|
||||
// Author: Dennis Hayes (dennish@raytek.com)
|
||||
//
|
||||
// (C) 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.
|
||||
//
|
||||
|
||||
namespace System.Drawing.Imaging {
|
||||
|
||||
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
|
||||
}
|
||||
}
|
@@ -1,36 +0,0 @@
|
||||
//
|
||||
// System.Drawing.Imaging.EmfType.cs
|
||||
//
|
||||
// Author: Dennis Hayes (dennish@raytek.com)
|
||||
//
|
||||
// (C) 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.
|
||||
//
|
||||
|
||||
namespace System.Drawing.Imaging {
|
||||
|
||||
public enum EmfType {
|
||||
EmfOnly = 3,
|
||||
EmfPlusDual = 5,
|
||||
EmfPlusOnly = 4
|
||||
}
|
||||
}
|
@@ -1,79 +0,0 @@
|
||||
//
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,349 +0,0 @@
|
||||
//
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,41 +0,0 @@
|
||||
//
|
||||
// System.Drawing.Imaging.EncoderParameterValueType.cs
|
||||
//
|
||||
// Author: Dennis Hayes (dennish@raytek.com)
|
||||
//
|
||||
// (C) 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.
|
||||
//
|
||||
|
||||
namespace System.Drawing.Imaging {
|
||||
|
||||
public enum EncoderParameterValueType {
|
||||
ValueTypeAscii = 2,
|
||||
ValueTypeByte = 1,
|
||||
ValueTypeLong = 4,
|
||||
ValueTypeLongRange = 6,
|
||||
ValueTypeRational = 5,
|
||||
ValueTypeRationalRange = 8,
|
||||
ValueTypeShort = 3,
|
||||
ValueTypeUndefined = 7
|
||||
}
|
||||
}
|
@@ -1,109 +0,0 @@
|
||||
//
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,57 +0,0 @@
|
||||
//
|
||||
// System.Drawing.Imaging.EncoderValue.cs
|
||||
//
|
||||
// Author: Dennis Hayes (dennish@raytek.com)
|
||||
//
|
||||
// (C) 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.
|
||||
//
|
||||
|
||||
namespace System.Drawing.Imaging {
|
||||
|
||||
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
|
||||
}
|
||||
}
|
@@ -1,110 +0,0 @@
|
||||
// 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, 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;
|
||||
|
||||
namespace System.Drawing.Imaging {
|
||||
|
||||
public sealed class FrameDimension {
|
||||
|
||||
private Guid guid;
|
||||
private string name;
|
||||
|
||||
static FrameDimension page;
|
||||
static FrameDimension resolution;
|
||||
static FrameDimension time;
|
||||
|
||||
|
||||
public FrameDimension (Guid guid)
|
||||
{
|
||||
this.guid = guid;
|
||||
}
|
||||
|
||||
internal FrameDimension (Guid guid, string name)
|
||||
{
|
||||
this.guid = guid;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Guid Guid {
|
||||
get { return guid; }
|
||||
}
|
||||
|
||||
public static FrameDimension Page {
|
||||
get {
|
||||
if (page == null)
|
||||
page = new FrameDimension (new Guid ("7462dc86-6180-4c7e-8e3f-ee7333a7a483"), "Page");
|
||||
return page;
|
||||
}
|
||||
}
|
||||
|
||||
public static FrameDimension Resolution {
|
||||
get {
|
||||
if (resolution == null) {
|
||||
resolution = new FrameDimension (new Guid ("84236f7b-3bd3-428f-8dab-4ea1439ca315"),
|
||||
"Resolution");
|
||||
}
|
||||
return resolution;
|
||||
}
|
||||
}
|
||||
|
||||
public static FrameDimension Time {
|
||||
get {
|
||||
if (time == null)
|
||||
time = new FrameDimension (new Guid ("6aedbd6d-3fb5-418a-83a6-7f45229dc872"), "Time");
|
||||
return time;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool Equals (object o)
|
||||
{
|
||||
FrameDimension fd = (o as FrameDimension);
|
||||
if (fd == null)
|
||||
return false;
|
||||
|
||||
return (guid == fd.guid);
|
||||
}
|
||||
|
||||
public override int GetHashCode ()
|
||||
{
|
||||
return guid.GetHashCode ();
|
||||
}
|
||||
|
||||
public override string ToString ()
|
||||
{
|
||||
if (name == null)
|
||||
name = String.Format ("[FrameDimension: {0}]", guid);
|
||||
return name;
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,400 +0,0 @@
|
||||
//
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,43 +0,0 @@
|
||||
//
|
||||
// System.Drawing.Imaging.ImageCodecFlags.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 {
|
||||
|
||||
[Flags]
|
||||
public enum ImageCodecFlags {
|
||||
BlockingDecode = 32,
|
||||
Builtin = 65536,
|
||||
Decoder = 2,
|
||||
Encoder = 1,
|
||||
SeekableEncode = 16,
|
||||
SupportBitmap = 4,
|
||||
SupportVector = 8,
|
||||
System = 131072,
|
||||
User = 262144
|
||||
}
|
||||
}
|
@@ -1,209 +0,0 @@
|
||||
//
|
||||
// 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; }
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,48 +0,0 @@
|
||||
//
|
||||
// System.Drawing.Imaging.ImageFlags.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 {
|
||||
|
||||
[Flags]
|
||||
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
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user