PointerExtensions
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.Drawing.Imaging.Effects;
using System.Runtime.CompilerServices;
using Windows.Win32.Foundation;
using Windows.Win32.Graphics.GdiPlus;
namespace System.Drawing
{
internal static class PointerExtensions
{
public unsafe static global::Windows.Win32.Graphics.GdiPlus.Matrix* Pointer([Nullable(2)] this System.Drawing.Drawing2D.Matrix matrix)
{
if (matrix != null)
return matrix.NativeMatrix;
return null;
}
public unsafe static GpPen* Pointer([Nullable(2)] this Pen pen)
{
if (pen != null)
return pen.NativePen;
return null;
}
public unsafe static GpStringFormat* Pointer([Nullable(2)] this StringFormat format)
{
if (format != null)
return format._nativeFormat;
return null;
}
public unsafe static GpFontFamily* Pointer([Nullable(2)] this FontFamily family)
{
if (family != null)
return family.NativeFamily;
return null;
}
public unsafe static GpPath* Pointer([Nullable(2)] this GraphicsPath path)
{
if (path != null)
return path._nativePath;
return null;
}
public unsafe static GpBrush* Pointer([Nullable(2)] this Brush brush)
{
if (brush != null)
return brush.NativeBrush;
return null;
}
public unsafe static GpImageAttributes* Pointer([Nullable(2)] this ImageAttributes imageAttr)
{
if (imageAttr != null)
return imageAttr._nativeImageAttributes;
return null;
}
public unsafe static GpGraphics* Pointer([Nullable(2)] this Graphics graphics)
{
if (graphics != null)
return graphics.NativeGraphics;
return null;
}
public unsafe static GpFont* Pointer([Nullable(2)] this Font font)
{
if (font != null)
return font.NativeFont;
return null;
}
public unsafe static GpBitmap* Pointer([Nullable(2)] this Bitmap bitmap)
{
if (bitmap != null)
return ((IPointer<GpBitmap>)bitmap).Pointer;
return null;
}
public unsafe static GpMetafile* Pointer([Nullable(2)] this Metafile metafile)
{
if (metafile != null)
return (GpMetafile*)((Image)metafile).Pointer();
return null;
}
public unsafe static GpImage* Pointer([Nullable(2)] this Image image)
{
if (image != null)
return ((IPointer<GpImage>)image).Pointer;
return null;
}
public unsafe static CGpEffect* Pointer([Nullable(2)] this Effect effect)
{
if (effect != null)
return effect.NativeEffect;
return null;
}
}
}