public Direct2DImageEncoder(int imageWidth, int imageHeight, int imageDpi)
        {
          this.imageWidth = imageWidth;
          this.imageHeight = imageHeight;      

          factoryManager = new Direct2DFactoryManager();

          wicBitmap = new SharpDX.WIC.Bitmap(factoryManager.WicFactory, imageWidth, imageHeight, SharpDX.WIC.PixelFormat.Format32bppBGR, BitmapCreateCacheOption.CacheOnLoad);
          var renderTargetProperties = new RenderTargetProperties(RenderTargetType.Default, new SharpDX.Direct2D1.PixelFormat(SharpDX.DXGI.Format.Unknown, AlphaMode.Unknown), imageDpi, imageDpi, RenderTargetUsage.None, FeatureLevel.Level_DEFAULT);
          renderTarget = new WicRenderTarget(factoryManager.D2DFactory, wicBitmap, renderTargetProperties);
          renderTarget.BeginDraw();
          renderTarget.Clear(SharpDX.Color.Yellow);
        
        }
Ejemplo n.º 2
0
        public Direct2DImageEncoder(int imageWidth, int imageHeight, int imageDpi)
        {
            this.imageWidth  = imageWidth;
            this.imageHeight = imageHeight;

            factoryManager = new Direct2DFactoryManager();

            wicBitmap = new SharpDX.WIC.Bitmap(factoryManager.WicFactory, imageWidth, imageHeight, SharpDX.WIC.PixelFormat.Format32bppBGR, BitmapCreateCacheOption.CacheOnLoad);
            var renderTargetProperties = new RenderTargetProperties(RenderTargetType.Default, new SharpDX.Direct2D1.PixelFormat(SharpDX.DXGI.Format.Unknown, AlphaMode.Unknown), imageDpi, imageDpi, RenderTargetUsage.None, FeatureLevel.Level_DEFAULT);

            renderTarget = new WicRenderTarget(factoryManager.D2DFactory, wicBitmap, renderTargetProperties);
            renderTarget.BeginDraw();
            renderTarget.Clear(SharpDX.Color.Yellow);
        }