Esempio n. 1
0
        protected override void RunOverride(ListView.ListViewItemCollection collection, object tag)
        {
            IWICImagingFactory    factory = (IWICImagingFactory) new WICImagingFactory();
            IWICBitmapDecoderInfo info    = null;

            try
            {
                info = (IWICBitmapDecoderInfo)factory.CreateComponentInfo(Parent.Clsid);
                string[] mimes = Extensions.GetString(info.GetMimeTypes).Split(',');

                foreach (string ext in Extensions.GetString(info.GetFileExtensions).Split(','))
                {
                    using (RegistryKey rk = OpenSubKey(collection, Registry.ClassesRoot, ext, new DataEntry[] { new DataEntry("File Extension", ext) }))
                    {
                        if (rk != null)
                        {
                            Check(collection, ext, rk, info);
                        }
                    }
                }
            }
            finally
            {
                factory.ReleaseComObject();
                info.ReleaseComObject();
            }
        }
Esempio n. 2
0
        void CheckCopyPalette(MainForm form, DataEntry[] de, Action <IWICPalette> method)
        {
            IWICImagingFactory factory = (IWICImagingFactory) new WICImagingFactory();
            IWICPalette        palette = factory.CreatePalette();

            try
            {
                method(palette);
                try
                {
                    if (palette.GetColorCount() == 0)
                    {
                        form.Add(this, method.ToString(Resources._0_ZeroColorPalette), de);
                    }
                }
                catch (Exception e)
                {
                    form.Add(this, method.ToString(Resources._0_IncorrectStatePalette), de, new DataEntry(e));
                }
            }
            catch (Exception e)
            {
                form.CheckHRESULT(this, WinCodecError.WINCODEC_ERR_PALETTEUNAVAILABLE, e, de);
            }
            finally
            {
                palette.ReleaseComObject();
                factory.ReleaseComObject();
            }
        }
Esempio n. 3
0
        private bool CheckConvertion(MainForm form, IWICFormatConverterInfo info, Guid from, Guid to)
        {
            if (from == to)
            {
                return(true);
            }

            IWICImagingFactory factory = (IWICImagingFactory) new WICImagingFactory();
            IWICPalette        palette = factory.CreatePalette();

            palette.InitializePredefined(WICBitmapPaletteType.WICBitmapPaletteTypeFixedBW, false);
            IWICBitmap          bitmap    = null;
            IWICFormatConverter converter = null;

            try
            {
                try
                {
                    converter = info.CreateInstance();
                }
                catch (Exception e)
                {
                    form.Add(this, e.TargetSite.ToString(Resources._0_Failed), new DataEntry(e));

                    return(false);
                }

                try
                {
                    bitmap = factory.CreateBitmap(1, 1, from, WICBitmapCreateCacheOption.WICBitmapCacheOnLoad);
                    bitmap.SetPalette(palette);
                }
                catch (Exception e)
                {
                    form.Add(this, e.TargetSite.ToString(Resources._0_Failed), new DataEntry(e), new DataEntry(Resources.PixelFormat, from));

                    return(false);
                }

                try
                {
                    converter.Initialize(bitmap, to, WICBitmapDitherType.WICBitmapDitherTypeNone, palette, 0, WICBitmapPaletteType.WICBitmapPaletteTypeCustom);
                }
                catch (Exception e)
                {
                    form.CheckHRESULT(this, WinCodecError.WINCODEC_ERR_UNSUPPORTEDPIXELFORMAT, e, new DataEntry(Resources.Source, from), new DataEntry(Resources.Destination, to));

                    return(false);
                }

                return(true);
            }
            finally
            {
                palette.ReleaseComObject();
                converter.ReleaseComObject();
                bitmap.ReleaseComObject();
                factory.ReleaseComObject();
            }
        }
Esempio n. 4
0
        private void Check(MainForm form, IWICFormatConverterInfo info, object tag)
        {
            Guid[] pixelFormats = PixelFormatInfoRule.CheckPixelFormats(form, this, info.GetPixelFormats);
            Type   type         = Type.GetTypeFromCLSID(Parent.Clsid);

            if (type == null)
            {
                form.Add(this, Resources.PixelFormatConverterNotCreatable);
            }
            else
            {
                IWICImagingFactory factory = (IWICImagingFactory) new WICImagingFactory();
                foreach (Guid g in pixelFormats)
                {
                    bool supportsTo   = false;
                    bool supportsFrom = false;
                    foreach (Guid c in canonical)
                    {
                        supportsTo   |= CheckConvertion(form, info, g, c);
                        supportsFrom |= CheckConvertion(form, info, c, g);
                    }

                    if (!supportsTo)
                    {
                        form.Add(this, Resources.ToCannonicalNotSupported, new DataEntry(Resources.PixelFormat, g));
                    }
                    if (!supportsFrom)
                    {
                        form.Add(this, Resources.FromCannonicalNotSupported, new DataEntry(Resources.PixelFormat, g));
                    }
                }
            }
        }
Esempio n. 5
0
 public static IWICBitmapEncoder CreateEncoder(this IWICImagingFactory factory, Guid guidContainerFormat, Guid?pguidVendor = null)
 {
     using (var pguidVendorPtr = CoTaskMemPtr.From(pguidVendor))
     {
         return(factory.CreateEncoder(guidContainerFormat, pguidVendorPtr));
     }
 }
Esempio n. 6
0
 public static IWICMetadataQueryWriter CreateQueryWriter(this IWICImagingFactory imagingFactory, Guid guidMetadataFormat, Guid?pguidVendor = null)
 {
     using (var pguidVendorPtr = CoTaskMemPtr.From(pguidVendor))
     {
         return(imagingFactory.CreateQueryWriter(guidMetadataFormat, pguidVendorPtr));
     }
 }
Esempio n. 7
0
 public static IWICMetadataQueryWriter CreateQueryWriterFromReader(this IWICImagingFactory imagingFactory, IWICMetadataQueryReader pIQueryReader, Guid?pguidVendor = null)
 {
     using (var pguidVendorPtr = CoTaskMemPtr.From(pguidVendor))
     {
         return(imagingFactory.CreateQueryWriterFromReader(pIQueryReader, pguidVendorPtr));
     }
 }
Esempio n. 8
0
        public static IComObject <IWICBitmapDecoder> CreateDecoderFromFilename(this IWICImagingFactory factory, string fileName, Guid?guidVendor = null, FileAccess desiredAccess = FileAccess.Read, WICDecodeOptions metadataOptions = WICDecodeOptions.WICDecodeMetadataCacheOnDemand)
        {
            if (factory == null)
            {
                throw new ArgumentNullException(nameof(factory));
            }

            if (fileName == null)
            {
                throw new ArgumentNullException(nameof(factory));
            }

            const uint GENERIC_READ  = 0x80000000;
            const uint GENERIC_WRITE = 0x40000000;

            using (var guid = new ComMemory(guidVendor))
            {
                uint acc = 0;
                if (desiredAccess.HasFlag(FileAccess.Read))
                {
                    acc |= GENERIC_READ;
                }

                if (desiredAccess.HasFlag(FileAccess.Read))
                {
                    acc |= GENERIC_WRITE;
                }

                factory.CreateDecoderFromFilename(fileName, guid.Pointer, acc, metadataOptions, out var value).ThrowOnError();
                return(new ComObject <IWICBitmapDecoder>(value));
            }
        }
Esempio n. 9
0
 public static IWICBitmapDecoder CreateDecoderFromStream(this IWICImagingFactory imagingFactory, IStream stream, WICDecodeOptions metadataOptions, Guid?pguidVendor = null)
 {
     using (var pguidVendorPtr = CoTaskMemPtr.From(pguidVendor))
     {
         return(imagingFactory.CreateDecoderFromStream(stream, pguidVendorPtr, metadataOptions));
     }
 }
Esempio n. 10
0
        protected override void RunOverride(MainForm form, object tag)
        {
            bool info2Supported = false;

            IWICImagingFactory   factory = (IWICImagingFactory) new WICImagingFactory();
            IWICPixelFormatInfo2 info    = null;

            try
            {
                info           = factory.CreateComponentInfo(Parent.Clsid) as IWICPixelFormatInfo2;
                info2Supported = info != null;
            }
            finally
            {
                info.ReleaseComObject();
                factory.ReleaseComObject();
            }

            if (info2Supported)
            {
                ComponentInfoHelper.Check <IWICPixelFormatInfo2, object>(form, Parent.Clsid, Check, tag, this, false);
            }
            else
            {
                ComponentInfoHelper.Check <IWICPixelFormatInfo, object>(form, Parent.Clsid, Check, tag, this, false);
            }
        }
Esempio n. 11
0
        public static void CheckEquals <TInfo>(MainForm form, Func <TInfo> method, RuleBase <ComponentRuleGroup> rule, Func <TInfo, TInfo, DataEntry[][]> compare)
            where TInfo : class, IWICComponentInfo
        {
            IWICImagingFactory factory = (IWICImagingFactory) new WICImagingFactory();
            TInfo info = factory.CreateComponentInfo(rule.Parent.Clsid) as TInfo;
            TInfo i    = null;

            try
            {
                i = method();
                if (i == null)
                {
                    form.Add(rule, method.ToString(Resources._0_NULL));
                }
                else
                {
                    foreach (DataEntry[] de in compare(info, i))
                    {
                        form.Add(rule, string.Format(CultureInfo.CurrentUICulture, Resources.InconsistentComponentInfo, typeof(TInfo).Name, method.ToString("{0}")), de);
                    }
                }
            }
            catch (Exception e)
            {
                form.Add(rule, method.ToString(Resources._0_Failed), new DataEntry(e));
            }
            finally
            {
                i.ReleaseComObject();
                info.ReleaseComObject();
                factory.ReleaseComObject();
            }
        }
Esempio n. 12
0
        public static void FillBlobFromBitmapSource(this IWICImagingFactory factory, IWICBitmapSource source, IntPtr blob, int bufferStride, int bufferSize, Guid imageFormat)
        {
            IWICBitmapSource iwicbitmapSource = factory.ConvertFormat(source, imageFormat);

            iwicbitmapSource.FillBlobFromBitmapSource(blob, bufferStride, bufferSize);
            GraphicsInteropNativeMethods.SafeReleaseComObject(iwicbitmapSource);
        }
Esempio n. 13
0
        static Guid[] GetAllPixelFormats()
        {
            List <Guid> res = new List <Guid>();

            IWICImagingFactory factory = (IWICImagingFactory) new WICImagingFactory();
            IEnumUnknown       eu      = factory.CreateComponentEnumerator(WICComponentType.WICPixelFormat, WICComponentEnumerateOptions.WICComponentEnumerateRefresh);
            int hr = 0;

            object[] o = new object[1];
            while (hr == 0)
            {
                uint fetched = 0;

                hr = eu.Next(1, o, ref fetched);
                if (fetched == 1)
                {
                    IWICPixelFormatInfo info = (IWICPixelFormatInfo)o[0];
                    Guid guid;
                    info.GetFormatGUID(out guid);
                    res.Add(guid);

                    info.ReleaseComObject();
                }
                o.ReleaseComObject();
            }

            return(res.ToArray());
        }
Esempio n. 14
0
 public static IWICBitmapDecoder CreateDecoderFromFileHandle(this IWICImagingFactory imagingFactory, IntPtr hFile, WICDecodeOptions metadataOptions, Guid?pguidVendor = null)
 {
     using (var pguidVendorPtr = CoTaskMemPtr.From(pguidVendor))
     {
         return(imagingFactory.CreateDecoderFromFileHandle(hFile, pguidVendorPtr, metadataOptions));
     }
 }
Esempio n. 15
0
        public static void Save(this IWICImagingFactory factory, IWICBitmapSource imageSource, IWICStream stream, Guid encoderId)
        {
            if (factory == null)
            {
                throw new ArgumentNullException("factory");
            }
            if (imageSource == null)
            {
                throw new ArgumentNullException("imageSource");
            }
            if (stream == null)
            {
                throw new ArgumentNullException("stream");
            }
            IWICBitmapEncoder iwicbitmapEncoder = factory.CreateEncoder(ref encoderId, null);

            iwicbitmapEncoder.Initialize(stream, WICBitmapEncoderCacheOption.WICBitmapEncoderNoCache);
            IWICBitmapFrameEncode iwicbitmapFrameEncode;

            iwicbitmapEncoder.CreateNewFrame(out iwicbitmapFrameEncode, null);
            iwicbitmapFrameEncode.Initialize(null);
            iwicbitmapFrameEncode.WriteSource(imageSource, null);
            iwicbitmapFrameEncode.Commit();
            iwicbitmapEncoder.Commit();
            GraphicsInteropNativeMethods.SafeReleaseComObject(iwicbitmapEncoder);
            GraphicsInteropNativeMethods.SafeReleaseComObject(iwicbitmapFrameEncode);
        }
Esempio n. 16
0
        private void DetectSalientRegions(IWICImagingFactory factory, IWICBitmapSource bitmapSource)
        {
            int num;
            int num2;

            bitmapSource.GetSize(out num, out num2);
            int         patchSize   = Math.Max((num + num2) / 2 / 50, 4);
            SaliencyMap saliencyMap = new SaliencyMap(new ArgbImage(factory, bitmapSource), patchSize, 1f);

            this.TiledImage = saliencyMap.TiledImage;
            float saliencyThreshold = this.SaliencyThreshold;

            this.SalientObjects    = SalientObjectAnalysis.GroupSalientTiles(this.TiledImage, ref saliencyThreshold, 8);
            this.SaliencyThreshold = saliencyThreshold;
            this.TotalSalience     = 0f;
            float num3 = -1f;

            foreach (float num4 in from region in this.SalientObjects
                     select region.Region.Cluster.Mass)
            {
                float num5 = num4;
                if (num3 < num5)
                {
                    num3 = num5;
                }
                this.TotalSalience += num5;
            }
            foreach (SalientObject salientObject in this.SalientObjects)
            {
                salientObject.SaliencePortion = salientObject.Region.Cluster.Mass / this.TotalSalience;
                salientObject.IsPrimary       = (salientObject.Region.Cluster.Mass >= num3);
            }
        }
Esempio n. 17
0
 public static IWICBitmapDecoder CreateDecoderFromFilename(this IWICImagingFactory imagingFactory, string wzFilename, Guid?pguidVendor = null, WICDecodeOptions metadataOptions = WICDecodeOptions.WICDecodeMetadataCacheOnDemand)
 {
     using (var pguidVendorPtr = CoTaskMemPtr.From(pguidVendor))
     {
         return(imagingFactory.CreateDecoderFromFilename(wzFilename, pguidVendorPtr, StreamAccessMode.GENERIC_READ, metadataOptions));
     }
 }
Esempio n. 18
0
 public TestApplication(bool headless = false)
     : base(headless)
 {
     using FileStream stream         = File.OpenRead("Screenshot.jpg");
     using var wicFactory            = new IWICImagingFactory();
     using IWICStream? wicStream     = wicFactory.CreateStream(stream);
     using IWICBitmapDecoder decoder = wicFactory.CreateDecoderFromStream(wicStream !);
 }
Esempio n. 19
0
 internal static IWICImagingFactory GetImagingFactory()
 {
     if (ImagingFactory == null)
     {
         ImagingFactory = (IWICImagingFactory) new WICImagingFactory();
     }
     return(ImagingFactory);
 }
Esempio n. 20
0
 public static IWICImagingFactory CreateImagingFactory()
 {
     if (factory == null)
     {
         factory = NativeMethods.WICCreateImagingFactory_Proxy(SDKVersion: 566U);
     }
     return(factory);
 }
Esempio n. 21
0
        public static void Main()
        {
            var wicFactory = new IWICImagingFactory();

            D2D1.D2D1CreateFactory(FactoryType.SingleThreaded, out ID2D1Factory d2dFactory);

            const string fileName = "output.jpg";
            const int    width    = 512;
            const int    height   = 512;

            var rectangleGeometry = d2dFactory.CreateRoundedRectangleGeometry(new RoundedRectangle(new RectangleF(128, 128, width - 128 * 2, height - 128 * 2), 32, 32));

            var wicBitmap = wicFactory.CreateBitmap(width, height, Vortice.DirectX.WIC.PixelFormat.Format32bppBGR, BitmapCreateCacheOption.CacheOnLoad);

            var renderTargetProperties = new RenderTargetProperties(new Vortice.DirectX.Direct2D.PixelFormat(Format.Unknown, Vortice.DirectX.Direct2D.AlphaMode.Unknown));

            var d2dRenderTarget = d2dFactory.CreateWicBitmapRenderTarget(wicBitmap, renderTargetProperties);

            var solidColorBrush = d2dRenderTarget.CreateSolidColorBrush(new Color4(1.0f));

            d2dRenderTarget.BeginDraw();
            d2dRenderTarget.Clear(new Color4(0.0f, 0.0f, 0.0f, 1.0f));
            d2dRenderTarget.FillGeometry(rectangleGeometry, solidColorBrush, null);
            d2dRenderTarget.EndDraw();

            if (File.Exists(fileName))
            {
                File.Delete(fileName);
            }

            using (var stream = wicFactory.CreateStream())
            {
                stream.Initialize(fileName, FileAccess.Write);

                // Initialize a Jpeg encoder with this stream
                using (var encoder = wicFactory.CreateEncoder(ContainerFormat.Jpeg))
                {
                    encoder.Initialize(stream);

                    // Create a Frame encoder
                    var props             = new SharpGen.Runtime.Win32.PropertyBag(IntPtr.Zero);
                    var bitmapFrameEncode = encoder.CreateNewFrame(props);
                    bitmapFrameEncode.Initialize(null);
                    bitmapFrameEncode.SetSize(width, height);
                    var pixelFormatGuid = Vortice.DirectX.WIC.PixelFormat.FormatDontCare;
                    bitmapFrameEncode.SetPixelFormat(ref pixelFormatGuid);
                    bitmapFrameEncode.WriteSource(wicBitmap, null);

                    bitmapFrameEncode.Commit();
                    encoder.Commit();
                }
            }

            using (var app = new TestApplication())
            {
                app.Run();
            }
        }
        static void Main(string[] args)
        {
            IWICImagingFactory    factory         = (IWICImagingFactory) new WICImagingFactory();
            IWICBitmapDecoder     decoder         = null;
            IWICBitmapFrameDecode frame           = null;
            IWICFormatConverter   formatConverter = null;

            try
            {
                const string filename = @"<filename>";

                decoder = factory.CreateDecoderFromFilename(filename, null, NativeMethods.GenericAccessRights.GENERIC_READ,
                                                            WICDecodeOptions.WICDecodeMetadataCacheOnDemand);

                uint count = decoder.GetFrameCount();

                frame = decoder.GetFrame(0);

                uint width  = 0;
                uint height = 0;
                frame.GetSize(out width, out height);

                Guid pixelFormat;
                frame.GetPixelFormat(out pixelFormat);

                // The frame can use many different pixel formats.
                // You can copy the raw pixel values by calling "frame.CopyPixels( )".
                // This method needs a buffer that can hold all bytes.
                // The total number of bytes is: width x height x bytes per pixel

                // The disadvantage of this solution is that you have to deal with all possible pixel formats.

                // You can make your life easy by converting the frame to a pixel format of
                // your choice. The code below shows how to convert the pixel format to 24-bit RGB.

                formatConverter = factory.CreateFormatConverter();

                formatConverter.Initialize(frame,
                                           Consts.GUID_WICPixelFormat24bppRGB,
                                           WICBitmapDitherType.WICBitmapDitherTypeNone,
                                           null,
                                           0.0,
                                           WICBitmapPaletteType.WICBitmapPaletteTypeCustom);

                uint   bytesPerPixel = 3; // Because we have converted the frame to 24-bit RGB
                uint   stride        = width * bytesPerPixel;
                byte[] bytes         = new byte[stride * height];

                formatConverter.CopyPixels(null, stride, stride * height, bytes);
            }
            finally
            {
                frame.ReleaseComObject();
                decoder.ReleaseComObject();
                factory.ReleaseComObject();
            }
        }
Esempio n. 23
0
        private void LoadFromWic(IWICImagingFactory factory, IWICBitmapSource bitmapSource, Guid wicImageFormat)
        {
            int width;
            int height;

            bitmapSource.GetSize(out width, out height);
            this.EnsureBuffer(width, height);
            factory.FillBlobFromBitmapSource(bitmapSource, this.Image, wicImageFormat);
        }
Esempio n. 24
0
        protected ImageBase(Stream stream, Guid wicImageFormat) : this()
        {
            IWICImagingFactory    iwicimagingFactory    = WicUtility.CreateFactory();
            IWICBitmapFrameDecode iwicbitmapFrameDecode = iwicimagingFactory.Load(stream);

            this.LoadFromWic(iwicimagingFactory, iwicbitmapFrameDecode, wicImageFormat);
            GraphicsInteropNativeMethods.SafeReleaseComObject(iwicimagingFactory);
            GraphicsInteropNativeMethods.SafeReleaseComObject(iwicbitmapFrameDecode);
        }
Esempio n. 25
0
        private void Detect(ImageSource imageSource)
        {
            IWICImagingFactory    iwicimagingFactory    = WicUtility.CreateFactory();
            IWICBitmapFrameDecode iwicbitmapFrameDecode = iwicimagingFactory.Load(imageSource.ImageStream);

            this.DetectSalientRegions(iwicimagingFactory, iwicbitmapFrameDecode);
            GraphicsInteropNativeMethods.SafeReleaseComObject(iwicbitmapFrameDecode);
            GraphicsInteropNativeMethods.SafeReleaseComObject(iwicimagingFactory);
        }
Esempio n. 26
0
        public static void Save(this IWICImagingFactory factory, IWICBitmapSource imageSource, string fileName)
        {
            if (factory == null)
            {
                throw new ArgumentNullException("factory");
            }
            if (imageSource == null)
            {
                throw new ArgumentNullException("imageSource");
            }
            if (fileName == null)
            {
                throw new ArgumentNullException("fileName");
            }
            string extension = Path.GetExtension(fileName);

            if (string.IsNullOrEmpty(extension))
            {
                throw new InvalidOperationException(string.Format(CultureInfo.InvariantCulture, "File name '{0}' does not have an extension so encoder type can not be determined.", new object[]
                {
                    fileName
                }));
            }
            Guid encoderId;

            if (extension.Equals(".jpg", StringComparison.OrdinalIgnoreCase) || extension.Equals(".jpeg", StringComparison.OrdinalIgnoreCase))
            {
                encoderId = WicGuids.GUID_ContainerFormatJpeg;
            }
            else if (extension.Equals(".png", StringComparison.OrdinalIgnoreCase))
            {
                encoderId = WicGuids.GUID_ContainerFormatPng;
            }
            else if (extension.Equals(".bmp", StringComparison.OrdinalIgnoreCase))
            {
                encoderId = WicGuids.GUID_ContainerFormatBmp;
            }
            else
            {
                if (!extension.Equals(".tiff", StringComparison.OrdinalIgnoreCase))
                {
                    throw new InvalidOperationException(string.Format(CultureInfo.InvariantCulture, "File name '{0}' has extension {1} which we can't handle.", new object[]
                    {
                        fileName,
                        extension
                    }));
                }
                encoderId = WicGuids.GUID_ContainerFormatTiff;
            }
            IWICStream iwicstream;

            factory.CreateStream(out iwicstream);
            iwicstream.InitializeFromFilename(fileName, GenericAccess.GENERIC_WRITE);
            factory.Save(imageSource, iwicstream, encoderId);
            GraphicsInteropNativeMethods.SafeReleaseComObject(iwicstream);
        }
Esempio n. 27
0
        public static IComObject <IWICBitmap> CreateBitmapFromHICON(this IWICImagingFactory factory, IntPtr iconHandle)
        {
            if (factory == null)
            {
                throw new ArgumentNullException(nameof(factory));
            }

            factory.CreateBitmapFromHICON(iconHandle, out var value).ThrowOnError();
            return(new ComObject <IWICBitmap>(value));
        }
Esempio n. 28
0
        public static IComObject <IWICBitmap> CreateBitmap(this IWICImagingFactory factory, int width, int height, Guid pixelFormat, WICBitmapCreateCacheOption option = WICBitmapCreateCacheOption.WICBitmapNoCache)
        {
            if (factory == null)
            {
                throw new ArgumentNullException(nameof(factory));
            }

            factory.CreateBitmap(width, height, pixelFormat, option, out var value).ThrowOnError();
            return(new ComObject <IWICBitmap>(value));
        }
Esempio n. 29
0
        public static IComObject <IWICBitmapScaler> CreateBitmapScaler(this IWICImagingFactory factory)
        {
            if (factory == null)
            {
                throw new ArgumentNullException(nameof(factory));
            }

            factory.CreateBitmapScaler(out var value).ThrowOnError();
            return(new ComObject <IWICBitmapScaler>(value));
        }
Esempio n. 30
0
        public static IComObject <IWICColorContext> CreateColorContext(this IWICImagingFactory factory)
        {
            if (factory == null)
            {
                throw new ArgumentNullException(nameof(factory));
            }

            factory.CreateColorContext(out var value).ThrowOnError();
            return(new ComObject <IWICColorContext>(value));
        }
Esempio n. 31
0
 private void InitializeDeviceIndependantResources()
 {
     m_wicImagingFactory = new WICImagingFactory() as IWICImagingFactory;
 }
Esempio n. 32
0
 internal static IWICImagingFactory GetImagingFactory()
 {
     if (ImagingFactory == null)
         ImagingFactory = (IWICImagingFactory)new WICImagingFactory();
     return ImagingFactory;
 }