2 // System.Drawing.gdipFunctions.cs
5 // Alexandre Pigolkine (pigolkine@gmx.de)
6 // Jordi Mas i Hernandez (jordi@ximian.com)
7 // Sanjay Gupta (gsanjay@novell.com)
8 // Ravindra (rkumar@novell.com)
9 // Peter Dennis Bartok (pbartok@novell.com)
10 // Sebastien Pouliot <sebastien@ximian.com>
12 // Copyright (C) 2004 - 2007 Novell, Inc (http://www.novell.com)
14 // Permission is hereby granted, free of charge, to any person obtaining
15 // a copy of this software and associated documentation files (the
16 // "Software"), to deal in the Software without restriction, including
17 // without limitation the rights to use, copy, modify, merge, publish,
18 // distribute, sublicense, and/or sell copies of the Software, and to
19 // permit persons to whom the Software is furnished to do so, subject to
20 // the following conditions:
22 // The above copyright notice and this permission notice shall be
23 // included in all copies or substantial portions of the Software.
25 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
26 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
28 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
29 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
30 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
31 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
35 using System.Runtime.InteropServices;
37 using System.Drawing.Drawing2D;
38 using System.Drawing.Imaging;
39 using System.Drawing.Text;
40 using System.Globalization;
41 using System.Security;
42 using System.Runtime.InteropServices.ComTypes;
44 namespace System.Drawing
47 /// GDI+ API Functions
49 internal static class GDIPlus {
50 public const int FACESIZE = 32;
51 public const int LANG_NEUTRAL = 0;
52 public static IntPtr Display = IntPtr.Zero;
53 public static bool UseX11Drawable = false;
54 public static bool UseCarbonDrawable = false;
55 public static bool UseCocoaDrawable = false;
57 private const string GdiPlus = "gdiplus";
59 #region gdiplus.dll functions
63 static internal extern Status GdiplusStartup(ref ulong token, ref GdiplusStartupInput input, ref GdiplusStartupOutput output);
65 static internal extern void GdiplusShutdown(ref ulong token);
67 internal static ulong GdiPlusToken = 0;
69 static void ProcessExit (object sender, EventArgs e)
71 // Called all pending objects and claim any pending handle before
74 GC.WaitForPendingFinalizers ();
78 // This causes crashes in because this call occurs before all
79 // managed GDI+ objects are finalized. When they are finalized
80 // they call into a shutdown GDI+ and we crash.
81 GdiplusShutdown (ref GdiPlusToken);
83 // This causes crashes in Mono libgdiplus because this call
84 // occurs before all managed GDI objects are finalized
85 // When they are finalized they use the closed display and
87 if (UseX11Drawable && Display != IntPtr.Zero) {
88 XCloseDisplay (Display);
96 bool isUnix = !RuntimeInformation.IsOSPlatform (OSPlatform.Windows);
98 int platform = (int) Environment.OSVersion.Platform;
99 bool isUnix = (platform == 4) || (platform == 6) || (platform == 128);
103 if (Environment.GetEnvironmentVariable ("not_supported_MONO_MWF_USE_NEW_X11_BACKEND") != null || Environment.GetEnvironmentVariable ("MONO_MWF_MAC_FORCE_X11") != null) {
104 UseX11Drawable = true;
106 IntPtr buf = Marshal.AllocHGlobal (8192);
107 // This is kind of a hack but gets us sysname from uname (struct utsname *name) on
109 if (uname (buf) != 0) {
110 // WTH: We couldn't detect the OS; lets default to X11
111 UseX11Drawable = true;
113 string os = Marshal.PtrToStringAnsi (buf);
115 UseCarbonDrawable = true;
117 UseX11Drawable = true;
119 Marshal.FreeHGlobal (buf);
123 GdiplusStartupInput input = GdiplusStartupInput.MakeGdiplusStartupInput();
124 GdiplusStartupOutput output = GdiplusStartupOutput.MakeGdiplusStartupOutput();
126 GdiplusStartup (ref GdiPlusToken, ref input, ref output);
128 catch (TypeInitializationException) {
129 Console.Error.WriteLine (
130 "* ERROR: Can not initialize GDI+ library{0}{0}" +
131 "Please check http://www.mono-project.com/Problem:GDIPlusInit for details",
132 Environment.NewLine);
135 // under MS 1.x this event is raised only for the default application domain
137 AppDomain.CurrentDomain.ProcessExit += new EventHandler (ProcessExit);
141 static public bool RunningOnWindows ()
143 return !UseX11Drawable && !UseCarbonDrawable && !UseCocoaDrawable;
146 static public bool RunningOnUnix ()
148 return UseX11Drawable || UseCarbonDrawable || UseCocoaDrawable;
151 // Copies a Ptr to an array of Points and releases the memory
152 static public void FromUnManagedMemoryToPointI (IntPtr prt, Point [] pts)
154 int nPointSize = Marshal.SizeOf (pts[0]);
156 for (int i=0; i<pts.Length; i++, pos = new IntPtr (pos.ToInt64 () + nPointSize))
157 pts[i] = (Point) Marshal.PtrToStructure (pos, typeof (Point));
159 Marshal.FreeHGlobal (prt);
162 // Copies a Ptr to an array of Points and releases the memory
163 static public void FromUnManagedMemoryToPoint (IntPtr prt, PointF [] pts)
165 int nPointSize = Marshal.SizeOf (pts[0]);
167 for (int i=0; i<pts.Length; i++, pos = new IntPtr (pos.ToInt64 () + nPointSize))
168 pts[i] = (PointF) Marshal.PtrToStructure (pos, typeof (PointF));
170 Marshal.FreeHGlobal (prt);
173 // Copies an array of Points to unmanaged memory
174 static public IntPtr FromPointToUnManagedMemoryI (Point [] pts)
176 int nPointSize = Marshal.SizeOf (pts[0]);
177 IntPtr dest = Marshal.AllocHGlobal (nPointSize * pts.Length);
179 for (int i=0; i<pts.Length; i++, pos = new IntPtr (pos.ToInt64 () + nPointSize))
180 Marshal.StructureToPtr (pts[i], pos, false);
185 // Copies a Ptr to an array of v and releases the memory
186 static public void FromUnManagedMemoryToRectangles (IntPtr prt, RectangleF [] pts)
188 int nPointSize = Marshal.SizeOf (pts[0]);
190 for (int i = 0; i < pts.Length; i++, pos = new IntPtr (pos.ToInt64 () + nPointSize))
191 pts[i] = (RectangleF) Marshal.PtrToStructure (pos, typeof (RectangleF));
193 Marshal.FreeHGlobal (prt);
196 // Copies an array of Points to unmanaged memory
197 static public IntPtr FromPointToUnManagedMemory (PointF [] pts)
199 int nPointSize = Marshal.SizeOf (pts[0]);
200 IntPtr dest = Marshal.AllocHGlobal (nPointSize * pts.Length);
202 for (int i=0; i<pts.Length; i++, pos = new IntPtr (pos.ToInt64 () + nPointSize))
203 Marshal.StructureToPtr (pts[i], pos, false);
208 // Converts a status into exception
209 // TODO: Add more status code mappings here
210 static internal void CheckStatus (Status status)
216 case Status.GenericError:
217 msg = Locale.GetText ("Generic Error [GDI+ status: {0}]", status);
218 throw new Exception (msg);
219 case Status.InvalidParameter:
220 msg = Locale.GetText ("A null reference or invalid value was found [GDI+ status: {0}]", status);
221 throw new ArgumentException (msg);
222 case Status.OutOfMemory:
223 msg = Locale.GetText ("Not enough memory to complete operation [GDI+ status: {0}]", status);
224 throw new OutOfMemoryException (msg);
225 case Status.ObjectBusy:
226 msg = Locale.GetText ("Object is busy and cannot state allow this operation [GDI+ status: {0}]", status);
227 throw new MemberAccessException (msg);
228 case Status.InsufficientBuffer:
229 msg = Locale.GetText ("Insufficient buffer provided to complete operation [GDI+ status: {0}]", status);
230 throw new InternalBufferOverflowException (msg);
231 case Status.PropertyNotSupported:
232 msg = Locale.GetText ("Property not supported [GDI+ status: {0}]", status);
233 throw new NotSupportedException (msg);
234 case Status.FileNotFound:
235 msg = Locale.GetText ("Requested file was not found [GDI+ status: {0}]", status);
236 throw new FileNotFoundException (msg);
237 case Status.AccessDenied:
238 msg = Locale.GetText ("Access to resource was denied [GDI+ status: {0}]", status);
239 throw new UnauthorizedAccessException (msg);
240 case Status.UnknownImageFormat:
241 msg = Locale.GetText ("Either the image format is unknown or you don't have the required libraries to decode this format [GDI+ status: {0}]", status);
242 throw new NotSupportedException (msg);
243 case Status.NotImplemented:
244 msg = Locale.GetText ("The requested feature is not implemented [GDI+ status: {0}]", status);
245 throw new NotImplementedException (msg);
246 case Status.WrongState:
247 msg = Locale.GetText ("Object is not in a state that can allow this operation [GDI+ status: {0}]", status);
248 throw new ArgumentException (msg);
249 case Status.FontFamilyNotFound:
250 msg = Locale.GetText ("The requested FontFamily could not be found [GDI+ status: {0}]", status);
251 throw new ArgumentException (msg);
252 case Status.ValueOverflow:
253 msg = Locale.GetText ("Argument is out of range [GDI+ status: {0}]", status);
254 throw new OverflowException (msg);
255 case Status.Win32Error:
256 msg = Locale.GetText ("The operation is invalid [GDI+ status: {0}]", status);
257 throw new InvalidOperationException (msg);
259 msg = Locale.GetText ("Unknown Error [GDI+ status: {0}]", status);
260 throw new Exception (msg);
266 static internal extern IntPtr GdipAlloc (int size);
268 static internal extern void GdipFree (IntPtr ptr);
273 static internal extern Status GdipCloneBrush (IntPtr brush, out IntPtr clonedBrush);
275 static internal extern Status GdipDeleteBrush (IntPtr brush);
277 static internal extern Status GdipGetBrushType (IntPtr brush, out BrushType type);
282 static internal extern Status GdipCreateRegion (out IntPtr region);
285 static internal extern Status GdipCreateRegionRgnData (byte[] data, int size, out IntPtr region);
288 static internal extern Status GdipDeleteRegion (IntPtr region);
291 static internal extern Status GdipCloneRegion (IntPtr region, out IntPtr cloned);
294 static internal extern Status GdipCreateRegionRect (ref RectangleF rect, out IntPtr region);
297 static internal extern Status GdipCreateRegionRectI (ref Rectangle rect, out IntPtr region);
300 static internal extern Status GdipCreateRegionPath (IntPtr path, out IntPtr region);
303 static internal extern Status GdipTranslateRegion (IntPtr region, float dx, float dy);
306 static internal extern Status GdipTranslateRegionI (IntPtr region, int dx, int dy);
309 static internal extern Status GdipIsVisibleRegionPoint (IntPtr region, float x, float y,
310 IntPtr graphics, out bool result);
313 static internal extern Status GdipIsVisibleRegionPointI (IntPtr region, int x, int y,
314 IntPtr graphics, out bool result);
317 static internal extern Status GdipIsVisibleRegionRect (IntPtr region, float x, float y, float width,
318 float height, IntPtr graphics, out bool result);
321 static internal extern Status GdipIsVisibleRegionRectI (IntPtr region, int x, int y, int width,
322 int height, IntPtr graphics, out bool result);
326 static internal extern Status GdipCombineRegionRect (IntPtr region, ref RectangleF rect,
327 CombineMode combineMode);
330 static internal extern Status GdipCombineRegionRectI (IntPtr region, ref Rectangle rect,
331 CombineMode combineMode);
334 static internal extern Status GdipCombineRegionPath (IntPtr region, IntPtr path, CombineMode combineMode);
337 static internal extern Status GdipGetRegionBounds (IntPtr region, IntPtr graphics, ref RectangleF rect);
340 static internal extern Status GdipSetInfinite (IntPtr region);
343 static internal extern Status GdipSetEmpty (IntPtr region);
346 static internal extern Status GdipIsEmptyRegion (IntPtr region, IntPtr graphics, out bool result);
349 static internal extern Status GdipIsInfiniteRegion (IntPtr region, IntPtr graphics, out bool result);
352 static internal extern Status GdipCombineRegionRegion (IntPtr region, IntPtr region2,
353 CombineMode combineMode);
356 static internal extern Status GdipIsEqualRegion (IntPtr region, IntPtr region2,
357 IntPtr graphics, out bool result);
360 static internal extern Status GdipGetRegionDataSize (IntPtr region, out int bufferSize);
363 static internal extern Status GdipGetRegionData (IntPtr region, byte[] buffer, int bufferSize,
367 static internal extern Status GdipGetRegionScansCount (IntPtr region, out int count, IntPtr matrix);
370 static internal extern Status GdipGetRegionScans (IntPtr region, IntPtr rects, out int count,
374 static internal extern Status GdipTransformRegion(IntPtr region, IntPtr matrix);
377 static internal extern Status GdipFillRegion(IntPtr graphics, IntPtr brush, IntPtr region);
380 static internal extern Status GdipGetRegionHRgn (IntPtr region, IntPtr graphics, ref IntPtr hRgn);
383 static internal extern Status GdipCreateRegionHrgn (IntPtr hRgn, out IntPtr region);
385 // Solid brush functions
387 static internal extern Status GdipCreateSolidFill (int color, out IntPtr brush);
389 static internal extern Status GdipGetSolidFillColor (IntPtr brush, out int color);
391 static internal extern Status GdipSetSolidFillColor (IntPtr brush, int color);
393 // Hatch Brush functions
395 static internal extern Status GdipCreateHatchBrush (HatchStyle hatchstyle, int foreColor, int backColor, out IntPtr brush);
397 static internal extern Status GdipGetHatchStyle (IntPtr brush, out HatchStyle hatchstyle);
399 static internal extern Status GdipGetHatchForegroundColor (IntPtr brush, out int foreColor);
401 static internal extern Status GdipGetHatchBackgroundColor (IntPtr brush, out int backColor);
403 // Texture brush functions
405 static internal extern Status GdipGetTextureImage (IntPtr texture, out IntPtr image);
407 static internal extern Status GdipCreateTexture (IntPtr image, WrapMode wrapMode, out IntPtr texture);
409 static internal extern Status GdipCreateTextureIAI (IntPtr image, IntPtr imageAttributes, int x, int y, int width, int height, out IntPtr texture);
411 static internal extern Status GdipCreateTextureIA (IntPtr image, IntPtr imageAttributes, float x, float y, float width, float height, out IntPtr texture);
413 static internal extern Status GdipCreateTexture2I (IntPtr image, WrapMode wrapMode, int x, int y, int width, int height, out IntPtr texture);
415 static internal extern Status GdipCreateTexture2 (IntPtr image, WrapMode wrapMode, float x, float y, float width, float height, out IntPtr texture);
417 static internal extern Status GdipGetTextureTransform (IntPtr texture, IntPtr matrix);
419 static internal extern Status GdipSetTextureTransform (IntPtr texture, IntPtr matrix);
421 static internal extern Status GdipGetTextureWrapMode (IntPtr texture, out WrapMode wrapMode);
423 static internal extern Status GdipSetTextureWrapMode (IntPtr texture, WrapMode wrapMode);
425 static internal extern Status GdipMultiplyTextureTransform (IntPtr texture, IntPtr matrix, MatrixOrder order);
427 static internal extern Status GdipResetTextureTransform (IntPtr texture);
429 static internal extern Status GdipRotateTextureTransform (IntPtr texture, float angle, MatrixOrder order);
431 static internal extern Status GdipScaleTextureTransform (IntPtr texture, float sx, float sy, MatrixOrder order);
433 static internal extern Status GdipTranslateTextureTransform (IntPtr texture, float dx, float dy, MatrixOrder order);
435 // PathGradientBrush functions
437 static internal extern Status GdipCreatePathGradientFromPath (IntPtr path, out IntPtr brush);
439 static internal extern Status GdipCreatePathGradientI (Point [] points, int count, WrapMode wrapMode, out IntPtr brush);
441 static internal extern Status GdipCreatePathGradient (PointF [] points, int count, WrapMode wrapMode, out IntPtr brush);
443 static internal extern Status GdipGetPathGradientBlendCount (IntPtr brush, out int count);
445 static internal extern Status GdipGetPathGradientBlend (IntPtr brush, float [] blend, float [] positions, int count);
447 static internal extern Status GdipSetPathGradientBlend (IntPtr brush, float [] blend, float [] positions, int count);
449 static internal extern Status GdipGetPathGradientCenterColor (IntPtr brush, out int color);
451 static internal extern Status GdipSetPathGradientCenterColor (IntPtr brush, int color);
453 static internal extern Status GdipGetPathGradientCenterPoint (IntPtr brush, out PointF point);
455 static internal extern Status GdipSetPathGradientCenterPoint (IntPtr brush, ref PointF point);
457 static internal extern Status GdipGetPathGradientFocusScales (IntPtr brush, out float xScale, out float yScale);
459 static internal extern Status GdipSetPathGradientFocusScales (IntPtr brush, float xScale, float yScale);
461 static internal extern Status GdipGetPathGradientPresetBlendCount (IntPtr brush, out int count);
463 static internal extern Status GdipGetPathGradientPresetBlend (IntPtr brush, int [] blend, float [] positions, int count);
465 static internal extern Status GdipSetPathGradientPresetBlend (IntPtr brush, int [] blend, float [] positions, int count);
467 static internal extern Status GdipGetPathGradientRect (IntPtr brush, out RectangleF rect);
469 static internal extern Status GdipGetPathGradientSurroundColorCount (IntPtr brush, out int count);
471 static internal extern Status GdipGetPathGradientSurroundColorsWithCount (IntPtr brush, int [] color, ref int count);
473 static internal extern Status GdipSetPathGradientSurroundColorsWithCount (IntPtr brush, int [] color, ref int count);
475 static internal extern Status GdipGetPathGradientTransform (IntPtr brush, IntPtr matrix);
477 static internal extern Status GdipSetPathGradientTransform (IntPtr brush, IntPtr matrix);
479 static internal extern Status GdipGetPathGradientWrapMode (IntPtr brush, out WrapMode wrapMode);
481 static internal extern Status GdipSetPathGradientWrapMode (IntPtr brush, WrapMode wrapMode);
483 static internal extern Status GdipSetPathGradientLinearBlend (IntPtr brush, float focus, float scale);
485 static internal extern Status GdipSetPathGradientSigmaBlend (IntPtr brush, float focus, float scale);
487 static internal extern Status GdipMultiplyPathGradientTransform (IntPtr texture, IntPtr matrix, MatrixOrder order);
489 static internal extern Status GdipResetPathGradientTransform (IntPtr brush);
491 static internal extern Status GdipRotatePathGradientTransform (IntPtr brush, float angle, MatrixOrder order);
493 static internal extern Status GdipScalePathGradientTransform (IntPtr brush, float sx, float sy, MatrixOrder order);
495 static internal extern Status GdipTranslatePathGradientTransform (IntPtr brush, float dx, float dy, MatrixOrder order);
497 // LinearGradientBrush functions
499 static internal extern Status GdipCreateLineBrushI (ref Point point1, ref Point point2, int color1, int color2, WrapMode wrapMode, out IntPtr brush);
501 static internal extern Status GdipCreateLineBrush (ref PointF point1, ref PointF point2, int color1, int color2, WrapMode wrapMode, out IntPtr brush);
503 static internal extern Status GdipCreateLineBrushFromRectI (ref Rectangle rect, int color1, int color2, LinearGradientMode linearGradientMode, WrapMode wrapMode, out IntPtr brush);
505 static internal extern Status GdipCreateLineBrushFromRect (ref RectangleF rect, int color1, int color2, LinearGradientMode linearGradientMode, WrapMode wrapMode, out IntPtr brush);
507 static internal extern Status GdipCreateLineBrushFromRectWithAngleI (ref Rectangle rect, int color1, int color2, float angle, bool isAngleScaleable, WrapMode wrapMode, out IntPtr brush);
509 static internal extern Status GdipCreateLineBrushFromRectWithAngle (ref RectangleF rect, int color1, int color2, float angle, bool isAngleScaleable, WrapMode wrapMode, out IntPtr brush);
511 static internal extern Status GdipGetLineBlendCount (IntPtr brush, out int count);
513 static internal extern Status GdipSetLineBlend (IntPtr brush, float [] blend, float [] positions, int count);
515 static internal extern Status GdipGetLineBlend (IntPtr brush, float [] blend, float [] positions, int count);
517 static internal extern Status GdipSetLineGammaCorrection (IntPtr brush, bool useGammaCorrection);
519 static internal extern Status GdipGetLineGammaCorrection (IntPtr brush, out bool useGammaCorrection);
521 static internal extern Status GdipGetLinePresetBlendCount (IntPtr brush, out int count);
523 static internal extern Status GdipSetLinePresetBlend (IntPtr brush, int [] blend, float [] positions, int count);
525 static internal extern Status GdipGetLinePresetBlend (IntPtr brush, int [] blend, float [] positions, int count);
527 static internal extern Status GdipSetLineColors (IntPtr brush, int color1, int color2);
529 static internal extern Status GdipGetLineColors (IntPtr brush, int [] colors);
531 static internal extern Status GdipGetLineRectI (IntPtr brush, out Rectangle rect);
533 static internal extern Status GdipGetLineRect (IntPtr brush, out RectangleF rect);
535 static internal extern Status GdipSetLineTransform (IntPtr brush, IntPtr matrix);
537 static internal extern Status GdipGetLineTransform (IntPtr brush, IntPtr matrix);
539 static internal extern Status GdipSetLineWrapMode (IntPtr brush, WrapMode wrapMode);
541 static internal extern Status GdipGetLineWrapMode (IntPtr brush, out WrapMode wrapMode);
543 static internal extern Status GdipSetLineLinearBlend (IntPtr brush, float focus, float scale);
545 static internal extern Status GdipSetLineSigmaBlend (IntPtr brush, float focus, float scale);
547 static internal extern Status GdipMultiplyLineTransform (IntPtr brush, IntPtr matrix, MatrixOrder order);
549 static internal extern Status GdipResetLineTransform (IntPtr brush);
551 static internal extern Status GdipRotateLineTransform (IntPtr brush, float angle, MatrixOrder order);
553 static internal extern Status GdipScaleLineTransform (IntPtr brush, float sx, float sy, MatrixOrder order);
555 static internal extern Status GdipTranslateLineTransform (IntPtr brush, float dx, float dy, MatrixOrder order);
557 // Graphics functions
559 static internal extern Status GdipCreateFromHDC(IntPtr hDC, out IntPtr graphics);
561 static internal extern Status GdipDeleteGraphics(IntPtr graphics);
563 static internal extern Status GdipRestoreGraphics(IntPtr graphics, uint graphicsState);
565 static internal extern Status GdipSaveGraphics(IntPtr graphics, out uint state);
567 static internal extern Status GdipMultiplyWorldTransform (IntPtr graphics, IntPtr matrix, MatrixOrder order);
570 static internal extern Status GdipRotateWorldTransform(IntPtr graphics, float angle, MatrixOrder order);
572 static internal extern Status GdipTranslateWorldTransform(IntPtr graphics, float dx, float dy, MatrixOrder order);
574 static internal extern Status GdipDrawArc (IntPtr graphics, IntPtr pen, float x, float y, float width, float height, float startAngle, float sweepAngle);
576 static internal extern Status GdipDrawArcI (IntPtr graphics, IntPtr pen, int x, int y, int width, int height, float startAngle, float sweepAngle);
578 static internal extern Status GdipDrawBezier (IntPtr graphics, IntPtr pen, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4);
580 static internal extern Status GdipDrawBezierI (IntPtr graphics, IntPtr pen, int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4);
582 static internal extern Status GdipDrawEllipseI (IntPtr graphics, IntPtr pen, int x, int y, int width, int height);
584 static internal extern Status GdipDrawEllipse (IntPtr graphics, IntPtr pen, float x, float y, float width, float height);
586 static internal extern Status GdipDrawLine (IntPtr graphics, IntPtr pen, float x1, float y1, float x2, float y2);
588 static internal extern Status GdipDrawLineI (IntPtr graphics, IntPtr pen, int x1, int y1, int x2, int y2);
589 [DllImport (GdiPlus)]
590 static internal extern Status GdipDrawLines (IntPtr graphics, IntPtr pen, PointF [] points, int count);
591 [DllImport (GdiPlus)]
592 static internal extern Status GdipDrawLinesI (IntPtr graphics, IntPtr pen, Point [] points, int count);
593 [DllImport (GdiPlus)]
594 static internal extern Status GdipDrawPath (IntPtr graphics, IntPtr pen, IntPtr path);
595 [DllImport (GdiPlus)]
596 static internal extern Status GdipDrawPie (IntPtr graphics, IntPtr pen, float x, float y, float width, float height, float startAngle, float sweepAngle);
597 [DllImport (GdiPlus)]
598 static internal extern Status GdipDrawPieI (IntPtr graphics, IntPtr pen, int x, int y, int width, int height, float startAngle, float sweepAngle);
599 [DllImport (GdiPlus)]
600 static internal extern Status GdipDrawPolygon (IntPtr graphics, IntPtr pen, PointF [] points, int count);
601 [DllImport (GdiPlus)]
602 static internal extern Status GdipDrawPolygonI (IntPtr graphics, IntPtr pen, Point [] points, int count);
603 [DllImport (GdiPlus)]
604 static internal extern Status GdipDrawRectangle (IntPtr graphics, IntPtr pen, float x, float y, float width, float height);
605 [DllImport (GdiPlus)]
606 static internal extern Status GdipDrawRectangleI (IntPtr graphics, IntPtr pen, int x, int y, int width, int height);
607 [DllImport (GdiPlus)]
608 static internal extern Status GdipDrawRectangles (IntPtr graphics, IntPtr pen, RectangleF [] rects, int count);
609 [DllImport (GdiPlus)]
610 static internal extern Status GdipDrawRectanglesI (IntPtr graphics, IntPtr pen, Rectangle [] rects, int count);
612 static internal extern Status GdipFillEllipseI (IntPtr graphics, IntPtr pen, int x, int y, int width, int height);
614 static internal extern Status GdipFillEllipse (IntPtr graphics, IntPtr pen, float x, float y, float width, float height);
615 [DllImport (GdiPlus)]
616 static internal extern Status GdipFillPolygon (IntPtr graphics, IntPtr brush, PointF [] points, int count, FillMode fillMode);
617 [DllImport (GdiPlus)]
618 static internal extern Status GdipFillPolygonI (IntPtr graphics, IntPtr brush, Point [] points, int count, FillMode fillMode);
619 [DllImport (GdiPlus)]
620 static internal extern Status GdipFillPolygon2 (IntPtr graphics, IntPtr brush, PointF [] points, int count);
621 [DllImport (GdiPlus)]
622 static internal extern Status GdipFillPolygon2I (IntPtr graphics, IntPtr brush, Point [] points, int count);
624 static internal extern Status GdipFillRectangle (IntPtr graphics, IntPtr brush, float x1, float y1, float x2, float y2);
626 static internal extern Status GdipFillRectangleI (IntPtr graphics, IntPtr brush, int x1, int y1, int x2, int y2);
628 static internal extern Status GdipFillRectangles (IntPtr graphics, IntPtr brush, RectangleF [] rects, int count);
630 static internal extern Status GdipFillRectanglesI (IntPtr graphics, IntPtr brush, Rectangle [] rects, int count);
631 [DllImport(GdiPlus, CharSet=CharSet.Unicode)]
632 static internal extern Status GdipDrawString (IntPtr graphics, string text, int len, IntPtr font, ref RectangleF rc, IntPtr format, IntPtr brush);
634 static internal extern Status GdipGetDC (IntPtr graphics, out IntPtr hdc);
636 static internal extern Status GdipReleaseDC (IntPtr graphics, IntPtr hdc);
638 static internal extern Status GdipDrawImageRectI (IntPtr graphics, IntPtr image, int x, int y, int width, int height);
639 [DllImport (GdiPlus)]
640 static internal extern Status GdipGetRenderingOrigin (IntPtr graphics, out int x, out int y);
641 [DllImport (GdiPlus)]
642 static internal extern Status GdipSetRenderingOrigin (IntPtr graphics, int x, int y);
644 internal static extern Status GdipCloneBitmapArea (float x, float y, float width, float height, PixelFormat format, IntPtr original, out IntPtr bitmap);
646 internal static extern Status GdipCloneBitmapAreaI (int x, int y, int width, int height, PixelFormat format, IntPtr original, out IntPtr bitmap);
648 internal static extern Status GdipResetWorldTransform (IntPtr graphics);
650 internal static extern Status GdipSetWorldTransform (IntPtr graphics, IntPtr matrix);
652 internal static extern Status GdipGetWorldTransform (IntPtr graphics, IntPtr matrix);
654 internal static extern Status GdipScaleWorldTransform (IntPtr graphics, float sx, float sy, MatrixOrder order);
656 internal static extern Status GdipGraphicsClear(IntPtr graphics, int argb);
658 internal static extern Status GdipDrawClosedCurve(IntPtr graphics, IntPtr pen, PointF [] points, int count);
660 internal static extern Status GdipDrawClosedCurveI(IntPtr graphics, IntPtr pen, Point [] points, int count);
662 internal static extern Status GdipDrawClosedCurve2(IntPtr graphics, IntPtr pen, PointF [] points, int count, float tension);
664 internal static extern Status GdipDrawClosedCurve2I(IntPtr graphics, IntPtr pen, Point [] points, int count, float tension);
666 internal static extern Status GdipDrawCurve(IntPtr graphics, IntPtr pen, PointF [] points, int count);
668 internal static extern Status GdipDrawCurveI(IntPtr graphics, IntPtr pen, Point [] points, int count);
670 internal static extern Status GdipDrawCurve2(IntPtr graphics, IntPtr pen, PointF [] points, int count, float tension);
672 internal static extern Status GdipDrawCurve2I(IntPtr graphics, IntPtr pen, Point [] points, int count, float tension);
674 internal static extern Status GdipDrawCurve3(IntPtr graphics, IntPtr pen, PointF [] points, int count, int offset, int numberOfSegments, float tension);
676 internal static extern Status GdipDrawCurve3I(IntPtr graphics, IntPtr pen, Point [] points, int count, int offset, int numberOfSegments, float tension);
678 internal static extern Status GdipSetClipRect(IntPtr graphics, float x, float y, float width, float height, CombineMode combineMode);
680 internal static extern Status GdipSetClipRectI(IntPtr graphics, int x, int y, int width, int height, CombineMode combineMode);
682 internal static extern Status GdipSetClipPath(IntPtr graphics, IntPtr path, CombineMode combineMode);
684 internal static extern Status GdipSetClipRegion(IntPtr graphics, IntPtr region, CombineMode combineMode);
686 internal static extern Status GdipSetClipGraphics(IntPtr graphics, IntPtr srcgraphics, CombineMode combineMode);
688 internal static extern Status GdipResetClip(IntPtr graphics);
690 internal static extern Status GdipEndContainer(IntPtr graphics, uint state);
692 internal static extern Status GdipGetClip (IntPtr graphics, IntPtr region);
695 internal static extern Status GdipFillClosedCurve(IntPtr graphics, IntPtr brush, PointF [] points, int count);
698 internal static extern Status GdipFillClosedCurveI(IntPtr graphics, IntPtr brush, Point [] points, int count);
701 internal static extern Status GdipFillClosedCurve2(IntPtr graphics, IntPtr brush,
702 PointF [] points, int count, float tension, FillMode fillMode);
705 internal static extern Status GdipFillClosedCurve2I(IntPtr graphics, IntPtr brush,
706 Point [] points, int count, float tension, FillMode fillMode);
709 internal static extern Status GdipFillPie(IntPtr graphics, IntPtr brush, float x, float y,
710 float width, float height, float startAngle, float sweepAngle);
713 internal static extern Status GdipFillPieI(IntPtr graphics, IntPtr brush, int x, int y,
714 int width, int height, float startAngle, float sweepAngle);
717 internal static extern Status GdipFillPath(IntPtr graphics, IntPtr brush, IntPtr path);
720 internal static extern Status GdipGetNearestColor(IntPtr graphics, out int argb);
723 internal static extern Status GdipIsVisiblePoint(IntPtr graphics, float x, float y, out bool result);
726 internal static extern Status GdipIsVisiblePointI(IntPtr graphics, int x, int y, out bool result);
729 internal static extern Status GdipIsVisibleRect(IntPtr graphics, float x, float y,
730 float width, float height, out bool result);
733 internal static extern Status GdipIsVisibleRectI(IntPtr graphics, int x, int y,
734 int width, int height, out bool result);
737 internal static extern Status GdipTransformPoints(IntPtr graphics, CoordinateSpace destSpace,
738 CoordinateSpace srcSpace, IntPtr points, int count);
741 internal static extern Status GdipTransformPointsI(IntPtr graphics, CoordinateSpace destSpace,
742 CoordinateSpace srcSpace, IntPtr points, int count);
745 internal static extern Status GdipTranslateClip(IntPtr graphics, float dx, float dy);
747 internal static extern Status GdipTranslateClipI(IntPtr graphics, int dx, int dy);
749 internal static extern Status GdipGetClipBounds(IntPtr graphics, out RectangleF rect);
751 internal static extern Status GdipSetCompositingMode(IntPtr graphics, CompositingMode compositingMode);
753 internal static extern Status GdipGetCompositingMode(IntPtr graphics, out CompositingMode compositingMode);
755 internal static extern Status GdipSetCompositingQuality(IntPtr graphics, CompositingQuality compositingQuality);
757 internal static extern Status GdipGetCompositingQuality(IntPtr graphics, out CompositingQuality compositingQuality);
759 internal static extern Status GdipSetInterpolationMode(IntPtr graphics, InterpolationMode interpolationMode);
761 internal static extern Status GdipGetInterpolationMode(IntPtr graphics, out InterpolationMode interpolationMode);
763 internal static extern Status GdipGetDpiX(IntPtr graphics, out float dpi);
765 internal static extern Status GdipGetDpiY(IntPtr graphics, out float dpi);
767 internal static extern Status GdipIsClipEmpty(IntPtr graphics, out bool result);
769 internal static extern Status GdipIsVisibleClipEmpty(IntPtr graphics, out bool result);
771 internal static extern Status GdipGetPageUnit(IntPtr graphics, out GraphicsUnit unit);
773 internal static extern Status GdipGetPageScale(IntPtr graphics, out float scale);
775 internal static extern Status GdipSetPageUnit(IntPtr graphics, GraphicsUnit unit);
777 internal static extern Status GdipSetPageScale(IntPtr graphics, float scale);
779 internal static extern Status GdipSetPixelOffsetMode(IntPtr graphics, PixelOffsetMode pixelOffsetMode);
781 internal static extern Status GdipGetPixelOffsetMode(IntPtr graphics, out PixelOffsetMode pixelOffsetMode);
783 internal static extern Status GdipSetSmoothingMode(IntPtr graphics, SmoothingMode smoothingMode);
785 internal static extern Status GdipGetSmoothingMode(IntPtr graphics, out SmoothingMode smoothingMode);
787 internal static extern Status GdipSetTextContrast(IntPtr graphics, int contrast);
789 internal static extern Status GdipGetTextContrast(IntPtr graphics, out int contrast);
791 internal static extern Status GdipSetTextRenderingHint(IntPtr graphics, TextRenderingHint mode);
793 internal static extern Status GdipGetTextRenderingHint(IntPtr graphics, out TextRenderingHint mode);
795 internal static extern Status GdipGetVisibleClipBounds(IntPtr graphics, out RectangleF rect);
798 internal static extern Status GdipFlush(IntPtr graphics, FlushIntention intention);
800 [DllImport(GdiPlus, CharSet=CharSet.Unicode)]
801 internal static extern Status GdipAddPathString (IntPtr path, string s, int lenght, IntPtr family, int style, float emSize, ref RectangleF layoutRect, IntPtr format);
802 [DllImport(GdiPlus, CharSet=CharSet.Unicode)]
803 internal static extern Status GdipAddPathStringI (IntPtr path, string s, int lenght, IntPtr family, int style, float emSize, ref Rectangle layoutRect, IntPtr format);
808 internal static extern Status GdipCreatePen1 (int argb, float width, GraphicsUnit unit, out IntPtr pen);
810 internal static extern Status GdipCreatePen2 (IntPtr brush, float width, GraphicsUnit unit, out IntPtr pen);
812 internal static extern Status GdipClonePen (IntPtr pen, out IntPtr clonepen);
814 internal static extern Status GdipDeletePen(IntPtr pen);
816 internal static extern Status GdipSetPenBrushFill (IntPtr pen, IntPtr brush);
818 internal static extern Status GdipGetPenBrushFill (IntPtr pen, out IntPtr brush);
820 internal static extern Status GdipGetPenFillType (IntPtr pen, out PenType type);
822 internal static extern Status GdipSetPenColor (IntPtr pen, int color);
824 internal static extern Status GdipGetPenColor (IntPtr pen, out int color);
826 internal static extern Status GdipSetPenCompoundArray (IntPtr pen, float[] dash, int count);
828 internal static extern Status GdipGetPenCompoundArray (IntPtr pen, float[] dash, int count);
830 internal static extern Status GdipGetPenCompoundCount (IntPtr pen, out int count);
832 internal static extern Status GdipSetPenDashCap197819 (IntPtr pen, DashCap dashCap);
834 internal static extern Status GdipGetPenDashCap197819 (IntPtr pen, out DashCap dashCap);
836 internal static extern Status GdipSetPenDashStyle (IntPtr pen, DashStyle dashStyle);
838 internal static extern Status GdipGetPenDashStyle (IntPtr pen, out DashStyle dashStyle);
840 internal static extern Status GdipSetPenDashOffset (IntPtr pen, float offset);
842 internal static extern Status GdipGetPenDashOffset (IntPtr pen, out float offset);
844 internal static extern Status GdipGetPenDashCount (IntPtr pen, out int count);
846 internal static extern Status GdipSetPenDashArray (IntPtr pen, float[] dash, int count);
848 internal static extern Status GdipGetPenDashArray (IntPtr pen, float[] dash, int count);
850 internal static extern Status GdipSetPenMiterLimit (IntPtr pen, float miterLimit);
852 internal static extern Status GdipGetPenMiterLimit (IntPtr pen, out float miterLimit);
854 internal static extern Status GdipSetPenLineJoin (IntPtr pen, LineJoin lineJoin);
856 internal static extern Status GdipGetPenLineJoin (IntPtr pen, out LineJoin lineJoin);
858 internal static extern Status GdipSetPenLineCap197819 (IntPtr pen, LineCap startCap, LineCap endCap, DashCap dashCap);
860 internal static extern Status GdipSetPenMode (IntPtr pen, PenAlignment alignment);
862 internal static extern Status GdipGetPenMode (IntPtr pen, out PenAlignment alignment);
864 internal static extern Status GdipSetPenStartCap (IntPtr pen, LineCap startCap);
866 internal static extern Status GdipGetPenStartCap (IntPtr pen, out LineCap startCap);
868 internal static extern Status GdipSetPenEndCap (IntPtr pen, LineCap endCap);
870 internal static extern Status GdipGetPenEndCap (IntPtr pen, out LineCap endCap);
872 internal static extern Status GdipSetPenCustomStartCap (IntPtr pen, IntPtr customCap);
874 internal static extern Status GdipGetPenCustomStartCap (IntPtr pen, out IntPtr customCap);
876 internal static extern Status GdipSetPenCustomEndCap (IntPtr pen, IntPtr customCap);
878 internal static extern Status GdipGetPenCustomEndCap (IntPtr pen, out IntPtr customCap);
880 internal static extern Status GdipSetPenTransform (IntPtr pen, IntPtr matrix);
882 internal static extern Status GdipGetPenTransform (IntPtr pen, IntPtr matrix);
884 internal static extern Status GdipSetPenWidth (IntPtr pen, float width);
886 internal static extern Status GdipGetPenWidth (IntPtr pen, out float width);
888 internal static extern Status GdipResetPenTransform (IntPtr pen);
890 internal static extern Status GdipMultiplyPenTransform (IntPtr pen, IntPtr matrix, MatrixOrder order);
892 internal static extern Status GdipRotatePenTransform (IntPtr pen, float angle, MatrixOrder order);
894 internal static extern Status GdipScalePenTransform (IntPtr pen, float sx, float sy, MatrixOrder order);
896 internal static extern Status GdipTranslatePenTransform (IntPtr pen, float dx, float dy, MatrixOrder order);
898 // CustomLineCap functions
900 internal static extern Status GdipCreateCustomLineCap (IntPtr fillPath, IntPtr strokePath, LineCap baseCap, float baseInset, out IntPtr customCap);
902 internal static extern Status GdipDeleteCustomLineCap (IntPtr customCap);
904 internal static extern Status GdipCloneCustomLineCap (IntPtr customCap, out IntPtr clonedCap);
906 internal static extern Status GdipSetCustomLineCapStrokeCaps (IntPtr customCap, LineCap startCap, LineCap endCap);
908 internal static extern Status GdipGetCustomLineCapStrokeCaps (IntPtr customCap, out LineCap startCap, out LineCap endCap);
910 internal static extern Status GdipSetCustomLineCapStrokeJoin (IntPtr customCap, LineJoin lineJoin);
912 internal static extern Status GdipGetCustomLineCapStrokeJoin (IntPtr customCap, out LineJoin lineJoin);
914 internal static extern Status GdipSetCustomLineCapBaseCap (IntPtr customCap, LineCap baseCap);
916 internal static extern Status GdipGetCustomLineCapBaseCap (IntPtr customCap, out LineCap baseCap);
918 internal static extern Status GdipSetCustomLineCapBaseInset (IntPtr customCap, float inset);
920 internal static extern Status GdipGetCustomLineCapBaseInset (IntPtr customCap, out float inset);
922 internal static extern Status GdipSetCustomLineCapWidthScale (IntPtr customCap, float widthScale);
924 internal static extern Status GdipGetCustomLineCapWidthScale (IntPtr customCap, out float widthScale);
926 // AdjustableArrowCap functions
928 internal static extern Status GdipCreateAdjustableArrowCap (float height, float width, bool isFilled, out IntPtr arrowCap);
930 internal static extern Status GdipSetAdjustableArrowCapHeight (IntPtr arrowCap, float height);
932 internal static extern Status GdipGetAdjustableArrowCapHeight (IntPtr arrowCap, out float height);
934 internal static extern Status GdipSetAdjustableArrowCapWidth (IntPtr arrowCap, float width);
936 internal static extern Status GdipGetAdjustableArrowCapWidth (IntPtr arrowCap, out float width);
938 internal static extern Status GdipSetAdjustableArrowCapMiddleInset (IntPtr arrowCap, float middleInset);
940 internal static extern Status GdipGetAdjustableArrowCapMiddleInset (IntPtr arrowCap, out float middleInset);
942 internal static extern Status GdipSetAdjustableArrowCapFillState (IntPtr arrowCap, bool isFilled);
944 internal static extern Status GdipGetAdjustableArrowCapFillState (IntPtr arrowCap, out bool isFilled);
948 internal static extern Status GdipCreateFromHWND (IntPtr hwnd, out IntPtr graphics);
950 [DllImport(GdiPlus, CharSet=CharSet.Unicode)]
951 internal unsafe static extern Status GdipMeasureString(IntPtr graphics, string str, int length,
952 IntPtr font, ref RectangleF layoutRect, IntPtr stringFormat, out RectangleF boundingBox,
953 int *codepointsFitted, int *linesFilled);
955 [DllImport(GdiPlus, CharSet=CharSet.Unicode)]
956 internal static extern Status GdipMeasureCharacterRanges (IntPtr graphics, string str, int length, IntPtr font,
957 ref RectangleF layoutRect, IntPtr stringFormat, int regcount, out IntPtr regions);
960 internal static extern Status GdipSetStringFormatMeasurableCharacterRanges (IntPtr native,
961 int cnt, CharacterRange [] range);
964 internal static extern Status GdipGetStringFormatMeasurableCharacterRangeCount (IntPtr native,
969 internal static extern Status GdipCreateBitmapFromScan0 (int width, int height, int stride, PixelFormat format, IntPtr scan0, out IntPtr bmp);
972 internal static extern Status GdipCreateBitmapFromGraphics (int width, int height, IntPtr target, out IntPtr bitmap);
975 internal static extern Status GdipBitmapLockBits (IntPtr bmp, ref Rectangle rc, ImageLockMode flags, PixelFormat format, [In, Out] BitmapData bmpData);
978 internal static extern Status GdipBitmapSetResolution(IntPtr bmp, float xdpi, float ydpi);
981 internal static extern Status GdipBitmapUnlockBits (IntPtr bmp, [In,Out] BitmapData bmpData);
984 internal static extern Status GdipBitmapGetPixel (IntPtr bmp, int x, int y, out int argb);
987 internal static extern Status GdipBitmapSetPixel (IntPtr bmp, int x, int y, int argb);
990 [DllImport(GdiPlus, CharSet=CharSet.Auto)]
991 internal static extern Status GdipLoadImageFromFile ( [MarshalAs(UnmanagedType.LPWStr)] string filename, out IntPtr image );
994 // Stream functions for Win32 (original Win32 ones)
995 [DllImport(GdiPlus, ExactSpelling=true, CharSet=CharSet.Unicode)]
996 internal static extern Status GdipLoadImageFromStream([MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(ComIStreamMarshaler))] IStream stream, out IntPtr image);
998 [DllImport(GdiPlus, ExactSpelling=true, CharSet=CharSet.Unicode)]
999 internal static extern Status GdipSaveImageToStream(HandleRef image, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(ComIStreamMarshaler))] IStream stream, [In()] ref Guid clsidEncoder, HandleRef encoderParams);
1002 [DllImport(GdiPlus)]
1003 internal static extern Status GdipCloneImage(IntPtr image, out IntPtr imageclone);
1005 [DllImport(GdiPlus, CharSet=CharSet.Auto)]
1006 internal static extern Status GdipLoadImageFromFileICM ( [MarshalAs(UnmanagedType.LPWStr)] string filename, out IntPtr image );
1008 [DllImport(GdiPlus)]
1009 internal static extern Status GdipCreateBitmapFromHBITMAP ( IntPtr hBitMap, IntPtr gdiPalette, out IntPtr image );
1011 [DllImport(GdiPlus)]
1012 internal static extern Status GdipDisposeImage ( IntPtr image );
1014 [DllImport(GdiPlus)]
1015 internal static extern Status GdipGetImageFlags(IntPtr image, out int flag);
1017 [DllImport (GdiPlus)]
1018 internal static extern Status GdipGetImageType (IntPtr image, out ImageType type);
1020 [DllImport(GdiPlus)]
1021 internal static extern Status GdipImageGetFrameDimensionsCount ( IntPtr image, out uint count );
1023 [DllImport(GdiPlus)]
1024 internal static extern Status GdipImageGetFrameDimensionsList ( IntPtr image, [Out] Guid [] dimensionIDs, uint count );
1026 [DllImport(GdiPlus)]
1027 internal static extern Status GdipGetImageHeight (IntPtr image, out uint height);
1029 [DllImport(GdiPlus)]
1030 internal static extern Status GdipGetImageHorizontalResolution ( IntPtr image, out float resolution );
1032 [DllImport(GdiPlus)]
1033 internal static extern Status GdipGetImagePaletteSize ( IntPtr image, out int size );
1035 [DllImport(GdiPlus)]
1036 internal static extern Status GdipGetImagePalette (IntPtr image, IntPtr palette, int size);
1038 [DllImport(GdiPlus)]
1039 internal static extern Status GdipSetImagePalette (IntPtr image, IntPtr palette);
1041 [DllImport(GdiPlus)]
1042 internal static extern Status GdipGetImageDimension ( IntPtr image, out float width, out float height );
1044 [DllImport(GdiPlus)]
1045 internal static extern Status GdipGetImagePixelFormat ( IntPtr image, out PixelFormat format );
1047 [DllImport(GdiPlus)]
1048 internal static extern Status GdipGetPropertyCount (IntPtr image, out uint propNumbers);
1050 [DllImport(GdiPlus)]
1051 internal static extern Status GdipGetPropertyIdList (IntPtr image, uint propNumbers, [Out] int [] list);
1053 [DllImport(GdiPlus)]
1054 internal static extern Status GdipGetPropertySize (IntPtr image, out int bufferSize, out int propNumbers);
1056 [DllImport(GdiPlus)]
1057 internal static extern Status GdipGetAllPropertyItems (IntPtr image, int bufferSize, int propNumbers, IntPtr items);
1059 [DllImport(GdiPlus)]
1060 internal static extern Status GdipGetImageRawFormat ( IntPtr image, out Guid format );
1062 [DllImport(GdiPlus)]
1063 internal static extern Status GdipGetImageVerticalResolution ( IntPtr image, out float resolution );
1065 [DllImport(GdiPlus)]
1066 internal static extern Status GdipGetImageWidth (IntPtr image, out uint width);
1068 [DllImport(GdiPlus)]
1069 internal static extern Status GdipGetImageBounds ( IntPtr image, out RectangleF source, ref GraphicsUnit unit );
1071 [DllImport(GdiPlus)]
1072 internal static extern Status GdipGetEncoderParameterListSize ( IntPtr image, ref Guid encoder, out uint size );
1074 [DllImport(GdiPlus)]
1075 internal static extern Status GdipGetEncoderParameterList ( IntPtr image, ref Guid encoder, uint size, IntPtr buffer );
1077 [DllImport(GdiPlus)]
1078 internal static extern Status GdipImageGetFrameCount (IntPtr image, ref Guid guidDimension, out uint count );
1080 [DllImport(GdiPlus)]
1081 internal static extern Status GdipImageSelectActiveFrame (IntPtr image, ref Guid guidDimension, int frameIndex);
1083 [DllImport(GdiPlus)]
1084 internal static extern Status GdipGetPropertyItemSize (IntPtr image, int propertyID, out int propertySize);
1086 [DllImport(GdiPlus)]
1087 internal static extern Status GdipGetPropertyItem (IntPtr image, int propertyID, int propertySize, IntPtr buffer);
1089 [DllImport(GdiPlus)]
1090 internal static extern Status GdipRemovePropertyItem (IntPtr image, int propertyId);
1092 [DllImport(GdiPlus)]
1093 internal unsafe static extern Status GdipSetPropertyItem (IntPtr image, GdipPropertyItem *propertyItem);
1095 [DllImport(GdiPlus)]
1096 internal static extern Status GdipGetImageThumbnail ( IntPtr image, uint width, uint height, out IntPtr thumbImage, IntPtr callback, IntPtr callBackData );
1098 [DllImport(GdiPlus)]
1099 internal static extern Status GdipImageRotateFlip ( IntPtr image, RotateFlipType rotateFlipType );
1101 [DllImport(GdiPlus, CharSet=CharSet.Unicode)]
1102 internal static extern Status GdipSaveImageToFile (IntPtr image, string filename, ref Guid encoderClsID, IntPtr encoderParameters);
1104 [DllImport(GdiPlus)]
1105 internal static extern Status GdipSaveAdd ( IntPtr image, IntPtr encoderParameters );
1107 [DllImport(GdiPlus)]
1108 internal static extern Status GdipSaveAddImage (IntPtr image, IntPtr imagenew, IntPtr encoderParameters);
1110 [DllImport(GdiPlus)]
1111 internal static extern Status GdipDrawImageI (IntPtr graphics, IntPtr image, int x, int y);
1112 [DllImport(GdiPlus)]
1113 internal static extern Status GdipGetImageGraphicsContext (IntPtr image, out IntPtr graphics);
1114 [DllImport(GdiPlus)]
1115 internal static extern Status GdipDrawImage (IntPtr graphics, IntPtr image, float x, float y);
1117 [DllImport(GdiPlus)]
1118 internal static extern Status GdipBeginContainer (IntPtr graphics, ref RectangleF dstrect, ref RectangleF srcrect, GraphicsUnit unit, out uint state);
1119 [DllImport(GdiPlus)]
1120 internal static extern Status GdipBeginContainerI (IntPtr graphics, ref Rectangle dstrect, ref Rectangle srcrect, GraphicsUnit unit, out uint state);
1121 [DllImport(GdiPlus)]
1122 internal static extern Status GdipBeginContainer2 (IntPtr graphics, out uint state);
1124 [DllImport(GdiPlus)]
1125 internal static extern Status GdipDrawImagePoints (IntPtr graphics, IntPtr image, PointF [] destPoints, int count);
1128 [DllImport(GdiPlus)]
1129 internal static extern Status GdipDrawImagePointsI (IntPtr graphics, IntPtr image, Point [] destPoints, int count);
1131 [DllImport(GdiPlus)]
1132 internal static extern Status GdipDrawImageRectRectI (IntPtr graphics, IntPtr image,
1133 int dstx, int dsty, int dstwidth, int dstheight,
1134 int srcx, int srcy, int srcwidth, int srcheight,
1135 GraphicsUnit srcUnit, IntPtr imageattr, Graphics.DrawImageAbort callback, IntPtr callbackData);
1137 [DllImport(GdiPlus)]
1138 internal static extern Status GdipDrawImageRectRect (IntPtr graphics, IntPtr image,
1139 float dstx, float dsty, float dstwidth, float dstheight,
1140 float srcx, float srcy, float srcwidth, float srcheight,
1141 GraphicsUnit srcUnit, IntPtr imageattr, Graphics.DrawImageAbort callback, IntPtr callbackData);
1143 [DllImport(GdiPlus)]
1144 internal static extern Status GdipDrawImagePointsRectI (IntPtr graphics, IntPtr image,
1145 Point [] destPoints, int count, int srcx, int srcy, int srcwidth, int srcheight,
1146 GraphicsUnit srcUnit, IntPtr imageattr, Graphics.DrawImageAbort callback, IntPtr callbackData);
1148 [DllImport(GdiPlus)]
1149 internal static extern Status GdipDrawImagePointsRect (IntPtr graphics, IntPtr image,
1150 PointF [] destPoints, int count, float srcx, float srcy, float srcwidth, float srcheight,
1151 GraphicsUnit srcUnit, IntPtr imageattr, Graphics.DrawImageAbort callback, IntPtr callbackData);
1153 [DllImport(GdiPlus)]
1154 internal static extern Status GdipDrawImageRect(IntPtr graphics, IntPtr image, float x, float y, float width, float height);
1155 [DllImport(GdiPlus)]
1156 internal static extern Status GdipDrawImagePointRect(IntPtr graphics, IntPtr image, float x,
1157 float y, float srcx, float srcy, float srcwidth, float srcheight, GraphicsUnit srcUnit);
1159 [DllImport(GdiPlus)]
1160 internal static extern Status GdipDrawImagePointRectI(IntPtr graphics, IntPtr image, int x,
1161 int y, int srcx, int srcy, int srcwidth,
1162 int srcheight, GraphicsUnit srcUnit);
1164 [DllImport(GdiPlus)]
1165 internal static extern Status GdipCreateStringFormat(StringFormatFlags formatAttributes, int language, out IntPtr native);
1167 [DllImport(GdiPlus)]
1168 internal static extern Status GdipCreateHBITMAPFromBitmap (IntPtr bmp, out IntPtr HandleBmp, int clrbackground);
1170 [DllImport(GdiPlus, CharSet=CharSet.Auto)]
1171 internal static extern Status GdipCreateBitmapFromFile ([MarshalAs (UnmanagedType.LPWStr)] string filename, out IntPtr bitmap);
1173 [DllImport(GdiPlus, CharSet=CharSet.Auto)]
1174 internal static extern Status GdipCreateBitmapFromFileICM ([MarshalAs (UnmanagedType.LPWStr)] string filename, out IntPtr bitmap);
1176 [DllImport(GdiPlus)]
1177 internal static extern Status GdipCreateHICONFromBitmap (IntPtr bmp, out IntPtr HandleIcon);
1179 [DllImport(GdiPlus)]
1180 internal static extern Status GdipCreateBitmapFromHICON (IntPtr hicon, out IntPtr bitmap);
1182 [DllImport(GdiPlus)]
1183 internal static extern Status GdipCreateBitmapFromResource (IntPtr hInstance,
1184 string lpBitmapName, out IntPtr bitmap);
1187 [DllImport (GdiPlus)]
1188 internal static extern Status GdipCreateMatrix (out IntPtr matrix);
1189 [DllImport (GdiPlus)]
1190 internal static extern Status GdipCreateMatrix2 (float m11, float m12, float m21, float m22, float dx, float dy, out IntPtr matrix);
1191 [DllImport (GdiPlus)]
1192 internal static extern Status GdipCreateMatrix3 (ref RectangleF rect, PointF [] dstplg, out IntPtr matrix);
1193 [DllImport (GdiPlus)]
1194 internal static extern Status GdipCreateMatrix3I (ref Rectangle rect, Point [] dstplg, out IntPtr matrix);
1195 [DllImport (GdiPlus)]
1196 internal static extern Status GdipDeleteMatrix (IntPtr matrix);
1198 [DllImport (GdiPlus)]
1199 internal static extern Status GdipCloneMatrix (IntPtr matrix, out IntPtr cloneMatrix);
1200 [DllImport (GdiPlus)]
1201 internal static extern Status GdipSetMatrixElements (IntPtr matrix, float m11, float m12, float m21, float m22, float dx, float dy);
1202 [DllImport (GdiPlus)]
1203 internal static extern Status GdipGetMatrixElements (IntPtr matrix, IntPtr matrixOut);
1204 [DllImport (GdiPlus)]
1205 internal static extern Status GdipMultiplyMatrix (IntPtr matrix, IntPtr matrix2, MatrixOrder order);
1206 [DllImport (GdiPlus)]
1207 internal static extern Status GdipTranslateMatrix (IntPtr matrix, float offsetX, float offsetY, MatrixOrder order);
1208 [DllImport (GdiPlus)]
1209 internal static extern Status GdipScaleMatrix (IntPtr matrix, float scaleX, float scaleY, MatrixOrder order);
1210 [DllImport (GdiPlus)]
1211 internal static extern Status GdipRotateMatrix (IntPtr matrix, float angle, MatrixOrder order);
1213 [DllImport (GdiPlus)]
1214 internal static extern Status GdipShearMatrix (IntPtr matrix, float shearX, float shearY, MatrixOrder order);
1216 [DllImport (GdiPlus)]
1217 internal static extern Status GdipInvertMatrix (IntPtr matrix);
1218 [DllImport (GdiPlus)]
1219 internal static extern Status GdipTransformMatrixPoints (IntPtr matrix, [In, Out] PointF [] pts, int count);
1220 [DllImport (GdiPlus)]
1221 internal static extern Status GdipTransformMatrixPointsI (IntPtr matrix, [In, Out] Point [] pts, int count);
1222 [DllImport (GdiPlus)]
1223 internal static extern Status GdipVectorTransformMatrixPoints (IntPtr matrix, [In, Out] PointF [] pts, int count);
1224 [DllImport (GdiPlus)]
1225 internal static extern Status GdipVectorTransformMatrixPointsI (IntPtr matrix, [In, Out] Point [] pts, int count);
1226 [DllImport (GdiPlus)]
1227 internal static extern Status GdipIsMatrixInvertible (IntPtr matrix, out bool result);
1229 [DllImport (GdiPlus)]
1230 internal static extern Status GdipIsMatrixIdentity (IntPtr matrix, out bool result);
1231 [DllImport (GdiPlus)]
1232 internal static extern Status GdipIsMatrixEqual (IntPtr matrix, IntPtr matrix2, out bool result);
1234 // GraphicsPath functions
1235 [DllImport (GdiPlus)]
1236 internal static extern Status GdipCreatePath (FillMode brushMode, out IntPtr path);
1237 [DllImport (GdiPlus)]
1238 internal static extern Status GdipCreatePath2 (PointF [] points, byte [] types, int count, FillMode brushMode, out IntPtr path);
1239 [DllImport (GdiPlus)]
1240 internal static extern Status GdipCreatePath2I (Point [] points, byte [] types, int count, FillMode brushMode, out IntPtr path);
1241 [DllImport (GdiPlus)]
1242 internal static extern Status GdipClonePath (IntPtr path, out IntPtr clonePath);
1243 [DllImport (GdiPlus)]
1244 internal static extern Status GdipDeletePath (IntPtr path);
1245 [DllImport (GdiPlus)]
1246 internal static extern Status GdipResetPath (IntPtr path);
1247 [DllImport (GdiPlus)]
1248 internal static extern Status GdipGetPointCount (IntPtr path, out int count);
1249 [DllImport (GdiPlus)]
1250 internal static extern Status GdipGetPathTypes (IntPtr path, [Out] byte [] types, int count);
1251 [DllImport (GdiPlus)]
1252 internal static extern Status GdipGetPathPoints (IntPtr path, [Out] PointF [] points, int count);
1253 [DllImport (GdiPlus)]
1254 internal static extern Status GdipGetPathPointsI (IntPtr path, [Out] Point [] points, int count);
1255 [DllImport (GdiPlus)]
1256 internal static extern Status GdipGetPathFillMode (IntPtr path, out FillMode fillMode);
1257 [DllImport (GdiPlus)]
1258 internal static extern Status GdipSetPathFillMode (IntPtr path, FillMode fillMode);
1259 [DllImport (GdiPlus)]
1260 internal static extern Status GdipStartPathFigure (IntPtr path);
1261 [DllImport (GdiPlus)]
1262 internal static extern Status GdipClosePathFigure (IntPtr path);
1263 [DllImport (GdiPlus)]
1264 internal static extern Status GdipClosePathFigures (IntPtr path);
1265 [DllImport (GdiPlus)]
1266 internal static extern Status GdipSetPathMarker (IntPtr path);
1267 [DllImport (GdiPlus)]
1268 internal static extern Status GdipClearPathMarkers (IntPtr path);
1269 [DllImport (GdiPlus)]
1270 internal static extern Status GdipReversePath (IntPtr path);
1271 [DllImport (GdiPlus)]
1272 internal static extern Status GdipGetPathLastPoint (IntPtr path, out PointF lastPoint);
1273 [DllImport (GdiPlus)]
1274 internal static extern Status GdipAddPathLine (IntPtr path, float x1, float y1, float x2, float y2);
1275 [DllImport (GdiPlus)]
1276 internal static extern Status GdipAddPathLine2 (IntPtr path, PointF[] points, int count);
1277 [DllImport (GdiPlus)]
1278 internal static extern Status GdipAddPathLine2I (IntPtr path, Point[] points, int count);
1279 [DllImport (GdiPlus)]
1280 internal static extern Status GdipAddPathArc (IntPtr path, float x, float y, float width, float height, float startAngle, float sweepAngle);
1281 [DllImport (GdiPlus)]
1282 internal static extern Status GdipAddPathBezier (IntPtr path, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4);
1283 [DllImport (GdiPlus)]
1284 internal static extern Status GdipAddPathBeziers (IntPtr path, PointF [] points, int count);
1285 [DllImport (GdiPlus)]
1286 internal static extern Status GdipAddPathCurve (IntPtr path, PointF [] points, int count);
1287 [DllImport (GdiPlus)]
1288 internal static extern Status GdipAddPathCurveI (IntPtr path, Point [] points, int count);
1289 [DllImport (GdiPlus)]
1290 internal static extern Status GdipAddPathCurve2 (IntPtr path, PointF [] points, int count, float tension);
1291 [DllImport (GdiPlus)]
1292 internal static extern Status GdipAddPathCurve2I (IntPtr path, Point [] points, int count, float tension);
1293 [DllImport (GdiPlus)]
1294 internal static extern Status GdipAddPathCurve3 (IntPtr path, PointF [] points, int count, int offset, int numberOfSegments, float tension);
1295 [DllImport (GdiPlus)]
1296 internal static extern Status GdipAddPathCurve3I (IntPtr path, Point [] points, int count, int offset, int numberOfSegments, float tension);
1297 [DllImport (GdiPlus)]
1298 internal static extern Status GdipAddPathClosedCurve (IntPtr path, PointF [] points, int count);
1299 [DllImport (GdiPlus)]
1300 internal static extern Status GdipAddPathClosedCurveI (IntPtr path, Point [] points, int count);
1301 [DllImport (GdiPlus)]
1302 internal static extern Status GdipAddPathClosedCurve2 (IntPtr path, PointF [] points, int count, float tension);
1303 [DllImport (GdiPlus)]
1304 internal static extern Status GdipAddPathClosedCurve2I (IntPtr path, Point [] points, int count, float tension);
1305 [DllImport (GdiPlus)]
1306 internal static extern Status GdipAddPathRectangle (IntPtr path, float x, float y, float width, float height);
1307 [DllImport (GdiPlus)]
1308 internal static extern Status GdipAddPathRectangles (IntPtr path, RectangleF [] rects, int count);
1309 [DllImport (GdiPlus)]
1310 internal static extern Status GdipAddPathEllipse (IntPtr path, float x, float y, float width, float height);
1311 [DllImport (GdiPlus)]
1312 internal static extern Status GdipAddPathEllipseI (IntPtr path, int x, int y, int width, int height);
1313 [DllImport (GdiPlus)]
1314 internal static extern Status GdipAddPathPie (IntPtr path, float x, float y, float width, float height, float startAngle, float sweepAngle);
1315 [DllImport (GdiPlus)]
1316 internal static extern Status GdipAddPathPieI (IntPtr path, int x, int y, int width, int height, float startAngle, float sweepAngle);
1317 [DllImport (GdiPlus)]
1318 internal static extern Status GdipAddPathPolygon (IntPtr path, PointF [] points, int count);
1319 [DllImport (GdiPlus)]
1320 internal static extern Status GdipAddPathPath (IntPtr path, IntPtr addingPath, bool connect);
1321 [DllImport (GdiPlus)]
1322 internal static extern Status GdipAddPathLineI (IntPtr path, int x1, int y1, int x2, int y2);
1323 [DllImport (GdiPlus)]
1324 internal static extern Status GdipAddPathArcI (IntPtr path, int x, int y, int width, int height, float startAngle, float sweepAngle);
1326 [DllImport (GdiPlus)]
1327 internal static extern Status GdipAddPathBezierI (IntPtr path, int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4);
1328 [DllImport (GdiPlus)]
1329 internal static extern Status GdipAddPathBeziersI (IntPtr path, Point [] points, int count);
1331 [DllImport (GdiPlus)]
1332 internal static extern Status GdipAddPathPolygonI (IntPtr path, Point [] points, int count);
1333 [DllImport (GdiPlus)]
1334 internal static extern Status GdipAddPathRectangleI (IntPtr path, int x, int y, int width, int height);
1335 [DllImport (GdiPlus)]
1336 internal static extern Status GdipAddPathRectanglesI (IntPtr path, Rectangle [] rects, int count);
1337 [DllImport (GdiPlus)]
1338 internal static extern Status GdipFlattenPath (IntPtr path, IntPtr matrix, float floatness);
1339 [DllImport (GdiPlus)]
1340 internal static extern Status GdipTransformPath (IntPtr path, IntPtr matrix);
1341 [DllImport (GdiPlus)]
1342 internal static extern Status GdipWarpPath (IntPtr path, IntPtr matrix,
1343 PointF [] points, int count,
1344 float srcx, float srcy, float srcwidth, float srcheight,
1345 WarpMode mode, float flatness);
1346 [DllImport (GdiPlus)]
1347 internal static extern Status GdipWidenPath (IntPtr path, IntPtr pen, IntPtr matrix, float flatness);
1348 [DllImport (GdiPlus)]
1349 internal static extern Status GdipGetPathWorldBounds (IntPtr path, out RectangleF bounds, IntPtr matrix, IntPtr pen);
1350 [DllImport (GdiPlus)]
1351 internal static extern Status GdipGetPathWorldBoundsI (IntPtr path, out Rectangle bounds, IntPtr matrix, IntPtr pen);
1352 [DllImport (GdiPlus)]
1353 internal static extern Status GdipIsVisiblePathPoint (IntPtr path, float x, float y, IntPtr graphics, out bool result);
1354 [DllImport (GdiPlus)]
1355 internal static extern Status GdipIsVisiblePathPointI (IntPtr path, int x, int y, IntPtr graphics, out bool result);
1356 [DllImport (GdiPlus)]
1357 internal static extern Status GdipIsOutlineVisiblePathPoint (IntPtr path, float x, float y, IntPtr pen, IntPtr graphics, out bool result);
1358 [DllImport (GdiPlus)]
1359 internal static extern Status GdipIsOutlineVisiblePathPointI (IntPtr path, int x, int y, IntPtr pen, IntPtr graphics, out bool result);
1361 // GraphicsPathIterator
1362 [DllImport(GdiPlus)]
1363 internal static extern Status GdipCreatePathIter (out IntPtr iterator, IntPtr path);
1364 [DllImport(GdiPlus)]
1365 internal static extern Status GdipPathIterGetCount (IntPtr iterator, out int count);
1366 [DllImport(GdiPlus)]
1367 internal static extern Status GdipPathIterGetSubpathCount (IntPtr iterator, out int count);
1368 [DllImport(GdiPlus)]
1369 internal static extern Status GdipDeletePathIter (IntPtr iterator);
1370 [DllImport(GdiPlus)]
1371 internal static extern Status GdipPathIterCopyData (IntPtr iterator, out int resultCount, PointF [] points, byte [] types, int startIndex, int endIndex);
1372 [DllImport(GdiPlus)]
1373 internal static extern Status GdipPathIterEnumerate (IntPtr iterator, out int resultCount, PointF [] points, byte [] types, int count);
1374 [DllImport(GdiPlus)]
1375 internal static extern Status GdipPathIterHasCurve (IntPtr iterator, out bool curve);
1376 [DllImport(GdiPlus)]
1377 internal static extern Status GdipPathIterNextMarkerPath (IntPtr iterator, out int resultCount, IntPtr path);
1378 [DllImport(GdiPlus)]
1379 internal static extern Status GdipPathIterNextMarker (IntPtr iterator, out int resultCount, out int startIndex, out int endIndex);
1380 [DllImport(GdiPlus)]
1381 internal static extern Status GdipPathIterNextPathType (IntPtr iterator, out int resultCount, out byte pathType, out int startIndex, out int endIndex);
1382 [DllImport(GdiPlus)]
1383 internal static extern Status GdipPathIterNextSubpathPath (IntPtr iterator, out int resultCount, IntPtr path, out bool isClosed);
1384 [DllImport(GdiPlus)]
1385 internal static extern Status GdipPathIterNextSubpath (IntPtr iterator, out int resultCount, out int startIndex, out int endIndex, out bool isClosed);
1386 [DllImport(GdiPlus)]
1387 internal static extern Status GdipPathIterRewind (IntPtr iterator);
1390 [DllImport (GdiPlus)]
1391 internal static extern Status GdipCreateImageAttributes (out IntPtr imageattr);
1393 [DllImport (GdiPlus)]
1394 internal static extern Status GdipSetImageAttributesColorKeys (IntPtr imageattr,
1395 ColorAdjustType type, bool enableFlag, int colorLow, int colorHigh);
1397 [DllImport (GdiPlus)]
1398 internal static extern Status GdipDisposeImageAttributes (IntPtr imageattr);
1400 [DllImport (GdiPlus)]
1401 internal static extern Status GdipSetImageAttributesColorMatrix (IntPtr imageattr,
1402 ColorAdjustType type, bool enableFlag, IntPtr colorMatrix,
1403 IntPtr grayMatrix, ColorMatrixFlag flags);
1405 [DllImport (GdiPlus)]
1406 internal static extern Status GdipSetImageAttributesGamma (IntPtr imageattr,
1407 ColorAdjustType type, bool enableFlag,
1410 [DllImport (GdiPlus)]
1411 internal static extern Status GdipSetImageAttributesNoOp (IntPtr imageattr,
1412 ColorAdjustType type, bool enableFlag);
1414 [DllImport (GdiPlus)]
1415 internal static extern Status GdipSetImageAttributesOutputChannel (IntPtr imageattr,
1416 ColorAdjustType type, bool enableFlag, ColorChannelFlag channelFlags);
1418 [DllImport (GdiPlus, CharSet=CharSet.Auto)]
1419 internal static extern Status GdipSetImageAttributesOutputChannelColorProfile (IntPtr imageattr,
1420 ColorAdjustType type, bool enableFlag, [MarshalAs (UnmanagedType.LPWStr)] string profileName);
1422 [DllImport (GdiPlus)]
1423 internal static extern Status GdipSetImageAttributesRemapTable (IntPtr imageattr,
1424 ColorAdjustType type, bool enableFlag, uint mapSize, IntPtr colorMap);
1426 [DllImport (GdiPlus)]
1427 internal static extern Status GdipSetImageAttributesThreshold (IntPtr imageattr,
1428 ColorAdjustType type, bool enableFlag, float thresHold);
1430 [DllImport (GdiPlus)]
1431 internal static extern Status GdipCloneImageAttributes(IntPtr imageattr, out IntPtr cloneImageattr);
1433 [DllImport (GdiPlus)]
1434 internal static extern Status GdipGetImageAttributesAdjustedPalette (IntPtr imageattr, IntPtr colorPalette,
1435 ColorAdjustType colorAdjustType);
1437 [DllImport (GdiPlus)]
1438 internal static extern Status GdipSetImageAttributesWrapMode(IntPtr imageattr, WrapMode wrap,
1439 int argb, bool clamp);
1443 [DllImport(GdiPlus)]
1444 internal static extern Status GdipCreateFont (IntPtr fontFamily, float emSize, FontStyle style, GraphicsUnit unit, out IntPtr font);
1445 [DllImport(GdiPlus)]
1446 internal static extern Status GdipDeleteFont (IntPtr font);
1447 [DllImport(GdiPlus, CharSet=CharSet.Auto)]
1448 internal static extern Status GdipGetLogFont(IntPtr font, IntPtr graphics, [MarshalAs(UnmanagedType.AsAny), Out] object logfontA);
1450 [DllImport(GdiPlus)]
1451 internal static extern Status GdipCreateFontFromDC(IntPtr hdc, out IntPtr font);
1452 [DllImport(GdiPlus, SetLastError=true, CharSet=CharSet.Auto)]
1453 internal static extern Status GdipCreateFontFromLogfont(IntPtr hdc, ref LOGFONT lf, out IntPtr ptr);
1455 // These are our private functions, they exists in our own libgdiplus library, this way we
1456 // avoid relying on wine in System.Drawing
1457 [DllImport(GdiPlus, CharSet=CharSet.Ansi)]
1458 internal static extern Status GdipCreateFontFromHfont(IntPtr hdc, out IntPtr font, ref LOGFONT lf);
1460 // This is win32/gdi, not gdiplus, but it's easier to keep in here, also see above comment
1461 [DllImport("gdi32.dll", CallingConvention=CallingConvention.StdCall, CharSet = CharSet.Auto)]
1462 internal static extern IntPtr CreateFontIndirect (ref LOGFONT logfont);
1463 [DllImport("user32.dll", EntryPoint="GetDC", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)]
1464 internal static extern IntPtr GetDC(IntPtr hwnd);
1465 [DllImport("user32.dll", EntryPoint="ReleaseDC", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)]
1466 internal static extern int ReleaseDC (IntPtr hWnd, IntPtr hDC);
1467 [DllImport("gdi32.dll", EntryPoint="SelectObject", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)]
1468 internal static extern IntPtr SelectObject(IntPtr hdc, IntPtr obj);
1469 [DllImport("user32.dll", SetLastError=true)]
1470 internal static extern bool GetIconInfo (IntPtr hIcon, out IconInfo iconinfo);
1471 [DllImport("user32.dll", CallingConvention = CallingConvention.StdCall, SetLastError=true)]
1472 internal static extern IntPtr CreateIconIndirect ([In] ref IconInfo piconinfo);
1473 [DllImport("user32.dll", CallingConvention = CallingConvention.StdCall, SetLastError=true)]
1474 internal static extern bool DestroyIcon (IntPtr hIcon);
1475 [DllImport("gdi32.dll")]
1476 internal static extern bool DeleteObject (IntPtr hObject);
1477 [DllImport("user32.dll")]
1478 internal static extern IntPtr GetDesktopWindow ();
1480 [DllImport("gdi32.dll", SetLastError=true)]
1481 public static extern int BitBlt(IntPtr hdcDest, int nXDest, int nYDest,
1482 int nWidth, int nHeight, IntPtr hdcSrc, int nXSrc, int nYSrc, int dwRop);
1484 [DllImport ("user32.dll", EntryPoint = "GetSysColor", CallingConvention = CallingConvention.StdCall)]
1485 public static extern uint Win32GetSysColor (GetSysColorIndex index);
1488 // Some special X11 stuff
1489 [DllImport("libX11", EntryPoint="XOpenDisplay")]
1490 internal extern static IntPtr XOpenDisplay(IntPtr display);
1492 [DllImport("libX11", EntryPoint="XCloseDisplay")]
1493 internal extern static int XCloseDisplay(IntPtr display);
1495 [DllImport ("libX11", EntryPoint="XRootWindow")]
1496 internal extern static IntPtr XRootWindow(IntPtr display, int screen);
1498 [DllImport ("libX11", EntryPoint="XDefaultScreen")]
1499 internal extern static int XDefaultScreen(IntPtr display);
1501 [DllImport ("libX11", EntryPoint="XDefaultDepth")]
1502 internal extern static uint XDefaultDepth(IntPtr display, int screen);
1504 [DllImport ("libX11", EntryPoint="XGetImage")]
1505 internal extern static IntPtr XGetImage(IntPtr display, IntPtr drawable, int src_x, int src_y, int width, int height, int pane, int format);
1507 [DllImport ("libX11", EntryPoint="XGetPixel")]
1508 internal extern static int XGetPixel(IntPtr image, int x, int y);
1510 [DllImport ("libX11", EntryPoint="XDestroyImage")]
1511 internal extern static int XDestroyImage(IntPtr image);
1513 [DllImport ("libX11", EntryPoint="XDefaultVisual")]
1514 internal extern static IntPtr XDefaultVisual(IntPtr display, int screen);
1516 [DllImport ("libX11", EntryPoint="XGetVisualInfo")]
1517 internal extern static IntPtr XGetVisualInfo (IntPtr display, int vinfo_mask, ref XVisualInfo vinfo_template, ref int nitems);
1519 [DllImport ("libX11", EntryPoint="XVisualIDFromVisual")]
1520 internal extern static IntPtr XVisualIDFromVisual (IntPtr visual);
1522 [DllImport ("libX11", EntryPoint="XFree")]
1523 internal extern static void XFree (IntPtr data);
1526 [DllImport (GdiPlus)]
1527 internal static extern Status GdipGetFontCollectionFamilyCount (IntPtr collection, out int found);
1529 [DllImport (GdiPlus)]
1530 internal static extern Status GdipGetFontCollectionFamilyList (IntPtr collection, int getCount, IntPtr[] dest, out int retCount);
1531 //internal static extern Status GdipGetFontCollectionFamilyList( IntPtr collection, int getCount, [Out] FontFamily [] familyList, out int retCount );
1533 [DllImport (GdiPlus)]
1534 internal static extern Status GdipNewInstalledFontCollection (out IntPtr collection);
1536 [DllImport (GdiPlus)]
1537 internal static extern Status GdipNewPrivateFontCollection (out IntPtr collection);
1539 [DllImport (GdiPlus)]
1540 internal static extern Status GdipDeletePrivateFontCollection (ref IntPtr collection);
1542 [DllImport (GdiPlus, CharSet=CharSet.Auto)]
1543 internal static extern Status GdipPrivateAddFontFile (IntPtr collection,
1544 [MarshalAs (UnmanagedType.LPWStr)] string fileName );
1546 [DllImport (GdiPlus)]
1547 internal static extern Status GdipPrivateAddMemoryFont (IntPtr collection, IntPtr mem, int length);
1550 [DllImport (GdiPlus, CharSet=CharSet.Auto)]
1551 internal static extern Status GdipCreateFontFamilyFromName (
1552 [MarshalAs(UnmanagedType.LPWStr)] string fName, IntPtr collection, out IntPtr fontFamily);
1554 [DllImport (GdiPlus, CharSet=CharSet.Unicode)]
1555 internal static extern Status GdipGetFamilyName(IntPtr family, StringBuilder name, int language);
1557 [DllImport (GdiPlus)]
1558 internal static extern Status GdipGetGenericFontFamilySansSerif (out IntPtr fontFamily);
1560 [DllImport (GdiPlus)]
1561 internal static extern Status GdipGetGenericFontFamilySerif (out IntPtr fontFamily);
1563 [DllImport (GdiPlus)]
1564 internal static extern Status GdipGetGenericFontFamilyMonospace (out IntPtr fontFamily);
1566 [DllImport (GdiPlus)]
1567 internal static extern Status GdipGetCellAscent (IntPtr fontFamily, int style, out short ascent);
1569 [DllImport (GdiPlus)]
1570 internal static extern Status GdipGetCellDescent (IntPtr fontFamily, int style, out short descent);
1572 [DllImport (GdiPlus)]
1573 internal static extern Status GdipGetLineSpacing (IntPtr fontFamily, int style, out short spacing);
1575 [DllImport (GdiPlus)]
1576 internal static extern Status GdipGetEmHeight (IntPtr fontFamily, int style, out short emHeight);
1578 [DllImport (GdiPlus)]
1579 internal static extern Status GdipIsStyleAvailable (IntPtr fontFamily, int style, out bool styleAvailable);
1581 [DllImport (GdiPlus)]
1582 internal static extern Status GdipDeleteFontFamily (IntPtr fontFamily);
1584 [DllImport (GdiPlus)]
1585 internal static extern Status GdipGetFontSize (IntPtr font, out float size);
1587 [DllImport (GdiPlus)]
1588 internal static extern Status GdipGetFontHeight (IntPtr font, IntPtr graphics, out float height);
1590 [DllImport (GdiPlus)]
1591 internal static extern Status GdipGetFontHeightGivenDPI (IntPtr font, float dpi, out float height);
1593 [DllImport (GdiPlus)]
1594 internal static extern Status GdipCloneFontFamily (IntPtr fontFamily, out IntPtr clone);
1598 [DllImport (GdiPlus)]
1599 internal static extern Status GdipCreateStringFormat(int formatAttributes, int language, out IntPtr format);
1600 [DllImport (GdiPlus)]
1601 internal static extern Status GdipStringFormatGetGenericDefault(out IntPtr format);
1602 [DllImport (GdiPlus)]
1603 internal static extern Status GdipStringFormatGetGenericTypographic(out IntPtr format);
1604 [DllImport (GdiPlus)]
1605 internal static extern Status GdipDeleteStringFormat(IntPtr format);
1606 [DllImport (GdiPlus)]
1607 internal static extern Status GdipCloneStringFormat(IntPtr srcformat, out IntPtr format);
1608 [DllImport (GdiPlus)]
1609 internal static extern Status GdipSetStringFormatFlags(IntPtr format, StringFormatFlags flags);
1610 [DllImport (GdiPlus)]
1611 internal static extern Status GdipGetStringFormatFlags(IntPtr format, out StringFormatFlags flags);
1612 [DllImport (GdiPlus)]
1613 internal static extern Status GdipSetStringFormatAlign(IntPtr format, StringAlignment align);
1614 [DllImport (GdiPlus)]
1615 internal static extern Status GdipGetStringFormatAlign(IntPtr format, out StringAlignment align);
1616 [DllImport (GdiPlus)]
1617 internal static extern Status GdipSetStringFormatLineAlign(IntPtr format, StringAlignment align);
1618 [DllImport (GdiPlus)]
1619 internal static extern Status GdipGetStringFormatLineAlign(IntPtr format, out StringAlignment align);
1620 [DllImport (GdiPlus)]
1621 internal static extern Status GdipSetStringFormatTrimming(IntPtr format, StringTrimming trimming);
1622 [DllImport (GdiPlus)]
1623 internal static extern Status GdipGetStringFormatTrimming(IntPtr format, out StringTrimming trimming);
1624 [DllImport (GdiPlus)]
1625 internal static extern Status GdipSetStringFormatHotkeyPrefix(IntPtr format, HotkeyPrefix hotkeyPrefix);
1626 [DllImport (GdiPlus)]
1627 internal static extern Status GdipGetStringFormatHotkeyPrefix(IntPtr format, out HotkeyPrefix hotkeyPrefix);
1628 [DllImport (GdiPlus)]
1629 internal static extern Status GdipSetStringFormatTabStops(IntPtr format, float firstTabOffset, int count, float [] tabStops);
1630 [DllImport (GdiPlus)]
1631 internal static extern Status GdipGetStringFormatDigitSubstitution(IntPtr format, int language, out StringDigitSubstitute substitute);
1632 [DllImport (GdiPlus)]
1633 internal static extern Status GdipSetStringFormatDigitSubstitution(IntPtr format, int language, StringDigitSubstitute substitute);
1634 [DllImport (GdiPlus)]
1635 internal static extern Status GdipGetStringFormatTabStopCount(IntPtr format, out int count);
1636 [DllImport (GdiPlus)]
1637 internal static extern Status GdipGetStringFormatTabStops(IntPtr format, int count, out float firstTabOffset, [In, Out] float [] tabStops);
1640 [DllImport (GdiPlus, CharSet = CharSet.Auto)]
1641 internal static extern Status GdipCreateMetafileFromFile ([MarshalAs (UnmanagedType.LPWStr)] string filename, out IntPtr metafile);
1642 [DllImport (GdiPlus)]
1643 internal static extern Status GdipCreateMetafileFromEmf (IntPtr hEmf, bool deleteEmf, out IntPtr metafile);
1644 [DllImport (GdiPlus)]
1645 internal static extern Status GdipCreateMetafileFromWmf (IntPtr hWmf, bool deleteWmf, WmfPlaceableFileHeader wmfPlaceableFileHeader, out IntPtr metafile);
1646 [DllImport (GdiPlus, CharSet = CharSet.Auto)]
1647 internal static extern Status GdipGetMetafileHeaderFromFile ([MarshalAs (UnmanagedType.LPWStr)] string filename, IntPtr header);
1648 [DllImport (GdiPlus)]
1649 internal static extern Status GdipGetMetafileHeaderFromMetafile (IntPtr metafile, IntPtr header);
1650 [DllImport (GdiPlus)]
1651 internal static extern Status GdipGetMetafileHeaderFromEmf (IntPtr hEmf, IntPtr header);
1652 [DllImport (GdiPlus)]
1653 internal static extern Status GdipGetMetafileHeaderFromWmf (IntPtr hWmf, IntPtr wmfPlaceableFileHeader, IntPtr header);
1654 [DllImport (GdiPlus)]
1655 internal static extern Status GdipGetHemfFromMetafile (IntPtr metafile, out IntPtr hEmf);
1656 [DllImport (GdiPlus)]
1657 internal static extern Status GdipGetMetafileDownLevelRasterizationLimit (IntPtr metafile, ref uint metafileRasterizationLimitDpi);
1658 [DllImport (GdiPlus)]
1659 internal static extern Status GdipSetMetafileDownLevelRasterizationLimit (IntPtr metafile, uint metafileRasterizationLimitDpi);
1660 [DllImport (GdiPlus)]
1661 internal static extern Status GdipPlayMetafileRecord (IntPtr metafile, EmfPlusRecordType recordType, int flags, int dataSize, byte[] data);
1663 [DllImport (GdiPlus)]
1664 internal static extern Status GdipRecordMetafile (IntPtr hdc, EmfType type, ref RectangleF frameRect,
1665 MetafileFrameUnit frameUnit, [MarshalAs (UnmanagedType.LPWStr)] string description, out IntPtr metafile);
1666 [DllImport (GdiPlus)]
1667 internal static extern Status GdipRecordMetafileI (IntPtr hdc, EmfType type, ref Rectangle frameRect,
1668 MetafileFrameUnit frameUnit, [MarshalAs (UnmanagedType.LPWStr)] string description, out IntPtr metafile);
1669 [DllImport (GdiPlus)]
1670 internal static extern Status GdipRecordMetafileFileName ([MarshalAs (UnmanagedType.LPWStr)] string filename, IntPtr hdc, EmfType type,
1671 ref RectangleF frameRect, MetafileFrameUnit frameUnit, [MarshalAs (UnmanagedType.LPWStr)] string description, out IntPtr metafile);
1672 [DllImport (GdiPlus)]
1673 internal static extern Status GdipRecordMetafileFileNameI ([MarshalAs (UnmanagedType.LPWStr)] string filename, IntPtr hdc, EmfType type,
1674 ref Rectangle frameRect, MetafileFrameUnit frameUnit, [MarshalAs (UnmanagedType.LPWStr)] string description, out IntPtr metafile);
1676 [DllImport(GdiPlus, ExactSpelling=true, CharSet=CharSet.Unicode)]
1677 internal static extern Status GdipCreateMetafileFromStream([MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(ComIStreamMarshaler))] IStream stream, out IntPtr metafile);
1678 [DllImport(GdiPlus, ExactSpelling=true, CharSet=CharSet.Unicode)]
1679 internal static extern Status GdipGetMetafileHeaderFromStream([MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(ComIStreamMarshaler))] IStream stream, IntPtr header);
1681 [DllImport (GdiPlus)]
1682 internal static extern Status GdipRecordMetafileStream ([MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(ComIStreamMarshaler))] IStream stream, IntPtr hdc,
1683 EmfType type, ref RectangleF frameRect, MetafileFrameUnit frameUnit, [MarshalAs (UnmanagedType.LPWStr)] string description, out IntPtr metafile);
1684 [DllImport (GdiPlus)]
1685 internal static extern Status GdipRecordMetafileStreamI ([MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(ComIStreamMarshaler))] IStream stream, IntPtr hdc,
1686 EmfType type, ref Rectangle frameRect, MetafileFrameUnit frameUnit, [MarshalAs (UnmanagedType.LPWStr)] string description, out IntPtr metafile);
1688 //ImageCodecInfo functions
1689 [DllImport(GdiPlus)]
1690 static internal extern Status GdipGetImageDecodersSize (out int decoderNums, out int arraySize);
1691 [DllImport(GdiPlus)]
1692 static internal extern Status GdipGetImageDecoders (int decoderNums, int arraySize, IntPtr decoders);
1693 [DllImport(GdiPlus)]
1694 static internal extern Status GdipGetImageEncodersSize (out int encoderNums, out int arraySize);
1695 [DllImport(GdiPlus)]
1696 static internal extern Status GdipGetImageEncoders (int encoderNums, int arraySize, IntPtr encoders);
1699 // These are stuff that is unix-only
1701 public delegate int StreamGetHeaderDelegate(IntPtr buf, int bufsz);
1702 public delegate int StreamGetBytesDelegate (IntPtr buf, int bufsz, bool peek);
1703 public delegate long StreamSeekDelegate (int offset, int whence);
1704 public delegate int StreamPutBytesDelegate (IntPtr buf, int bufsz);
1705 public delegate void StreamCloseDelegate ();
1706 public delegate long StreamSizeDelegate ();
1708 internal sealed class GdiPlusStreamHelper {
1709 public Stream stream;
1711 private StreamGetHeaderDelegate sghd = null;
1712 private StreamGetBytesDelegate sgbd = null;
1713 private StreamSeekDelegate skd = null;
1714 private StreamPutBytesDelegate spbd = null;
1715 private StreamCloseDelegate scd = null;
1716 private StreamSizeDelegate ssd = null;
1717 private byte[] start_buf;
1718 private int start_buf_pos;
1719 private int start_buf_len;
1720 private byte[] managedBuf;
1721 private const int default_bufsize = 4096;
1723 public GdiPlusStreamHelper (Stream s, bool seekToOrigin)
1725 managedBuf = new byte [default_bufsize];
1728 if (stream != null && stream.CanSeek && seekToOrigin) {
1729 stream.Seek (0, SeekOrigin.Begin);
1733 public int StreamGetHeaderImpl (IntPtr buf, int bufsz) {
1736 start_buf = new byte[bufsz];
1739 bytesRead = stream.Read (start_buf, 0, bufsz);
1740 } catch (IOException) {
1744 if (bytesRead > 0 && buf != IntPtr.Zero) {
1745 Marshal.Copy (start_buf, 0, (IntPtr) (buf.ToInt64()), bytesRead);
1749 start_buf_len = bytesRead;
1754 public StreamGetHeaderDelegate GetHeaderDelegate {
1756 if (stream != null && stream.CanRead) {
1758 sghd = new StreamGetHeaderDelegate (StreamGetHeaderImpl);
1766 public int StreamGetBytesImpl (IntPtr buf, int bufsz, bool peek)
1768 if (buf == IntPtr.Zero && peek) {
1772 if (bufsz > managedBuf.Length)
1773 managedBuf = new byte[bufsz];
1775 long streamPosition = 0;
1778 if (stream.CanSeek) {
1779 streamPosition = stream.Position;
1781 if (start_buf_len > 0) {
1782 if (start_buf_len > bufsz) {
1783 Array.Copy(start_buf, start_buf_pos, managedBuf, 0, bufsz);
1784 start_buf_pos += bufsz;
1785 start_buf_len -= bufsz;
1790 Array.Copy(start_buf, start_buf_pos, managedBuf, 0, start_buf_len);
1791 bufsz -= start_buf_len;
1792 bytesRead = start_buf_len;
1799 bytesRead += stream.Read (managedBuf, bytesRead, bufsz);
1800 } catch (IOException) {
1805 if (bytesRead > 0 && buf != IntPtr.Zero) {
1806 Marshal.Copy (managedBuf, 0, (IntPtr) (buf.ToInt64()), bytesRead);
1809 if (!stream.CanSeek && (bufsz == 10) && peek) {
1810 // Special 'hack' to support peeking of the type for gdi+ on non-seekable streams
1814 if (stream.CanSeek) {
1815 // If we are peeking bytes, then go back to original position before peeking
1816 stream.Seek (streamPosition, SeekOrigin.Begin);
1818 throw new NotSupportedException();
1826 public StreamGetBytesDelegate GetBytesDelegate {
1828 if (stream != null && stream.CanRead) {
1830 sgbd = new StreamGetBytesDelegate (StreamGetBytesImpl);
1838 public long StreamSeekImpl (int offset, int whence)
1840 // Make sure we have a valid 'whence'.
1841 if ((whence < 0) || (whence > 2))
1844 // Invalidate the start_buf if we're actually going to call a Seek method.
1845 start_buf_pos += start_buf_len;
1850 // Translate 'whence' into a SeekOrigin enum member.
1853 case 0: origin = SeekOrigin.Begin; break;
1854 case 1: origin = SeekOrigin.Current; break;
1855 case 2: origin = SeekOrigin.End; break;
1857 // The following line is redundant but necessary to avoid a
1858 // "Use of unassigned local variable" error without actually
1859 // initializing 'origin' to a dummy value.
1863 // Do the actual seek operation and return its result.
1864 return stream.Seek ((long) offset, origin);
1867 public StreamSeekDelegate SeekDelegate {
1869 if (stream != null && stream.CanSeek) {
1871 skd = new StreamSeekDelegate (StreamSeekImpl);
1879 public int StreamPutBytesImpl (IntPtr buf, int bufsz)
1881 if (bufsz > managedBuf.Length)
1882 managedBuf = new byte[bufsz];
1883 Marshal.Copy (buf, managedBuf, 0, bufsz);
1884 stream.Write (managedBuf, 0, bufsz);
1888 public StreamPutBytesDelegate PutBytesDelegate {
1890 if (stream != null && stream.CanWrite) {
1892 spbd = new StreamPutBytesDelegate (StreamPutBytesImpl);
1900 public void StreamCloseImpl ()
1905 public StreamCloseDelegate CloseDelegate {
1907 if (stream != null) {
1909 scd = new StreamCloseDelegate (StreamCloseImpl);
1917 public long StreamSizeImpl ()
1920 return stream.Length;
1926 public StreamSizeDelegate SizeDelegate {
1928 if (stream != null) {
1930 ssd = new StreamSizeDelegate (StreamSizeImpl);
1940 /* Mac only function calls */
1941 [DllImport(GdiPlus)]
1942 internal static extern Status GdipCreateFromContext_macosx (IntPtr cgref, int width, int height, out IntPtr graphics);
1944 /* Linux only function calls*/
1945 [DllImport(GdiPlus)]
1946 internal static extern Status GdipSetVisibleClip_linux (IntPtr graphics, ref Rectangle rect);
1948 [DllImport(GdiPlus)]
1949 internal static extern Status GdipCreateFromXDrawable_linux (IntPtr drawable, IntPtr display, out IntPtr graphics);
1951 // Stream functions for non-Win32 (libgdiplus specific)
1952 [DllImport(GdiPlus)]
1953 static internal extern Status GdipLoadImageFromDelegate_linux (StreamGetHeaderDelegate getHeader,
1954 StreamGetBytesDelegate getBytes, StreamPutBytesDelegate putBytes, StreamSeekDelegate doSeek,
1955 StreamCloseDelegate close, StreamSizeDelegate size, out IntPtr image);
1957 [DllImport(GdiPlus)]
1958 static internal extern Status GdipSaveImageToDelegate_linux (IntPtr image, StreamGetBytesDelegate getBytes,
1959 StreamPutBytesDelegate putBytes, StreamSeekDelegate doSeek, StreamCloseDelegate close,
1960 StreamSizeDelegate size, ref Guid encoderClsID, IntPtr encoderParameters);
1962 [DllImport(GdiPlus)]
1963 static internal extern Status GdipCreateMetafileFromDelegate_linux (StreamGetHeaderDelegate getHeader,
1964 StreamGetBytesDelegate getBytes, StreamPutBytesDelegate putBytes, StreamSeekDelegate doSeek,
1965 StreamCloseDelegate close, StreamSizeDelegate size, out IntPtr metafile);
1967 [DllImport(GdiPlus)]
1968 static internal extern Status GdipGetMetafileHeaderFromDelegate_linux (StreamGetHeaderDelegate getHeader,
1969 StreamGetBytesDelegate getBytes, StreamPutBytesDelegate putBytes, StreamSeekDelegate doSeek,
1970 StreamCloseDelegate close, StreamSizeDelegate size, IntPtr header);
1972 [DllImport(GdiPlus)]
1973 static internal extern Status GdipRecordMetafileFromDelegate_linux (StreamGetHeaderDelegate getHeader,
1974 StreamGetBytesDelegate getBytes, StreamPutBytesDelegate putBytes, StreamSeekDelegate doSeek,
1975 StreamCloseDelegate close, StreamSizeDelegate size, IntPtr hdc, EmfType type, ref RectangleF frameRect,
1976 MetafileFrameUnit frameUnit, [MarshalAs (UnmanagedType.LPWStr)] string description, out IntPtr metafile);
1978 [DllImport(GdiPlus)]
1979 static internal extern Status GdipRecordMetafileFromDelegateI_linux (StreamGetHeaderDelegate getHeader,
1980 StreamGetBytesDelegate getBytes, StreamPutBytesDelegate putBytes, StreamSeekDelegate doSeek,
1981 StreamCloseDelegate close, StreamSizeDelegate size, IntPtr hdc, EmfType type, ref Rectangle frameRect,
1982 MetafileFrameUnit frameUnit, [MarshalAs (UnmanagedType.LPWStr)] string description, out IntPtr metafile);
1984 [DllImport ("libc")]
1985 static extern int uname (IntPtr buf);