[LoongArch64] Part-5:add loongarch support in some files for LoongArch64. (#21769)
[mono-project.git] / mcs / class / System.Drawing / System.Drawing / gdipStructs.cs
blob58aae4020d52a3ab68f98a45718bed6c7f589f01
1 //
2 // System.Drawing.gdipStructs.cs
3 //
4 // Author:
5 // Alexandre Pigolkine (pigolkine@gmx.de)
6 // Jordi Mas (jordi@ximian.com)
7 //
8 // Copyright (C) 2004, 2007 Novell, Inc (http://www.novell.com)
9 //
10 // Permission is hereby granted, free of charge, to any person obtaining
11 // a copy of this software and associated documentation files (the
12 // "Software"), to deal in the Software without restriction, including
13 // without limitation the rights to use, copy, modify, merge, publish,
14 // distribute, sublicense, and/or sell copies of the Software, and to
15 // permit persons to whom the Software is furnished to do so, subject to
16 // the following conditions:
17 //
18 // The above copyright notice and this permission notice shall be
19 // included in all copies or substantial portions of the Software.
20 //
21 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
25 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
26 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
27 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 using System.Drawing.Imaging;
31 using System.Runtime.InteropServices;
33 namespace System.Drawing
35 [StructLayout(LayoutKind.Sequential)]
36 internal struct GdiplusStartupInput
38 // internalted to silent compiler
39 internal uint GdiplusVersion;
40 internal IntPtr DebugEventCallback;
41 internal int SuppressBackgroundThread;
42 internal int SuppressExternalCodecs;
44 internal static GdiplusStartupInput MakeGdiplusStartupInput ()
46 GdiplusStartupInput result = new GdiplusStartupInput ();
47 result.GdiplusVersion = 1;
48 result.DebugEventCallback = IntPtr.Zero;
49 result.SuppressBackgroundThread = 0;
50 result.SuppressExternalCodecs = 0;
51 return result;
55 [StructLayout(LayoutKind.Sequential)]
56 internal struct GdiplusStartupOutput
58 internal IntPtr NotificationHook;
59 internal IntPtr NotificationUnhook;
61 internal static GdiplusStartupOutput MakeGdiplusStartupOutput ()
63 GdiplusStartupOutput result = new GdiplusStartupOutput ();
64 result.NotificationHook = result.NotificationUnhook = IntPtr.Zero;
65 return result;
70 [StructLayout(LayoutKind.Sequential)]
71 internal struct GdiColorPalette
73 internal int Flags; // Palette flags
74 internal int Count; // Number of color entries
77 [StructLayout(LayoutKind.Sequential)]
78 internal struct GdiColorMap
80 internal int from;
81 internal int to;
84 [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto)]
85 internal struct LOGFONT
87 internal int lfHeight;
88 internal uint lfWidth;
89 internal uint lfEscapement;
90 internal uint lfOrientation;
91 internal uint lfWeight;
92 internal byte lfItalic;
93 internal byte lfUnderline;
94 internal byte lfStrikeOut;
95 internal byte lfCharSet;
96 internal byte lfOutPrecision;
97 internal byte lfClipPrecision;
98 internal byte lfQuality;
99 internal byte lfPitchAndFamily;
100 [MarshalAs(UnmanagedType.ByValTStr, SizeConst=32)]
101 internal string lfFaceName;
104 [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Unicode)]
105 internal struct GdipImageCodecInfo /*Size 76 bytes*/
107 internal Guid Clsid;
108 internal Guid FormatID;
109 internal IntPtr CodecName;
110 internal IntPtr DllName;
111 internal IntPtr FormatDescription;
112 internal IntPtr FilenameExtension;
113 internal IntPtr MimeType;
114 internal ImageCodecFlags Flags;
115 internal int Version;
116 internal int SigCount;
117 internal int SigSize;
118 IntPtr SigPattern;
119 IntPtr SigMask;
121 internal static void MarshalTo (GdipImageCodecInfo gdipcodec, ImageCodecInfo codec)
123 codec.CodecName = Marshal.PtrToStringUni (gdipcodec.CodecName);
124 codec.DllName = Marshal.PtrToStringUni (gdipcodec.DllName);
125 codec.FormatDescription = Marshal.PtrToStringUni (gdipcodec.FormatDescription);
126 codec.FilenameExtension = Marshal.PtrToStringUni (gdipcodec.FilenameExtension);
127 codec.MimeType = Marshal.PtrToStringUni (gdipcodec.MimeType);
128 codec.Clsid = gdipcodec.Clsid;
129 codec.FormatID = gdipcodec.FormatID;
130 codec.Flags = gdipcodec.Flags;
131 codec.Version = gdipcodec.Version;
132 codec.SignatureMasks = new byte [gdipcodec.SigCount][];
133 codec.SignaturePatterns = new byte [gdipcodec.SigCount][];
134 IntPtr p = gdipcodec.SigPattern;
135 IntPtr m = gdipcodec.SigMask;
136 for (int i=0; i < gdipcodec.SigCount; i++) {
137 codec.SignatureMasks[i] = new byte [gdipcodec.SigSize];
138 Marshal.Copy (m, codec.SignatureMasks[i], 0, gdipcodec.SigSize);
139 m = new IntPtr (m.ToInt64 () + gdipcodec.SigSize);
140 codec.SignaturePatterns[i] = new byte [gdipcodec.SigSize];
141 Marshal.Copy (p, codec.SignaturePatterns[i], 0, gdipcodec.SigSize);
142 p = new IntPtr (p.ToInt64 () + gdipcodec.SigSize);
147 [StructLayout(LayoutKind.Sequential)]
148 internal struct GdipEncoderParameter {
149 internal Guid guid;
150 internal uint numberOfValues;
151 internal EncoderParameterValueType type;
152 internal IntPtr value;
155 [StructLayout(LayoutKind.Sequential)]
156 internal struct GdipPropertyItem
158 internal int id;
159 internal int len;
160 internal short type;
161 internal IntPtr value;
163 internal static void MarshalTo (GdipPropertyItem gdipProp, PropertyItem prop)
165 prop.Id = gdipProp.id;
166 prop.Len = gdipProp.len;
167 prop.Type = gdipProp.type;
168 prop.Value = new byte [gdipProp.len];
169 Marshal.Copy (gdipProp.value, prop.Value, 0, gdipProp.len);
173 [StructLayout(LayoutKind.Sequential)]
174 internal struct IconInfo
176 int fIcon;
177 public int xHotspot;
178 public int yHotspot;
179 public IntPtr hbmMask;
180 public IntPtr hbmColor;
182 public bool IsIcon {
183 get { return (fIcon == 1); }
184 set { fIcon = (value) ? 1 : 0; }
188 [StructLayout(LayoutKind.Sequential)]
189 internal struct XColor
191 public int pixel;
192 public ushort red, green, blue;
193 public sbyte flags;
194 public sbyte pad;
197 [StructLayout(LayoutKind.Sequential)]
198 internal struct XVisualInfo
200 internal IntPtr visual;
201 internal IntPtr visualid;
202 internal int screen;
203 internal uint depth;
204 internal int klass;
205 internal IntPtr red_mask;
206 internal IntPtr green_mask;
207 internal IntPtr blue_mask;
208 internal int colormap_size;
209 internal int bits_per_rgb;