зеркало из https://github.com/mono/corefx.git
Remove GPRECT and GPRECTF
They match directly with Rectangle/RectangleF
This commit is contained in:
Родитель
a0dd2fc0cf
Коммит
9123e8ff2c
|
@ -132,8 +132,6 @@
|
|||
<Compile Include="System\Drawing\Gdiplus.cs" />
|
||||
<Compile Include="System\Drawing\NativeMethods.cs" />
|
||||
<Compile Include="System\Drawing\UnsafeNativeMethods.cs" />
|
||||
<Compile Include="System\Drawing\Internal\GPRECT.cs" />
|
||||
<Compile Include="System\Drawing\Internal\GPRECTF.cs" />
|
||||
<Compile Include="System\Drawing\Internal\ISystemEventTracker.cs" />
|
||||
<Compile Include="System\Drawing\Brush.cs" />
|
||||
<Compile Include="System\Drawing\Font.cs" />
|
||||
|
|
|
@ -4,10 +4,8 @@
|
|||
|
||||
using System.ComponentModel;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Drawing.Internal;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security.Permissions;
|
||||
|
||||
namespace System.Drawing
|
||||
{
|
||||
|
@ -238,9 +236,9 @@ namespace System.Drawing
|
|||
|
||||
public BitmapData LockBits(Rectangle rect, ImageLockMode flags, PixelFormat format, BitmapData bitmapData)
|
||||
{
|
||||
var gprect = new GPRECT(rect);
|
||||
int status = SafeNativeMethods.Gdip.GdipBitmapLockBits(new HandleRef(this, nativeImage), ref gprect,
|
||||
flags, format, bitmapData);
|
||||
int status = SafeNativeMethods.Gdip.GdipBitmapLockBits(
|
||||
new HandleRef(this, nativeImage), ref rect, flags, format, bitmapData);
|
||||
|
||||
// libgdiplus has the wrong error code mapping for this state.
|
||||
if (status == 7)
|
||||
{
|
||||
|
|
|
@ -146,11 +146,8 @@ namespace System.Drawing.Drawing2D
|
|||
{
|
||||
get
|
||||
{
|
||||
GPRECTF rect = new GPRECTF();
|
||||
|
||||
Gdip.CheckStatus(Gdip.GdipGetPathGradientRect(new HandleRef(this, NativeBrush), ref rect));
|
||||
|
||||
return rect.ToRectangleF();
|
||||
Gdip.CheckStatus(Gdip.GdipGetPathGradientRect(new HandleRef(this, NativeBrush), out RectangleF rect));
|
||||
return rect;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -174,9 +171,11 @@ namespace System.Drawing.Drawing2D
|
|||
|
||||
// Return the result in a managed array
|
||||
|
||||
Blend blend = new Blend(count);
|
||||
blend.Factors = factors;
|
||||
blend.Positions = positions;
|
||||
Blend blend = new Blend(count)
|
||||
{
|
||||
Factors = factors,
|
||||
Positions = positions
|
||||
};
|
||||
|
||||
return blend;
|
||||
}
|
||||
|
|
|
@ -532,9 +532,9 @@ namespace System.Drawing
|
|||
private static FunctionWrapper<GdipGetImageGraphicsContext_delegate> GdipGetImageGraphicsContext_ptr;
|
||||
internal static int GdipGetImageGraphicsContext(HandleRef image, out IntPtr graphics) => GdipGetImageGraphicsContext_ptr.Delegate(image, out graphics);
|
||||
|
||||
private delegate int GdipGetImageBounds_delegate(HandleRef image, ref GPRECTF gprectf, out GraphicsUnit unit);
|
||||
private delegate int GdipGetImageBounds_delegate(HandleRef image, out RectangleF gprectf, out GraphicsUnit unit);
|
||||
private static FunctionWrapper<GdipGetImageBounds_delegate> GdipGetImageBounds_ptr;
|
||||
internal static int GdipGetImageBounds(HandleRef image, ref GPRECTF gprectf, out GraphicsUnit unit) => GdipGetImageBounds_ptr.Delegate(image, ref gprectf, out unit);
|
||||
internal static int GdipGetImageBounds(HandleRef image, out RectangleF gprectf, out GraphicsUnit unit) => GdipGetImageBounds_ptr.Delegate(image, out gprectf, out unit);
|
||||
|
||||
private delegate int GdipGetImageType_delegate(HandleRef image, out int type);
|
||||
private static FunctionWrapper<GdipGetImageType_delegate> GdipGetImageType_ptr;
|
||||
|
@ -972,41 +972,41 @@ namespace System.Drawing
|
|||
private static FunctionWrapper<GdipCreateMetafileFromStream_delegate> GdipCreateMetafileFromStream_ptr;
|
||||
internal static int GdipCreateMetafileFromStream(UnsafeNativeMethods.IStream stream, out IntPtr metafile) => GdipCreateMetafileFromStream_ptr.Delegate(stream, out metafile);
|
||||
|
||||
private delegate int GdipRecordMetafile_delegate(HandleRef referenceHdc, int emfType, ref GPRECTF frameRect, int frameUnit, [MarshalAs(UnmanagedType.LPWStr)]string description, out IntPtr metafile);
|
||||
private delegate int GdipRecordMetafile_delegate(HandleRef referenceHdc, EmfType emfType, ref RectangleF frameRect, MetafileFrameUnit frameUnit, [MarshalAs(UnmanagedType.LPWStr)]string description, out IntPtr metafile);
|
||||
private static FunctionWrapper<GdipRecordMetafile_delegate> GdipRecordMetafile_ptr;
|
||||
internal static int GdipRecordMetafile(HandleRef referenceHdc, int emfType, ref GPRECTF frameRect, int frameUnit, string description, out IntPtr metafile) => GdipRecordMetafile_ptr.Delegate(referenceHdc, emfType, ref frameRect, frameUnit, description, out metafile);
|
||||
internal static int GdipRecordMetafile(HandleRef referenceHdc, EmfType emfType, ref RectangleF frameRect, MetafileFrameUnit frameUnit, string description, out IntPtr metafile) => GdipRecordMetafile_ptr.Delegate(referenceHdc, emfType, ref frameRect, frameUnit, description, out metafile);
|
||||
|
||||
private delegate int GdipRecordMetafile2_delegate(HandleRef referenceHdc, int emfType, HandleRef pframeRect, int frameUnit, [MarshalAs(UnmanagedType.LPWStr)]string description, out IntPtr metafile);
|
||||
private delegate int GdipRecordMetafile2_delegate(HandleRef referenceHdc, EmfType emfType, HandleRef pframeRect, MetafileFrameUnit frameUnit, [MarshalAs(UnmanagedType.LPWStr)]string description, out IntPtr metafile);
|
||||
private static FunctionWrapper<GdipRecordMetafile2_delegate> GdipRecordMetafile2_ptr;
|
||||
internal static int GdipRecordMetafile(HandleRef referenceHdc, int emfType, HandleRef pframeRect, int frameUnit, string description, out IntPtr metafile) => GdipRecordMetafile2_ptr.Delegate(referenceHdc, emfType, pframeRect, frameUnit, description, out metafile);
|
||||
internal static int GdipRecordMetafile(HandleRef referenceHdc, EmfType emfType, HandleRef pframeRect, MetafileFrameUnit frameUnit, string description, out IntPtr metafile) => GdipRecordMetafile2_ptr.Delegate(referenceHdc, emfType, pframeRect, frameUnit, description, out metafile);
|
||||
|
||||
private delegate int GdipRecordMetafileI_delegate(HandleRef referenceHdc, int emfType, ref GPRECT frameRect, int frameUnit, [MarshalAs(UnmanagedType.LPWStr)]string description, out IntPtr metafile);
|
||||
private delegate int GdipRecordMetafileI_delegate(HandleRef referenceHdc, EmfType emfType, ref Rectangle frameRect, MetafileFrameUnit frameUnit, [MarshalAs(UnmanagedType.LPWStr)]string description, out IntPtr metafile);
|
||||
private static FunctionWrapper<GdipRecordMetafileI_delegate> GdipRecordMetafileI_ptr;
|
||||
internal static int GdipRecordMetafileI(HandleRef referenceHdc, int emfType, ref GPRECT frameRect, int frameUnit, string description, out IntPtr metafile) => GdipRecordMetafileI_ptr.Delegate(referenceHdc, emfType, ref frameRect, frameUnit, description, out metafile);
|
||||
internal static int GdipRecordMetafileI(HandleRef referenceHdc, EmfType emfType, ref Rectangle frameRect, MetafileFrameUnit frameUnit, string description, out IntPtr metafile) => GdipRecordMetafileI_ptr.Delegate(referenceHdc, emfType, ref frameRect, frameUnit, description, out metafile);
|
||||
|
||||
private delegate int GdipRecordMetafileFileName_delegate([MarshalAs(UnmanagedType.LPWStr)]string fileName, HandleRef referenceHdc, int emfType, ref GPRECTF frameRect, int frameUnit, [MarshalAs(UnmanagedType.LPWStr)]string description, out IntPtr metafile);
|
||||
private delegate int GdipRecordMetafileFileName_delegate([MarshalAs(UnmanagedType.LPWStr)]string fileName, HandleRef referenceHdc, EmfType emfType, ref RectangleF frameRect, MetafileFrameUnit frameUnit, [MarshalAs(UnmanagedType.LPWStr)]string description, out IntPtr metafile);
|
||||
private static FunctionWrapper<GdipRecordMetafileFileName_delegate> GdipRecordMetafileFileName_ptr;
|
||||
internal static int GdipRecordMetafileFileName(string fileName, HandleRef referenceHdc, int emfType, ref GPRECTF frameRect, int frameUnit, string description, out IntPtr metafile) => GdipRecordMetafileFileName_ptr.Delegate(fileName, referenceHdc, emfType, ref frameRect, frameUnit, description, out metafile);
|
||||
internal static int GdipRecordMetafileFileName(string fileName, HandleRef referenceHdc, EmfType emfType, ref RectangleF frameRect, MetafileFrameUnit frameUnit, string description, out IntPtr metafile) => GdipRecordMetafileFileName_ptr.Delegate(fileName, referenceHdc, emfType, ref frameRect, frameUnit, description, out metafile);
|
||||
|
||||
private delegate int GdipRecordMetafileFileName2_delegate([MarshalAs(UnmanagedType.LPWStr)]string fileName, HandleRef referenceHdc, int emfType, HandleRef pframeRect, int frameUnit, [MarshalAs(UnmanagedType.LPWStr)]string description, out IntPtr metafile);
|
||||
private delegate int GdipRecordMetafileFileName2_delegate([MarshalAs(UnmanagedType.LPWStr)]string fileName, HandleRef referenceHdc, EmfType emfType, HandleRef pframeRect, MetafileFrameUnit frameUnit, [MarshalAs(UnmanagedType.LPWStr)]string description, out IntPtr metafile);
|
||||
private static FunctionWrapper<GdipRecordMetafileFileName2_delegate> GdipRecordMetafileFileName2_ptr;
|
||||
internal static int GdipRecordMetafileFileName(string fileName, HandleRef referenceHdc, int emfType, HandleRef pframeRect, int frameUnit, string description, out IntPtr metafile) => GdipRecordMetafileFileName2_ptr.Delegate(fileName, referenceHdc, emfType, pframeRect, frameUnit, description, out metafile);
|
||||
internal static int GdipRecordMetafileFileName(string fileName, HandleRef referenceHdc, EmfType emfType, HandleRef pframeRect, MetafileFrameUnit frameUnit, string description, out IntPtr metafile) => GdipRecordMetafileFileName2_ptr.Delegate(fileName, referenceHdc, emfType, pframeRect, frameUnit, description, out metafile);
|
||||
|
||||
private delegate int GdipRecordMetafileFileNameI_delegate([MarshalAs(UnmanagedType.LPWStr)]string fileName, HandleRef referenceHdc, int emfType, ref GPRECT frameRect, int frameUnit, [MarshalAs(UnmanagedType.LPWStr)]string description, out IntPtr metafile);
|
||||
private delegate int GdipRecordMetafileFileNameI_delegate([MarshalAs(UnmanagedType.LPWStr)]string fileName, HandleRef referenceHdc, EmfType emfType, ref Rectangle frameRect, MetafileFrameUnit frameUnit, [MarshalAs(UnmanagedType.LPWStr)]string description, out IntPtr metafile);
|
||||
private static FunctionWrapper<GdipRecordMetafileFileNameI_delegate> GdipRecordMetafileFileNameI_ptr;
|
||||
internal static int GdipRecordMetafileFileNameI(string fileName, HandleRef referenceHdc, int emfType, ref GPRECT frameRect, int frameUnit, string description, out IntPtr metafile) => GdipRecordMetafileFileNameI_ptr.Delegate(fileName, referenceHdc, emfType, ref frameRect, frameUnit, description, out metafile);
|
||||
internal static int GdipRecordMetafileFileNameI(string fileName, HandleRef referenceHdc, EmfType emfType, ref Rectangle frameRect, MetafileFrameUnit frameUnit, string description, out IntPtr metafile) => GdipRecordMetafileFileNameI_ptr.Delegate(fileName, referenceHdc, emfType, ref frameRect, frameUnit, description, out metafile);
|
||||
|
||||
private delegate int GdipRecordMetafileStream_delegate(UnsafeNativeMethods.IStream stream, HandleRef referenceHdc, int emfType, ref GPRECTF frameRect, int frameUnit, [MarshalAs(UnmanagedType.LPWStr)]string description, out IntPtr metafile);
|
||||
private delegate int GdipRecordMetafileStream_delegate(UnsafeNativeMethods.IStream stream, HandleRef referenceHdc, EmfType emfType, ref RectangleF frameRect, MetafileFrameUnit frameUnit, [MarshalAs(UnmanagedType.LPWStr)]string description, out IntPtr metafile);
|
||||
private static FunctionWrapper<GdipRecordMetafileStream_delegate> GdipRecordMetafileStream_ptr;
|
||||
internal static int GdipRecordMetafileStream(UnsafeNativeMethods.IStream stream, HandleRef referenceHdc, int emfType, ref GPRECTF frameRect, int frameUnit, [MarshalAs(UnmanagedType.LPWStr)]string description, out IntPtr metafile) => GdipRecordMetafileStream_ptr.Delegate(stream, referenceHdc, emfType, ref frameRect, frameUnit, description, out metafile);
|
||||
internal static int GdipRecordMetafileStream(UnsafeNativeMethods.IStream stream, HandleRef referenceHdc, EmfType emfType, ref RectangleF frameRect, MetafileFrameUnit frameUnit, [MarshalAs(UnmanagedType.LPWStr)]string description, out IntPtr metafile) => GdipRecordMetafileStream_ptr.Delegate(stream, referenceHdc, emfType, ref frameRect, frameUnit, description, out metafile);
|
||||
|
||||
private delegate int GdipRecordMetafileStream2_delegate(UnsafeNativeMethods.IStream stream, HandleRef referenceHdc, int emfType, HandleRef pframeRect, int frameUnit, [MarshalAs(UnmanagedType.LPWStr)]string description, out IntPtr metafile);
|
||||
private delegate int GdipRecordMetafileStream2_delegate(UnsafeNativeMethods.IStream stream, HandleRef referenceHdc, EmfType emfType, HandleRef pframeRect, MetafileFrameUnit frameUnit, [MarshalAs(UnmanagedType.LPWStr)]string description, out IntPtr metafile);
|
||||
private static FunctionWrapper<GdipRecordMetafileStream2_delegate> GdipRecordMetafileStream2_ptr;
|
||||
internal static int GdipRecordMetafileStream(UnsafeNativeMethods.IStream stream, HandleRef referenceHdc, int emfType, HandleRef pframeRect, int frameUnit, string description, out IntPtr metafile) => GdipRecordMetafileStream2_ptr.Delegate(stream, referenceHdc, emfType, pframeRect, frameUnit, description, out metafile);
|
||||
internal static int GdipRecordMetafileStream(UnsafeNativeMethods.IStream stream, HandleRef referenceHdc, EmfType emfType, HandleRef pframeRect, MetafileFrameUnit frameUnit, string description, out IntPtr metafile) => GdipRecordMetafileStream2_ptr.Delegate(stream, referenceHdc, emfType, pframeRect, frameUnit, description, out metafile);
|
||||
|
||||
private delegate int GdipRecordMetafileStreamI_delegate(UnsafeNativeMethods.IStream stream, HandleRef referenceHdc, int emfType, ref GPRECT frameRect, int frameUnit, [MarshalAs(UnmanagedType.LPWStr)]string description, out IntPtr metafile);
|
||||
private delegate int GdipRecordMetafileStreamI_delegate(UnsafeNativeMethods.IStream stream, HandleRef referenceHdc, EmfType emfType, ref Rectangle frameRect, MetafileFrameUnit frameUnit, [MarshalAs(UnmanagedType.LPWStr)]string description, out IntPtr metafile);
|
||||
private static FunctionWrapper<GdipRecordMetafileStreamI_delegate> GdipRecordMetafileStreamI_ptr;
|
||||
internal static int GdipRecordMetafileStreamI(UnsafeNativeMethods.IStream stream, HandleRef referenceHdc, int emfType, ref GPRECT frameRect, int frameUnit, string description, out IntPtr metafile) => GdipRecordMetafileStreamI_ptr.Delegate(stream, referenceHdc, emfType, ref frameRect, frameUnit, description, out metafile);
|
||||
internal static int GdipRecordMetafileStreamI(UnsafeNativeMethods.IStream stream, HandleRef referenceHdc, EmfType emfType, ref Rectangle frameRect, MetafileFrameUnit frameUnit, string description, out IntPtr metafile) => GdipRecordMetafileStreamI_ptr.Delegate(stream, referenceHdc, emfType, ref frameRect, frameUnit, description, out metafile);
|
||||
|
||||
private delegate int GdipComment_delegate(HandleRef graphics, int sizeData, byte[] data);
|
||||
private static FunctionWrapper<GdipComment_delegate> GdipComment_ptr;
|
||||
|
|
|
@ -717,9 +717,9 @@ namespace System.Drawing
|
|||
private static FunctionWrapper<GdipSetPathGradientCenterPoint_delegate> GdipSetPathGradientCenterPoint_ptr;
|
||||
internal static int GdipSetPathGradientCenterPoint(HandleRef brush, ref PointF point) => GdipSetPathGradientCenterPoint_ptr.Delegate(brush, ref point);
|
||||
|
||||
private delegate int GdipGetPathGradientRect_delegate(HandleRef brush, ref GPRECTF gprectf);
|
||||
private delegate int GdipGetPathGradientRect_delegate(HandleRef brush, out RectangleF gprectf);
|
||||
private static FunctionWrapper<GdipGetPathGradientRect_delegate> GdipGetPathGradientRect_ptr;
|
||||
internal static int GdipGetPathGradientRect(HandleRef brush, ref GPRECTF gprectf) => GdipGetPathGradientRect_ptr.Delegate(brush, ref gprectf);
|
||||
internal static int GdipGetPathGradientRect(HandleRef brush, out RectangleF gprectf) => GdipGetPathGradientRect_ptr.Delegate(brush, out gprectf);
|
||||
|
||||
private delegate int GdipGetPathGradientPointCount_delegate(HandleRef brush, out int count);
|
||||
private static FunctionWrapper<GdipGetPathGradientPointCount_delegate> GdipGetPathGradientPointCount_ptr;
|
||||
|
@ -1457,13 +1457,13 @@ namespace System.Drawing
|
|||
private static FunctionWrapper<GdipCreateRegion_delegate> GdipCreateRegion_ptr;
|
||||
internal static int GdipCreateRegion(out IntPtr region) => GdipCreateRegion_ptr.Delegate(out region);
|
||||
|
||||
private delegate int GdipCreateRegionRect_delegate(ref GPRECTF gprectf, out IntPtr region);
|
||||
private delegate int GdipCreateRegionRect_delegate(ref RectangleF gprectf, out IntPtr region);
|
||||
private static FunctionWrapper<GdipCreateRegionRect_delegate> GdipCreateRegionRect_ptr;
|
||||
internal static int GdipCreateRegionRect(ref GPRECTF gprectf, out IntPtr region) => GdipCreateRegionRect_ptr.Delegate(ref gprectf, out region);
|
||||
internal static int GdipCreateRegionRect(ref RectangleF gprectf, out IntPtr region) => GdipCreateRegionRect_ptr.Delegate(ref gprectf, out region);
|
||||
|
||||
private delegate int GdipCreateRegionRectI_delegate(ref GPRECT gprect, out IntPtr region);
|
||||
private delegate int GdipCreateRegionRectI_delegate(ref Rectangle gprect, out IntPtr region);
|
||||
private static FunctionWrapper<GdipCreateRegionRectI_delegate> GdipCreateRegionRectI_ptr;
|
||||
internal static int GdipCreateRegionRectI(ref GPRECT gprect, out IntPtr region) => GdipCreateRegionRectI_ptr.Delegate(ref gprect, out region);
|
||||
internal static int GdipCreateRegionRectI(ref Rectangle gprect, out IntPtr region) => GdipCreateRegionRectI_ptr.Delegate(ref gprect, out region);
|
||||
|
||||
private delegate int GdipCreateRegionPath_delegate(HandleRef path, out IntPtr region);
|
||||
private static FunctionWrapper<GdipCreateRegionPath_delegate> GdipCreateRegionPath_ptr;
|
||||
|
@ -1497,13 +1497,13 @@ namespace System.Drawing
|
|||
private static FunctionWrapper<GdipSetEmpty_delegate> GdipSetEmpty_ptr;
|
||||
internal static int GdipSetEmpty(HandleRef region) => GdipSetEmpty_ptr.Delegate(region);
|
||||
|
||||
private delegate int GdipCombineRegionRect_delegate(HandleRef region, ref GPRECTF gprectf, CombineMode mode);
|
||||
private delegate int GdipCombineRegionRect_delegate(HandleRef region, ref RectangleF gprectf, CombineMode mode);
|
||||
private static FunctionWrapper<GdipCombineRegionRect_delegate> GdipCombineRegionRect_ptr;
|
||||
internal static int GdipCombineRegionRect(HandleRef region, ref GPRECTF gprectf, CombineMode mode) => GdipCombineRegionRect_ptr.Delegate(region, ref gprectf, mode);
|
||||
internal static int GdipCombineRegionRect(HandleRef region, ref RectangleF gprectf, CombineMode mode) => GdipCombineRegionRect_ptr.Delegate(region, ref gprectf, mode);
|
||||
|
||||
private delegate int GdipCombineRegionRectI_delegate(HandleRef region, ref GPRECT gprect, CombineMode mode);
|
||||
private delegate int GdipCombineRegionRectI_delegate(HandleRef region, ref Rectangle gprect, CombineMode mode);
|
||||
private static FunctionWrapper<GdipCombineRegionRectI_delegate> GdipCombineRegionRectI_ptr;
|
||||
internal static int GdipCombineRegionRectI(HandleRef region, ref GPRECT gprect, CombineMode mode) => GdipCombineRegionRectI_ptr.Delegate(region, ref gprect, mode);
|
||||
internal static int GdipCombineRegionRectI(HandleRef region, ref Rectangle gprect, CombineMode mode) => GdipCombineRegionRectI_ptr.Delegate(region, ref gprect, mode);
|
||||
|
||||
private delegate int GdipCombineRegionPath_delegate(HandleRef region, HandleRef path, CombineMode mode);
|
||||
private static FunctionWrapper<GdipCombineRegionPath_delegate> GdipCombineRegionPath_ptr;
|
||||
|
@ -1525,9 +1525,9 @@ namespace System.Drawing
|
|||
private static FunctionWrapper<GdipTransformRegion_delegate> GdipTransformRegion_ptr;
|
||||
internal static int GdipTransformRegion(HandleRef region, HandleRef matrix) => GdipTransformRegion_ptr.Delegate(region, matrix);
|
||||
|
||||
private delegate int GdipGetRegionBounds_delegate(HandleRef region, HandleRef graphics, ref GPRECTF gprectf);
|
||||
private delegate int GdipGetRegionBounds_delegate(HandleRef region, HandleRef graphics, out RectangleF gprectf);
|
||||
private static FunctionWrapper<GdipGetRegionBounds_delegate> GdipGetRegionBounds_ptr;
|
||||
internal static int GdipGetRegionBounds(HandleRef region, HandleRef graphics, ref GPRECTF gprectf) => GdipGetRegionBounds_ptr.Delegate(region, graphics, ref gprectf);
|
||||
internal static int GdipGetRegionBounds(HandleRef region, HandleRef graphics, out RectangleF gprectf) => GdipGetRegionBounds_ptr.Delegate(region, graphics, out gprectf);
|
||||
|
||||
private delegate int GdipGetRegionHRgn_delegate(HandleRef region, HandleRef graphics, out IntPtr hrgn);
|
||||
private static FunctionWrapper<GdipGetRegionHRgn_delegate> GdipGetRegionHRgn_ptr;
|
||||
|
@ -1573,9 +1573,9 @@ namespace System.Drawing
|
|||
private static FunctionWrapper<GdipGetRegionScansCount_delegate> GdipGetRegionScansCount_ptr;
|
||||
internal static int GdipGetRegionScansCount(HandleRef region, out int count, HandleRef matrix) => GdipGetRegionScansCount_ptr.Delegate(region, out count, matrix);
|
||||
|
||||
private delegate int GdipGetRegionScans_delegate(HandleRef region, IntPtr rects, out int count, HandleRef matrix);
|
||||
private delegate int GdipGetRegionScans_delegate(HandleRef region, RectangleF* rects, out int count, HandleRef matrix);
|
||||
private static FunctionWrapper<GdipGetRegionScans_delegate> GdipGetRegionScans_ptr;
|
||||
internal static int GdipGetRegionScans(HandleRef region, IntPtr rects, out int count, HandleRef matrix) => GdipGetRegionScans_ptr.Delegate(region, rects, out count, matrix);
|
||||
internal static int GdipGetRegionScans(HandleRef region, RectangleF* rects, out int count, HandleRef matrix) => GdipGetRegionScans_ptr.Delegate(region, rects, out count, matrix);
|
||||
|
||||
private delegate int GdipSetClipGraphics_delegate(HandleRef graphics, HandleRef srcgraphics, CombineMode mode);
|
||||
private static FunctionWrapper<GdipSetClipGraphics_delegate> GdipSetClipGraphics_ptr;
|
||||
|
@ -1837,9 +1837,9 @@ namespace System.Drawing
|
|||
private static FunctionWrapper<GdipCloneBitmapAreaI_delegate> GdipCloneBitmapAreaI_ptr;
|
||||
internal static int GdipCloneBitmapAreaI(int x, int y, int width, int height, int format, HandleRef srcbitmap, out IntPtr dstbitmap) => GdipCloneBitmapAreaI_ptr.Delegate(x, y, width, height, format, srcbitmap, out dstbitmap);
|
||||
|
||||
private delegate int GdipBitmapLockBits_delegate(HandleRef bitmap, ref GPRECT rect, ImageLockMode flags, PixelFormat format, [In] [Out] BitmapData lockedBitmapData);
|
||||
private delegate int GdipBitmapLockBits_delegate(HandleRef bitmap, ref Rectangle rect, ImageLockMode flags, PixelFormat format, [In] [Out] BitmapData lockedBitmapData);
|
||||
private static FunctionWrapper<GdipBitmapLockBits_delegate> GdipBitmapLockBits_ptr;
|
||||
internal static int GdipBitmapLockBits(HandleRef bitmap, ref GPRECT rect, ImageLockMode flags, PixelFormat format, [In] [Out] BitmapData lockedBitmapData) => GdipBitmapLockBits_ptr.Delegate(bitmap, ref rect, flags, format, lockedBitmapData);
|
||||
internal static int GdipBitmapLockBits(HandleRef bitmap, ref Rectangle rect, ImageLockMode flags, PixelFormat format, [In] [Out] BitmapData lockedBitmapData) => GdipBitmapLockBits_ptr.Delegate(bitmap, ref rect, flags, format, lockedBitmapData);
|
||||
|
||||
private delegate int GdipBitmapUnlockBits_delegate(HandleRef bitmap, BitmapData lockedBitmapData);
|
||||
private static FunctionWrapper<GdipBitmapUnlockBits_delegate> GdipBitmapUnlockBits_ptr;
|
||||
|
|
|
@ -2530,8 +2530,6 @@ namespace System.Drawing
|
|||
|
||||
fixed (PointF* p = destPoints)
|
||||
{
|
||||
GPRECTF grf = new GPRECTF(srcRect);
|
||||
|
||||
Gdip.CheckStatus(Gdip.GdipEnumerateMetafileSrcRectDestPoints(
|
||||
new HandleRef(this, NativeGraphics),
|
||||
new HandleRef(metafile, metafile?.nativeImage ?? IntPtr.Zero),
|
||||
|
|
|
@ -403,11 +403,8 @@ namespace System.Drawing
|
|||
/// </summary>
|
||||
public RectangleF GetBounds(ref GraphicsUnit pageUnit)
|
||||
{
|
||||
GPRECTF gprectf = new GPRECTF();
|
||||
|
||||
Gdip.CheckStatus(Gdip.GdipGetImageBounds(new HandleRef(this, nativeImage), ref gprectf, out pageUnit));
|
||||
|
||||
return gprectf.ToRectangleF();
|
||||
Gdip.CheckStatus(Gdip.GdipGetImageBounds(new HandleRef(this, nativeImage), out RectangleF bounds, out pageUnit));
|
||||
return bounds;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -418,9 +415,7 @@ namespace System.Drawing
|
|||
{
|
||||
get
|
||||
{
|
||||
int size = -1;
|
||||
|
||||
Gdip.CheckStatus(Gdip.GdipGetImagePaletteSize(new HandleRef(this, nativeImage), out size));
|
||||
Gdip.CheckStatus(Gdip.GdipGetImagePaletteSize(new HandleRef(this, nativeImage), out int size));
|
||||
|
||||
// "size" is total byte size:
|
||||
// sizeof(ColorPalette) + (pal->Count-1)*sizeof(ARGB)
|
||||
|
|
|
@ -83,9 +83,9 @@ namespace System.Drawing.Imaging
|
|||
{
|
||||
Gdip.CheckStatus(Gdip.GdipRecordMetafile(
|
||||
new HandleRef(null, referenceHdc),
|
||||
unchecked((int)emfType),
|
||||
emfType,
|
||||
NativeMethods.NullHandleRef,
|
||||
unchecked((int)MetafileFrameUnit.GdiCompatible),
|
||||
MetafileFrameUnit.GdiCompatible,
|
||||
description,
|
||||
out IntPtr metafile));
|
||||
|
||||
|
@ -122,12 +122,11 @@ namespace System.Drawing.Imaging
|
|||
/// </summary>
|
||||
public Metafile(IntPtr referenceHdc, RectangleF frameRect, MetafileFrameUnit frameUnit, EmfType type, string description)
|
||||
{
|
||||
GPRECTF rectf = new GPRECTF(frameRect);
|
||||
Gdip.CheckStatus(Gdip.GdipRecordMetafile(
|
||||
new HandleRef(null, referenceHdc),
|
||||
unchecked((int)type),
|
||||
ref rectf,
|
||||
unchecked((int)frameUnit),
|
||||
type,
|
||||
ref frameRect,
|
||||
frameUnit,
|
||||
description,
|
||||
out IntPtr metafile));
|
||||
|
||||
|
@ -170,20 +169,19 @@ namespace System.Drawing.Imaging
|
|||
{
|
||||
Gdip.CheckStatus(Gdip.GdipRecordMetafile(
|
||||
new HandleRef(null, referenceHdc),
|
||||
unchecked((int)type),
|
||||
type,
|
||||
NativeMethods.NullHandleRef,
|
||||
unchecked((int)MetafileFrameUnit.GdiCompatible),
|
||||
MetafileFrameUnit.GdiCompatible,
|
||||
desc,
|
||||
out metafile));
|
||||
}
|
||||
else
|
||||
{
|
||||
GPRECT gprect = new GPRECT(frameRect);
|
||||
Gdip.CheckStatus(Gdip.GdipRecordMetafileI(
|
||||
new HandleRef(null, referenceHdc),
|
||||
unchecked((int)type),
|
||||
ref gprect,
|
||||
unchecked((int)frameUnit),
|
||||
type,
|
||||
ref frameRect,
|
||||
frameUnit,
|
||||
desc,
|
||||
out metafile));
|
||||
}
|
||||
|
@ -216,9 +214,9 @@ namespace System.Drawing.Imaging
|
|||
Gdip.CheckStatus(Gdip.GdipRecordMetafileFileName(
|
||||
fileName,
|
||||
new HandleRef(null, referenceHdc),
|
||||
unchecked((int)type),
|
||||
type,
|
||||
NativeMethods.NullHandleRef,
|
||||
unchecked((int)MetafileFrameUnit.GdiCompatible),
|
||||
MetafileFrameUnit.GdiCompatible,
|
||||
description,
|
||||
out IntPtr metafile));
|
||||
|
||||
|
@ -264,13 +262,12 @@ namespace System.Drawing.Imaging
|
|||
if (fileName.Length > MaxPath)
|
||||
throw new PathTooLongException();
|
||||
|
||||
GPRECTF rectf = new GPRECTF(frameRect);
|
||||
Gdip.CheckStatus(Gdip.GdipRecordMetafileFileName(
|
||||
fileName,
|
||||
new HandleRef(null, referenceHdc),
|
||||
unchecked((int)type),
|
||||
ref rectf,
|
||||
unchecked((int)frameUnit),
|
||||
type,
|
||||
ref frameRect,
|
||||
frameUnit,
|
||||
description,
|
||||
out IntPtr metafile));
|
||||
|
||||
|
@ -320,21 +317,20 @@ namespace System.Drawing.Imaging
|
|||
Gdip.CheckStatus(Gdip.GdipRecordMetafileFileName(
|
||||
fileName,
|
||||
new HandleRef(null, referenceHdc),
|
||||
unchecked((int)type),
|
||||
type,
|
||||
NativeMethods.NullHandleRef,
|
||||
unchecked((int)frameUnit),
|
||||
frameUnit,
|
||||
description,
|
||||
out metafile));
|
||||
}
|
||||
else
|
||||
{
|
||||
GPRECT gprect = new GPRECT(frameRect);
|
||||
Gdip.CheckStatus(Gdip.GdipRecordMetafileFileNameI(
|
||||
fileName,
|
||||
new HandleRef(null, referenceHdc),
|
||||
unchecked((int)type),
|
||||
ref gprect,
|
||||
unchecked((int)frameUnit),
|
||||
type,
|
||||
ref frameRect,
|
||||
frameUnit,
|
||||
description,
|
||||
out metafile));
|
||||
}
|
||||
|
@ -364,9 +360,9 @@ namespace System.Drawing.Imaging
|
|||
Gdip.CheckStatus(Gdip.GdipRecordMetafileStream(
|
||||
new GPStream(stream),
|
||||
new HandleRef(null, referenceHdc),
|
||||
unchecked((int)type),
|
||||
type,
|
||||
NativeMethods.NullHandleRef,
|
||||
unchecked((int)MetafileFrameUnit.GdiCompatible),
|
||||
MetafileFrameUnit.GdiCompatible,
|
||||
description,
|
||||
out IntPtr metafile));
|
||||
|
||||
|
@ -399,13 +395,12 @@ namespace System.Drawing.Imaging
|
|||
/// </summary>
|
||||
public Metafile(Stream stream, IntPtr referenceHdc, RectangleF frameRect, MetafileFrameUnit frameUnit, EmfType type, string description)
|
||||
{
|
||||
GPRECTF rectf = new GPRECTF(frameRect);
|
||||
Gdip.CheckStatus(Gdip.GdipRecordMetafileStream(
|
||||
new GPStream(stream),
|
||||
new HandleRef(null, referenceHdc),
|
||||
unchecked((int)type),
|
||||
ref rectf,
|
||||
unchecked((int)frameUnit),
|
||||
type,
|
||||
ref frameRect,
|
||||
frameUnit,
|
||||
description,
|
||||
out IntPtr metafile));
|
||||
|
||||
|
@ -445,21 +440,20 @@ namespace System.Drawing.Imaging
|
|||
Gdip.CheckStatus(Gdip.GdipRecordMetafileStream(
|
||||
new GPStream(stream),
|
||||
new HandleRef(null, referenceHdc),
|
||||
unchecked((int)type),
|
||||
type,
|
||||
NativeMethods.NullHandleRef,
|
||||
unchecked((int)frameUnit),
|
||||
frameUnit,
|
||||
description,
|
||||
out metafile));
|
||||
}
|
||||
else
|
||||
{
|
||||
GPRECT gprect = new GPRECT(frameRect);
|
||||
Gdip.CheckStatus(Gdip.GdipRecordMetafileStreamI(
|
||||
new GPStream(stream),
|
||||
new HandleRef(null, referenceHdc),
|
||||
unchecked((int)type),
|
||||
ref gprect,
|
||||
unchecked((int)frameUnit),
|
||||
type,
|
||||
ref frameRect,
|
||||
frameUnit,
|
||||
description,
|
||||
out metafile));
|
||||
}
|
||||
|
|
|
@ -1,33 +0,0 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace System.Drawing.Internal
|
||||
{
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct GPRECT
|
||||
{
|
||||
internal int X;
|
||||
internal int Y;
|
||||
internal int Width;
|
||||
internal int Height;
|
||||
|
||||
internal GPRECT(int x, int y, int width, int height)
|
||||
{
|
||||
X = x;
|
||||
Y = y;
|
||||
Width = width;
|
||||
Height = height;
|
||||
}
|
||||
|
||||
internal GPRECT(Rectangle rect)
|
||||
{
|
||||
X = rect.X;
|
||||
Y = rect.Y;
|
||||
Width = rect.Width;
|
||||
Height = rect.Height;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace System.Drawing.Internal
|
||||
{
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct GPRECTF
|
||||
{
|
||||
internal float X;
|
||||
internal float Y;
|
||||
internal float Width;
|
||||
internal float Height;
|
||||
|
||||
internal GPRECTF(float x, float y, float width, float height)
|
||||
{
|
||||
X = x;
|
||||
Y = y;
|
||||
Width = width;
|
||||
Height = height;
|
||||
}
|
||||
|
||||
internal GPRECTF(RectangleF rect)
|
||||
{
|
||||
X = rect.X;
|
||||
Y = rect.Y;
|
||||
Width = rect.Width;
|
||||
Height = rect.Height;
|
||||
}
|
||||
|
||||
internal SizeF SizeF => new SizeF(Width, Height);
|
||||
|
||||
internal RectangleF ToRectangleF() => new RectangleF(X, Y, Width, Height);
|
||||
}
|
||||
}
|
|
@ -27,15 +27,13 @@ namespace System.Drawing
|
|||
|
||||
public Region(RectangleF rect)
|
||||
{
|
||||
var gprectf = new GPRECTF(rect);
|
||||
Gdip.CheckStatus(Gdip.GdipCreateRegionRect(ref gprectf, out IntPtr region));
|
||||
Gdip.CheckStatus(Gdip.GdipCreateRegionRect(ref rect, out IntPtr region));
|
||||
SetNativeRegion(region);
|
||||
}
|
||||
|
||||
public Region(Rectangle rect)
|
||||
{
|
||||
var gprect = new GPRECT(rect);
|
||||
Gdip.CheckStatus(Gdip.GdipCreateRegionRectI(ref gprect, out IntPtr region));
|
||||
Gdip.CheckStatus(Gdip.GdipCreateRegionRectI(ref rect, out IntPtr region));
|
||||
SetNativeRegion(region);
|
||||
}
|
||||
|
||||
|
@ -131,14 +129,12 @@ namespace System.Drawing
|
|||
|
||||
public void Intersect(RectangleF rect)
|
||||
{
|
||||
var gprectf = new GPRECTF(rect);
|
||||
Gdip.CheckStatus(Gdip.GdipCombineRegionRect(new HandleRef(this, NativeRegion), ref gprectf, CombineMode.Intersect));
|
||||
Gdip.CheckStatus(Gdip.GdipCombineRegionRect(new HandleRef(this, NativeRegion), ref rect, CombineMode.Intersect));
|
||||
}
|
||||
|
||||
public void Intersect(Rectangle rect)
|
||||
{
|
||||
var gprect = new GPRECT(rect);
|
||||
Gdip.CheckStatus(Gdip.GdipCombineRegionRectI(new HandleRef(this, NativeRegion), ref gprect, CombineMode.Intersect));
|
||||
Gdip.CheckStatus(Gdip.GdipCombineRegionRectI(new HandleRef(this, NativeRegion), ref rect, CombineMode.Intersect));
|
||||
}
|
||||
|
||||
public void Intersect(GraphicsPath path)
|
||||
|
@ -159,14 +155,12 @@ namespace System.Drawing
|
|||
|
||||
public void Union(RectangleF rect)
|
||||
{
|
||||
var gprectf = new GPRECTF(rect);
|
||||
Gdip.CheckStatus(Gdip.GdipCombineRegionRect(new HandleRef(this, NativeRegion), ref gprectf, CombineMode.Union));
|
||||
Gdip.CheckStatus(Gdip.GdipCombineRegionRect(new HandleRef(this, NativeRegion), ref rect, CombineMode.Union));
|
||||
}
|
||||
|
||||
public void Union(Rectangle rect)
|
||||
{
|
||||
var gprect = new GPRECT(rect);
|
||||
Gdip.CheckStatus(Gdip.GdipCombineRegionRectI(new HandleRef(this, NativeRegion), ref gprect, CombineMode.Union));
|
||||
Gdip.CheckStatus(Gdip.GdipCombineRegionRectI(new HandleRef(this, NativeRegion), ref rect, CombineMode.Union));
|
||||
}
|
||||
|
||||
public void Union(GraphicsPath path)
|
||||
|
@ -187,14 +181,12 @@ namespace System.Drawing
|
|||
|
||||
public void Xor(RectangleF rect)
|
||||
{
|
||||
var gprectf = new GPRECTF(rect);
|
||||
Gdip.CheckStatus(Gdip.GdipCombineRegionRect(new HandleRef(this, NativeRegion), ref gprectf, CombineMode.Xor));
|
||||
Gdip.CheckStatus(Gdip.GdipCombineRegionRect(new HandleRef(this, NativeRegion), ref rect, CombineMode.Xor));
|
||||
}
|
||||
|
||||
public void Xor(Rectangle rect)
|
||||
{
|
||||
var gprect = new GPRECT(rect);
|
||||
Gdip.CheckStatus(Gdip.GdipCombineRegionRectI(new HandleRef(this, NativeRegion), ref gprect, CombineMode.Xor));
|
||||
Gdip.CheckStatus(Gdip.GdipCombineRegionRectI(new HandleRef(this, NativeRegion), ref rect, CombineMode.Xor));
|
||||
}
|
||||
|
||||
public void Xor(GraphicsPath path)
|
||||
|
@ -215,14 +207,12 @@ namespace System.Drawing
|
|||
|
||||
public void Exclude(RectangleF rect)
|
||||
{
|
||||
var gprectf = new GPRECTF(rect);
|
||||
Gdip.CheckStatus(Gdip.GdipCombineRegionRect(new HandleRef(this, NativeRegion), ref gprectf, CombineMode.Exclude));
|
||||
Gdip.CheckStatus(Gdip.GdipCombineRegionRect(new HandleRef(this, NativeRegion), ref rect, CombineMode.Exclude));
|
||||
}
|
||||
|
||||
public void Exclude(Rectangle rect)
|
||||
{
|
||||
var gprect = new GPRECT(rect);
|
||||
Gdip.CheckStatus(Gdip.GdipCombineRegionRectI(new HandleRef(this, NativeRegion), ref gprect, CombineMode.Exclude));
|
||||
Gdip.CheckStatus(Gdip.GdipCombineRegionRectI(new HandleRef(this, NativeRegion), ref rect, CombineMode.Exclude));
|
||||
}
|
||||
|
||||
public void Exclude(GraphicsPath path)
|
||||
|
@ -249,14 +239,12 @@ namespace System.Drawing
|
|||
|
||||
public void Complement(RectangleF rect)
|
||||
{
|
||||
var gprectf = new GPRECTF(rect);
|
||||
Gdip.CheckStatus(Gdip.GdipCombineRegionRect(new HandleRef(this, NativeRegion), ref gprectf, CombineMode.Complement));
|
||||
Gdip.CheckStatus(Gdip.GdipCombineRegionRect(new HandleRef(this, NativeRegion), ref rect, CombineMode.Complement));
|
||||
}
|
||||
|
||||
public void Complement(Rectangle rect)
|
||||
{
|
||||
var gprect = new GPRECT(rect);
|
||||
Gdip.CheckStatus(Gdip.GdipCombineRegionRectI(new HandleRef(this, NativeRegion), ref gprect, CombineMode.Complement));
|
||||
Gdip.CheckStatus(Gdip.GdipCombineRegionRectI(new HandleRef(this, NativeRegion), ref rect, CombineMode.Complement));
|
||||
}
|
||||
|
||||
public void Complement(GraphicsPath path)
|
||||
|
@ -300,9 +288,8 @@ namespace System.Drawing
|
|||
if (g == null)
|
||||
throw new ArgumentNullException(nameof(g));
|
||||
|
||||
var gprectf = new GPRECTF();
|
||||
Gdip.CheckStatus(Gdip.GdipGetRegionBounds(new HandleRef(this, NativeRegion), new HandleRef(g, g.NativeGraphics), ref gprectf));
|
||||
return gprectf.ToRectangleF();
|
||||
Gdip.CheckStatus(Gdip.GdipGetRegionBounds(new HandleRef(this, NativeRegion), new HandleRef(g, g.NativeGraphics), out RectangleF bounds));
|
||||
return bounds;
|
||||
}
|
||||
|
||||
public IntPtr GetHrgn(Graphics g)
|
||||
|
@ -421,7 +408,7 @@ namespace System.Drawing
|
|||
return isVisible != 0;
|
||||
}
|
||||
|
||||
public RectangleF[] GetRegionScans(Matrix matrix)
|
||||
public unsafe RectangleF[] GetRegionScans(Matrix matrix)
|
||||
{
|
||||
if (matrix == null)
|
||||
throw new ArgumentNullException(nameof(matrix));
|
||||
|
@ -431,32 +418,18 @@ namespace System.Drawing
|
|||
out int count,
|
||||
new HandleRef(matrix, matrix.NativeMatrix)));
|
||||
|
||||
int rectsize = Marshal.SizeOf(typeof(GPRECTF));
|
||||
IntPtr memoryRects = Marshal.AllocHGlobal(checked(rectsize * count));
|
||||
RectangleF[] rectangles = new RectangleF[count];
|
||||
|
||||
try
|
||||
fixed (RectangleF* r = rectangles)
|
||||
{
|
||||
Gdip.CheckStatus(Gdip.GdipGetRegionScans
|
||||
(new HandleRef(this, NativeRegion),
|
||||
memoryRects,
|
||||
r,
|
||||
out count,
|
||||
new HandleRef(matrix, matrix.NativeMatrix)));
|
||||
|
||||
var gprectf = new GPRECTF();
|
||||
|
||||
var rectangles = new RectangleF[count];
|
||||
for (int index = 0; index < count; index++)
|
||||
{
|
||||
gprectf = (GPRECTF)Marshal.PtrToStructure((IntPtr)(checked((long)memoryRects + rectsize * index)), typeof(GPRECTF));
|
||||
rectangles[index] = gprectf.ToRectangleF();
|
||||
}
|
||||
|
||||
return rectangles;
|
||||
}
|
||||
finally
|
||||
{
|
||||
Marshal.FreeHGlobal(memoryRects);
|
||||
}
|
||||
|
||||
return rectangles;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче