2 // System.Drawing.gdipStructs.cs
5 // Alexandre Pigolkine (pigolkine@gmx.de)
6 // Jordi Mas (jordi@ximian.com)
10 // Copyright (C) 2004 Novell, Inc (http://www.novell.com)
12 // Permission is hereby granted, free of charge, to any person obtaining
13 // a copy of this software and associated documentation files (the
14 // "Software"), to deal in the Software without restriction, including
15 // without limitation the rights to use, copy, modify, merge, publish,
16 // distribute, sublicense, and/or sell copies of the Software, and to
17 // permit persons to whom the Software is furnished to do so, subject to
18 // the following conditions:
20 // The above copyright notice and this permission notice shall be
21 // included in all copies or substantial portions of the Software.
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
33 using System
.Runtime
.InteropServices
;
35 using System
.Drawing
.Imaging
;
38 namespace System
.Drawing
40 [StructLayout(LayoutKind
.Sequential
)]
41 internal struct GdiplusStartupInput
44 IntPtr DebugEventCallback
;
45 int SuppressBackgroundThread
;
46 int SuppressExternalCodecs
;
48 internal static GdiplusStartupInput
MakeGdiplusStartupInput ()
50 GdiplusStartupInput result
= new GdiplusStartupInput ();
51 result
.GdiplusVersion
= 1;
52 result
.DebugEventCallback
= IntPtr
.Zero
;
53 result
.SuppressBackgroundThread
= 0;
54 result
.SuppressExternalCodecs
= 0;
59 [StructLayout(LayoutKind
.Sequential
)]
60 internal struct GdiplusStartupOutput
62 internal IntPtr NotificationHook
;
63 internal IntPtr NotificationUnhook
;
65 internal static GdiplusStartupOutput
MakeGdiplusStartupOutput ()
67 GdiplusStartupOutput result
= new GdiplusStartupOutput ();
68 result
.NotificationHook
= result
.NotificationUnhook
= IntPtr
.Zero
;
74 [StructLayout(LayoutKind
.Sequential
)]
75 internal struct GdiColorPalette
77 internal int Flags
; // Palette flags
78 internal int Count
; // Number of color entries
81 [StructLayout(LayoutKind
.Sequential
)]
82 internal struct GdiColorMap
88 [StructLayout(LayoutKind
.Sequential
, CharSet
=CharSet
.Ansi
)]
89 internal struct LOGFONTA
91 internal int lfHeight
;
92 internal uint lfWidth
;
93 internal uint lfEscapement
;
94 internal uint lfOrientation
;
95 internal uint lfWeight
;
96 internal byte lfItalic
;
97 internal byte lfUnderline
;
98 internal byte lfStrikeOut
;
99 internal byte lfCharSet
;
100 internal byte lfOutPrecision
;
101 internal byte lfClipPrecision
;
102 internal byte lfQuality
;
103 internal byte lfPitchAndFamily
;
104 [MarshalAs(UnmanagedType
.ByValTStr
, SizeConst
=32)]
105 internal string lfFaceName
;
108 [StructLayout(LayoutKind
.Sequential
, CharSet
=CharSet
.Unicode
)]
109 internal struct GdipImageCodecInfo
/*Size 76 bytes*/
112 internal Guid FormatID
;
113 internal IntPtr CodecName
;
114 internal IntPtr DllName
;
115 internal IntPtr FormatDescription
;
116 internal IntPtr FilenameExtension
;
117 internal IntPtr MimeType
;
118 internal ImageCodecFlags Flags
;
119 internal int Version
;
120 internal int SigCount
;
121 internal int SigSize
;
125 internal static void MarshalTo (GdipImageCodecInfo gdipcodec
, ImageCodecInfo codec
)
127 codec
.CodecName
= Marshal
.PtrToStringUni (gdipcodec
.CodecName
);
128 codec
.DllName
= Marshal
.PtrToStringUni (gdipcodec
.DllName
);
129 codec
.FormatDescription
= Marshal
.PtrToStringUni (gdipcodec
.FormatDescription
);
130 codec
.FilenameExtension
= Marshal
.PtrToStringUni (gdipcodec
.FilenameExtension
);
131 codec
.MimeType
= Marshal
.PtrToStringUni (gdipcodec
.MimeType
);
132 codec
.Clsid
= gdipcodec
.Clsid
;
133 codec
.FormatID
= gdipcodec
.FormatID
;
134 codec
.Flags
= gdipcodec
.Flags
;
135 codec
.Version
= gdipcodec
.Version
;
139 [StructLayout(LayoutKind
.Sequential
)]
140 internal struct GdipEncoderParameter
{
142 internal uint numberOfValues
;
143 internal EncoderParameterValueType type
;
144 internal IntPtr
value;
147 [StructLayout(LayoutKind
.Sequential
)]
148 internal struct GdipPropertyItem
153 internal IntPtr
value;
155 internal static void MarshalTo (GdipPropertyItem gdipProp
, PropertyItem prop
)
157 prop
.Id
= gdipProp
.id
;
158 prop
.Len
= gdipProp
.len
;
159 prop
.Type
= gdipProp
.type
;
160 prop
.Value
= new byte [gdipProp
.len
];
161 Marshal
.Copy (gdipProp
.value, prop
.Value
, 0, gdipProp
.len
);