當前位置: 首頁>>代碼示例>>C#>>正文


C# WIC.ImagingFactory類代碼示例

本文整理匯總了C#中SharpDX.WIC.ImagingFactory的典型用法代碼示例。如果您正苦於以下問題:C# ImagingFactory類的具體用法?C# ImagingFactory怎麽用?C# ImagingFactory使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ImagingFactory類屬於SharpDX.WIC命名空間,在下文中一共展示了ImagingFactory類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: BitmapEncoder

 /// <summary>
 /// Initializes a new instance of the <see cref="BitmapEncoder"/> class.
 /// </summary>
 /// <param name="factory">The factory.</param>
 /// <param name="containerFormatGuid">The container format GUID. List from <see cref="ContainerFormatGuids"/> </param>
 /// <param name="stream">A stream to use as the output of this bitmap encoder.</param>
 /// <unmanaged>HRESULT IWICImagingFactory::CreateEncoder([In] const GUID&amp; guidContainerFormat,[In, Optional] const GUID* pguidVendor,[Out] IWICBitmapEncoder** ppIEncoder)</unmanaged>	
 public BitmapEncoder(ImagingFactory factory, Guid containerFormatGuid, System.IO.Stream stream = null)
 {
     this.factory = factory;
     factory.CreateEncoder(containerFormatGuid, null, this);
     if (stream != null)
         Initialize(stream);
 }
開發者ID:rbwhitaker,項目名稱:SharpDX,代碼行數:14,代碼來源:BitmapEncoder.cs

示例2: GetColorContexts

 internal static ColorContext[] GetColorContexts(ColorContextsProvider getColorContexts, ImagingFactory imagingFactory)
 {
     ColorContext[] colorContexts;
     Result result = TryGetColorContexts(getColorContexts, imagingFactory, out colorContexts);
     result.CheckError();
     return colorContexts;
 }
開發者ID:alexey-bez,項目名稱:SharpDX,代碼行數:7,代碼來源:ColorContextsHelper.cs

示例3: TryGetColorContexts

        internal static Result TryGetColorContexts(ColorContextsProvider getColorContexts, ImagingFactory imagingFactory, out ColorContext[] colorContexts)
        {
            colorContexts = null;

            int count;
            Result result = getColorContexts(0, null, out count);

            if (result.Success)
            {
                colorContexts = new ColorContext[count];

                if (count > 0)
                {
                    // http://msdn.microsoft.com/en-us/library/windows/desktop/ee690135(v=vs.85).aspx
                    // The ppIColorContexts array must be filled with valid data: each IWICColorContext* in the array must 
                    // have been created using IWICImagingFactory::CreateColorContext.

                    for (int i = 0; i < count; i++)
                        colorContexts[i] = new ColorContext(imagingFactory);
                    int actualCount;
                    getColorContexts(count, colorContexts, out actualCount);
                    Debug.Assert(count == actualCount);
                }
            }

            return result;
        }
開發者ID:alexey-bez,項目名稱:SharpDX,代碼行數:27,代碼來源:ColorContextsHelper.cs

示例4: Direct2DFactories

        public Direct2DFactories()
        {
            WICFactory = new WIC.ImagingFactory ();
            DWFactory = new DW.Factory ();

            var d3DDevice = new D3D11.Device (
                D3D.DriverType.Hardware,
                D3D11.DeviceCreationFlags.BgraSupport
            #if DEBUG
             | D3D11.DeviceCreationFlags.Debug
            #endif
            ,
                D3D.FeatureLevel.Level_11_1,
                D3D.FeatureLevel.Level_11_0,
                D3D.FeatureLevel.Level_10_1,
                D3D.FeatureLevel.Level_10_0,
                D3D.FeatureLevel.Level_9_3,
                D3D.FeatureLevel.Level_9_2,
                D3D.FeatureLevel.Level_9_1
                );

            var dxgiDevice = ComObject.As<SharpDX.DXGI.Device> (d3DDevice.NativePointer);
            var d2DDevice = new D2D1.Device (dxgiDevice);
            D2DFactory = d2DDevice.Factory;
            //_d2DDeviceContext = new D2D1.DeviceContext (d2DDevice, D2D1.DeviceContextOptions.None);
            //var dpi = DisplayDpi;
            //_d2DDeviceContext.DotsPerInch = new Size2F (dpi, dpi);
        }
開發者ID:rbrian,項目名稱:NGraphics,代碼行數:28,代碼來源:Direct2DCanvas.cs

示例5: WICStream

 /// <summary>
 /// Initializes a new instance of the <see cref="WICStream"/> class from a <see cref="IStream"/>.
 /// </summary>
 /// <param name="factory">The factory.</param>
 /// <param name="stream">The stream.</param>
 /// <msdn-id>ee719789</msdn-id>	
 /// <unmanaged>HRESULT IWICStream::InitializeFromIStream([In, Optional] IStream* pIStream)</unmanaged>	
 /// <unmanaged-short>IWICStream::InitializeFromIStream</unmanaged-short>	
 public WICStream(ImagingFactory factory, Stream stream)
     : base(IntPtr.Zero)
 {
     factory.CreateStream(this);
     streamProxy = new ComStreamProxy(stream);
     var istreamPtr = ComStreamShadow.ToIntPtr(streamProxy);
     InitializeFromIStream_(istreamPtr);
 }
開發者ID:alexey-bez,項目名稱:SharpDX,代碼行數:16,代碼來源:WICStream.cs

示例6: GifRecorder

 /// <summary>
 /// Initializes instance members of the <see cref="GifRecorder"/> class.
 /// </summary>
 public GifRecorder()
 {
     GifRepeatCount = 0;
     _imagingFactory = new ImagingFactory();
     _frames = new List<BitmapFrame>();
     MaxFramePerSecond = 8;
     _desktopManager = new DesktopManager();
 }
開發者ID:ababhamdi,項目名稱:FastCapt,代碼行數:11,代碼來源:GifRecorder.cs

示例7: Initialize

 public static void Initialize() {
     lock (SyncObject) {
         if (!_isInitailized) {
             _factory = new ImagingFactory();
             _isInitailized = true;
         }
     }
 }
開發者ID:Hozuki,項目名稱:Noire,代碼行數:8,代碼來源:TextureLoader.cs

示例8: BitmapImpl

        /// <summary>
        /// Initializes a new instance of the <see cref="BitmapImpl"/> class.
        /// </summary>
        /// <param name="factory">The WIC imaging factory to use.</param>
        /// <param name="stream">The stream to read the bitmap from.</param>
        public BitmapImpl(ImagingFactory factory, Stream stream)
        {
            _factory = factory;

            using (BitmapDecoder decoder = new BitmapDecoder(factory, stream, DecodeOptions.CacheOnLoad))
            {
                WicImpl = new Bitmap(factory, decoder.GetFrame(0), BitmapCreateCacheOption.CacheOnLoad);
            }
        }
開發者ID:jkoritzinsky,項目名稱:Avalonia,代碼行數:14,代碼來源:BitmapImpl.cs

示例9: BitmapImpl

        public BitmapImpl(ImagingFactory factory, string fileName)
        {
            this.factory = factory;

            using (BitmapDecoder decoder = new BitmapDecoder(factory, fileName, DecodeOptions.CacheOnDemand))
            {
                this.WicImpl = new Bitmap(factory, decoder.GetFrame(0), BitmapCreateCacheOption.CacheOnDemand);
            }
        }
開發者ID:Robertofon,項目名稱:Perspex,代碼行數:9,代碼來源:BitmapImpl.cs

示例10: CCLabel_Renderer81

        public CCLabel_Renderer81()
        {
            var d2dFactory = CreateD2DFactory();

            var newDevice = CreateDevice();

            CreateRenderingResources(newDevice, d2dFactory);

            FactoryImaging = new SharpDX.WIC.ImagingFactory();
        }
開發者ID:haithemaraissia,項目名稱:CocosSharp,代碼行數:10,代碼來源:CCLabel-Renderer81.cs

示例11: LoadBitmaps

        private static void LoadBitmaps()
        {
            var fac = new SharpDX.WIC.ImagingFactory();
            var target = GraphicsWindow.Instance.RenderTarget2D;
            var stream = new NativeFileStream(Application.StartupPath + "\\Images\\Ship 1.png", NativeFileMode.Open, NativeFileAccess.Read);
            var decoder = new BitmapDecoder(fac, stream, DecodeOptions.CacheOnDemand);
            var frame = decoder.GetFrame(0);
            var converter = new FormatConverter(fac);
            converter.Initialize(frame, SharpDX.WIC.PixelFormat.Format32bppPRGBA);

            BitShip1 = Bitmap1.FromWicBitmap(GraphicsWindow.Instance.RenderTarget2D, converter);
        }
開發者ID:jonathandlo,項目名稱:deep-space-dive,代碼行數:12,代碼來源:Constants.cs

示例12: Main

        private static void Main()
        {
            var wicFactory = new ImagingFactory();
            var d2dFactory = new SharpDX.Direct2D1.Factory();

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

            var rectangleGeometry = new RoundedRectangleGeometry(d2dFactory, new RoundedRectangle() { RadiusX = 32, RadiusY = 32, Rect = new RectangleF(128, 128, width - 128, height-128) });

            var wicBitmap = new Bitmap(wicFactory, width, height, SharpDX.WIC.PixelFormat.Format32bppBGR, BitmapCreateCacheOption.CacheOnLoad);

            var renderTargetProperties = new RenderTargetProperties(RenderTargetType.Default, new PixelFormat(Format.Unknown, AlphaMode.Unknown), 0, 0, RenderTargetUsage.None, FeatureLevel.Level_DEFAULT);

            var d2dRenderTarget = new WicRenderTarget(d2dFactory, wicBitmap, renderTargetProperties);

            var solidColorBrush = new SolidColorBrush(d2dRenderTarget, Color.White);

            d2dRenderTarget.BeginDraw();
            d2dRenderTarget.Clear(Color.Black);
            d2dRenderTarget.FillGeometry(rectangleGeometry, solidColorBrush, null);
            d2dRenderTarget.EndDraw();

            if (File.Exists(filename))
                File.Delete(filename);

            var stream = new WICStream(wicFactory, filename, NativeFileAccess.Write);
            // Initialize a Jpeg encoder with this stream
            var encoder = new JpegBitmapEncoder(wicFactory);
            encoder.Initialize(stream);

            // Create a Frame encoder
            var bitmapFrameEncode = new BitmapFrameEncode(encoder);
            bitmapFrameEncode.Initialize();
            bitmapFrameEncode.SetSize(width, height);
            var pixelFormatGuid = SharpDX.WIC.PixelFormat.FormatDontCare;
            bitmapFrameEncode.SetPixelFormat(ref pixelFormatGuid);
            bitmapFrameEncode.WriteSource(wicBitmap);

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

            bitmapFrameEncode.Dispose();
            encoder.Dispose();
            stream.Dispose();

            System.Diagnostics.Process.Start(Path.GetFullPath(Path.Combine(Environment.CurrentDirectory,filename)));
        }
開發者ID:rbwhitaker,項目名稱:SharpDX,代碼行數:49,代碼來源:Program.cs

示例13: RenderTargetBitmapImpl

 public RenderTargetBitmapImpl(
     ImagingFactory imagingFactory, 
     Factory d2dFactory,
     int width, 
     int height)
     : base(imagingFactory, width, height)
 {
     this.target = new WicRenderTarget(
         d2dFactory,
         this.WicImpl,
         new RenderTargetProperties
         {
             DpiX = 96,
             DpiY = 96,
         });
 }
開發者ID:Robertofon,項目名稱:Perspex,代碼行數:16,代碼來源:RenderTargetBitmapImpl.cs

示例14: RenderTargetBitmapImpl

        public RenderTargetBitmapImpl(
            ImagingFactory imagingFactory,
            Factory d2dFactory,
            int width,
            int height)
            : base(imagingFactory, width, height)
        {
            var props = new RenderTargetProperties
            {
                DpiX = 96,
                DpiY = 96,
            };

            _target = new WicRenderTarget(
                d2dFactory,
                WicImpl,
                props);
        }
開發者ID:healtech,項目名稱:Perspex,代碼行數:18,代碼來源:RenderTargetBitmapImpl.cs

示例15: Direct2D1RenderTargetBitmap

        public Direct2D1RenderTargetBitmap(
            Factory d2dFactory, 
            ImagingFactory wicFactory,
            SharpDX.WIC.Bitmap bitmap)
            : base(wicFactory, bitmap)
        {
            double dpiX;
            double dpiY;

            this.d2dFactory = d2dFactory;
            bitmap.GetResolution(out dpiX, out dpiY);

            this.target = new WicRenderTarget(
                d2dFactory,
                bitmap,
                new RenderTargetProperties
                {
                    DpiX = (float)dpiX,
                    DpiY = (float)dpiY,
                });
        }
開發者ID:modulexcite,項目名稱:Avalonia,代碼行數:21,代碼來源:Direct2D1RenderTargetBitmap.cs


注:本文中的SharpDX.WIC.ImagingFactory類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。