Exemplo n.º 1
0
 public RenderTargetCanvas(D2D1.RenderTarget renderTarget, Direct2DFactories factories = null)
 {
     if (renderTarget == null)
     {
         throw new ArgumentNullException("renderTarget");
     }
     this.factories = factories ?? Direct2DFactories.Shared;
     Initialize(renderTarget);
 }
Exemplo n.º 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;
 }
Exemplo n.º 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));
 }
Exemplo n.º 4
0
 public WICBitmapSourceImage(WIC.BitmapSource bmp, Direct2DFactories factories = null)
 {
     if (bmp == null)
         throw new ArgumentNullException ("bmp");
     this.bmp = bmp;
     this.factories = factories ?? Direct2DFactories.Shared;
 }
Exemplo n.º 5
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);
 }
Exemplo n.º 6
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))
        {
        }
Exemplo n.º 7
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));
        }
Exemplo n.º 8
0
 protected RenderTargetCanvas(Direct2DFactories factories = null)
 {
     this.factories = factories ?? Direct2DFactories.Shared;
 }
Exemplo n.º 9
0
 public RenderTargetCanvas(D2D1.RenderTarget renderTarget, Direct2DFactories factories = null)
 {
     if (renderTarget == null)
         throw new ArgumentNullException ("renderTarget");
     this.factories = factories ?? Direct2DFactories.Shared;
     Initialize (renderTarget);
 }
Exemplo n.º 10
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));
 }
Exemplo n.º 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);
        }
Exemplo n.º 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))
 {
 }
Exemplo n.º 13
0
 protected RenderTargetCanvas(Direct2DFactories factories = null)
 {
     this.factories = factories ?? Direct2DFactories.Shared;
 }
Exemplo n.º 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));
        }