Example #1
0
 public RenderTargetCanvas(D2D1.RenderTarget renderTarget, Direct2DFactories factories = null)
 {
     if (renderTarget == null)
     {
         throw new ArgumentNullException("renderTarget");
     }
     this.factories = factories ?? Direct2DFactories.Shared;
     Initialize(renderTarget);
 }
Example #2
0
 public WICBitmapSourceImage(WIC.BitmapSource bmp, Direct2DFactories factories = null)
 {
     if (bmp == null)
     {
         throw new ArgumentNullException("bmp");
     }
     this.bmp       = bmp;
     this.factories = factories ?? Direct2DFactories.Shared;
 }
Example #3
0
 public RenderTargetCanvas(DXGI.Surface surface, D2D1.RenderTargetProperties properties, Direct2DFactories factories = null)
 {
     if (surface == null)
     {
         throw new ArgumentNullException("surface");
     }
     this.factories = factories ?? Direct2DFactories.Shared;
     Initialize(new D2D1.RenderTarget(this.factories.D2DFactory, surface, properties));
 }
 public WICBitmapSourceImage(WIC.BitmapSource bmp, Direct2DFactories factories = null)
 {
     if (bmp == null)
         throw new ArgumentNullException ("bmp");
     this.bmp = bmp;
     this.factories = factories ?? Direct2DFactories.Shared;
 }
 public WICBitmapCanvas(WIC.Bitmap bmp, D2D1.RenderTargetProperties properties, Direct2DFactories factories = null)
     : base(new D2D1.WicRenderTarget ((factories ?? Direct2DFactories.Shared).D2DFactory, bmp, properties), factories)
 {
     this.Bmp = bmp;
     this.scale = properties.DpiX / 96.0;
     var bmpSize = bmp.Size;
     this.size = new Size (bmpSize.Width / scale, bmpSize.Height / scale);
 }
        public WICBitmapCanvas(Size size, double scale = 1.0, bool transparency = true, Direct2DFactories factories = null)
            : this(// DIPs = pixels / (DPI/96.0)
				new WIC.Bitmap ((factories ?? Direct2DFactories.Shared).WICFactory, (int)(Math.Ceiling (size.Width * scale)), (int)(Math.Ceiling (size.Height * scale)), transparency ? WIC.PixelFormat.Format32bppPBGRA : WIC.PixelFormat.Format32bppBGR, WIC.BitmapCreateCacheOption.CacheOnLoad),
				new D2D1.RenderTargetProperties (D2D1.RenderTargetType.Default, new D2D1.PixelFormat (DXGI.Format.Unknown, D2D1.AlphaMode.Unknown), (float)(96.0 * scale), (float)(96.0 * scale), D2D1.RenderTargetUsage.None, D2D1.FeatureLevel.Level_DEFAULT))
        {
        }
        public SurfaceImageSourceCanvas(SurfaceImageSource surfaceImageSource, Rect updateRect, Direct2DFactories factories = null)
            : base(factories)
        {
            sisn = ComObject.As<DXGI.ISurfaceImageSourceNative> (surfaceImageSource);
            SharpDX.Point offset;
            var surface = sisn.BeginDraw (updateRect.ToRectangle (), out offset);

            var dpi = 96.0;
            var properties = new D2D1.RenderTargetProperties (D2D1.RenderTargetType.Default, new D2D1.PixelFormat (DXGI.Format.Unknown, D2D1.AlphaMode.Unknown), (float)(dpi), (float)(dpi), D2D1.RenderTargetUsage.None, D2D1.FeatureLevel.Level_DEFAULT);
            Initialize (new D2D1.RenderTarget (this.factories.D2DFactory, surface, properties));
        }
 protected RenderTargetCanvas(Direct2DFactories factories = null)
 {
     this.factories = factories ?? Direct2DFactories.Shared;
 }
 public RenderTargetCanvas(D2D1.RenderTarget renderTarget, Direct2DFactories factories = null)
 {
     if (renderTarget == null)
         throw new ArgumentNullException ("renderTarget");
     this.factories = factories ?? Direct2DFactories.Shared;
     Initialize (renderTarget);
 }
 public RenderTargetCanvas(DXGI.Surface surface, D2D1.RenderTargetProperties properties, Direct2DFactories factories = null)
 {
     if (surface == null)
         throw new ArgumentNullException ("surface");
     this.factories = factories ?? Direct2DFactories.Shared;
     Initialize (new D2D1.RenderTarget (this.factories.D2DFactory, surface, properties));
 }
Example #11
0
        public WICBitmapCanvas(WIC.Bitmap bmp, D2D1.RenderTargetProperties properties, Direct2DFactories factories = null)
            : base(new D2D1.WicRenderTarget((factories ?? Direct2DFactories.Shared).D2DFactory, bmp, properties), factories)
        {
            this.Bmp   = bmp;
            this.scale = properties.DpiX / 96.0;
            var bmpSize = bmp.Size;

            this.size = new Size(bmpSize.Width / scale, bmpSize.Height / scale);
        }
Example #12
0
 public WICBitmapCanvas(Size size, double scale = 1.0, bool transparency = true, Direct2DFactories factories = null)
     : this(
         // DIPs = pixels / (DPI/96.0)
         new WIC.Bitmap((factories ?? Direct2DFactories.Shared).WICFactory, (int)(Math.Ceiling(size.Width * scale)), (int)(Math.Ceiling(size.Height * scale)), transparency ? WIC.PixelFormat.Format32bppPBGRA : WIC.PixelFormat.Format32bppBGR, WIC.BitmapCreateCacheOption.CacheOnLoad),
         new D2D1.RenderTargetProperties(D2D1.RenderTargetType.Default, new D2D1.PixelFormat(DXGI.Format.Unknown, D2D1.AlphaMode.Unknown), (float)(96.0 * scale), (float)(96.0 * scale), D2D1.RenderTargetUsage.None, D2D1.FeatureLevel.Level_DEFAULT))
 {
 }
Example #13
0
 protected RenderTargetCanvas(Direct2DFactories factories = null)
 {
     this.factories = factories ?? Direct2DFactories.Shared;
 }
Example #14
0
        public SurfaceImageSourceCanvas(SurfaceImageSource surfaceImageSource, Rect updateRect, Direct2DFactories factories = null)
            : base(factories)
        {
            sisn = ComObject.As <DXGI.ISurfaceImageSourceNative> (surfaceImageSource);
            SharpDX.Point offset;
            var           surface = sisn.BeginDraw(updateRect.ToRectangle(), out offset);

            var dpi        = 96.0;
            var properties = new D2D1.RenderTargetProperties(D2D1.RenderTargetType.Default, new D2D1.PixelFormat(DXGI.Format.Unknown, D2D1.AlphaMode.Unknown), (float)(dpi), (float)(dpi), D2D1.RenderTargetUsage.None, D2D1.FeatureLevel.Level_DEFAULT);

            Initialize(new D2D1.RenderTarget(this.factories.D2DFactory, surface, properties));
        }