Esempio n. 1
0
        // write a metafile stream to the output stream in PNG format
        internal static void SaveMetafileToImageStream(MemoryStream metafileStream, Stream imageStream)
        {
            SystemDrawingExtensionMethods extensions = AssemblyHelper.ExtensionsForSystemDrawing(force: true);

            if (extensions != null)
            {
                extensions.SaveMetafileToImageStream(metafileStream, imageStream);
            }
        }
Esempio n. 2
0
        // load the extension class for System.Drawing
        internal static SystemDrawingExtensionMethods ExtensionsForSystemDrawing(bool force = false)
        {
            if (_systemDrawingExtensionMethods == null &&
                (force || IsLoaded(UncommonAssembly.System_Drawing)))
            {
                _systemDrawingExtensionMethods = (SystemDrawingExtensionMethods)LoadExtensionFor("SystemDrawing");
            }

            return(_systemDrawingExtensionMethods);
        }
Esempio n. 3
0
        internal static IntPtr GetHBitmap(object data, out int width, out int height)
        {
            SystemDrawingExtensionMethods extensions = AssemblyHelper.ExtensionsForSystemDrawing(force: true);

            if (extensions != null)
            {
                return(extensions.GetHBitmap(data, out width, out height));
            }

            width = height = 0;
            return(IntPtr.Zero);
        }
Esempio n. 4
0
        internal static IntPtr GetHBitmapFromBitmap(object data)
        {
            SystemDrawingExtensionMethods extensions = AssemblyHelper.ExtensionsForSystemDrawing();

            return((extensions != null) ? extensions.GetHBitmapFromBitmap(data) : IntPtr.Zero);
        }
Esempio n. 5
0
        // Get a bitmap from the given data (either BitmapSource or Bitmap)
        internal static object GetBitmap(object data)
        {
            SystemDrawingExtensionMethods extensions = AssemblyHelper.ExtensionsForSystemDrawing(force: true);

            return((extensions != null) ? extensions.GetBitmap(data) : null);
        }
Esempio n. 6
0
        // Get the metafile from the handle of the enhanced metafile.
        internal static Object GetMetafileFromHemf(IntPtr hMetafile)
        {
            SystemDrawingExtensionMethods extensions = AssemblyHelper.ExtensionsForSystemDrawing(force: true);

            return((extensions != null) ? extensions.GetMetafileFromHemf(hMetafile) : null);
        }
Esempio n. 7
0
        internal static IntPtr GetHandleFromMetafile(Object data)
        {
            SystemDrawingExtensionMethods extensions = AssemblyHelper.ExtensionsForSystemDrawing();

            return((extensions != null) ? extensions.GetHandleFromMetafile(data) : IntPtr.Zero);
        }
Esempio n. 8
0
        // return true if the data is a graphics metafile
        internal static bool IsMetafile(object data)
        {
            SystemDrawingExtensionMethods extensions = AssemblyHelper.ExtensionsForSystemDrawing();

            return((extensions != null) ? extensions.IsMetafile(data) : false);
        }
Esempio n. 9
0
        internal static object GetBitmapFromBitmapSource(object source)
        {
            SystemDrawingExtensionMethods extensions = AssemblyHelper.ExtensionsForSystemDrawing(force: true);

            return((extensions != null) ? extensions.GetBitmapFromBitmapSource(source) : null);
        }
Esempio n. 10
0
        // return a new default-printing permission
        internal static CodeAccessPermission NewDefaultPrintingPermission()
        {
            SystemDrawingExtensionMethods extensions = AssemblyHelper.ExtensionsForSystemDrawing(force: true);

            return((extensions != null) ? extensions.NewDefaultPrintingPermission() : null);
        }
Esempio n. 11
0
        // return a stream for the ExifUserComment in the given Gif
        internal static Stream GetCommentFromGifStream(Stream stream)
        {
            SystemDrawingExtensionMethods extensions = AssemblyHelper.ExtensionsForSystemDrawing(force: true);

            return((extensions != null) ? extensions.GetCommentFromGifStream(stream) : null);
        }
Esempio n. 12
0
        internal static IntPtr ConvertMetafileToHBitmap(IntPtr handle)
        {
            SystemDrawingExtensionMethods extensions = AssemblyHelper.ExtensionsForSystemDrawing(force: true);

            return((extensions != null) ? extensions.ConvertMetafileToHBitmap(handle) : IntPtr.Zero);
        }
        // load the extension class for System.Drawing
        internal static SystemDrawingExtensionMethods ExtensionsForSystemDrawing(bool force=false)
        {
            if (_systemDrawingExtensionMethods == null &&
                (force || IsLoaded(UncommonAssembly.System_Drawing)))
            {
                _systemDrawingExtensionMethods = (SystemDrawingExtensionMethods)LoadExtensionFor("SystemDrawing");
            }

            return _systemDrawingExtensionMethods;
        }