Beispiel #1
0
		public Transform3D(Device dev, params Transform3D[] effects)
			: this(IntPtr.Zero)
		{
			dev.CreateTransform3DGroup(effects, effects.Length, this);
		}
Beispiel #2
0
		public Animation(Device device) : base(IntPtr.Zero)
		{
			device.CreateAnimation(this);
		}
		public TranslateTransform3D(Device device) : base(IntPtr.Zero)
		{
			device.CreateTranslateTransform3D(this);
		}
Beispiel #4
0
		public Transform3D(Device dev, ComArray<Transform3D> effects)
			: this(IntPtr.Zero)
		{
			dev.CreateTransform3DGroup(effects, effects.Length, this);
		}
Beispiel #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FormRenderer"/> class.
        /// </summary>
        /// <param name="form">The form.</param>
        public FormRenderer(Form1 form)
        {
            this.form = form;
#if DEBUG
            var creationFlags = D3D11.DeviceCreationFlags.BgraSupport | D3D11.DeviceCreationFlags.Debug;
            var debugFactory  = true;
#else
            var creationFlags = D3D11.DeviceCreationFlags.BgraSupport;
            var debugFactory  = false;
#endif

            this.device = new D3D11.Device(D3D.DriverType.Hardware, creationFlags);

#if DEBUG
            this.deviceDebug = new D3D11.DeviceDebug(this.device);
#endif

            using (var dxgiDevice = this.device.QueryInterface <DXGI.Device>())
            {
                using (var dxgiFactory = new DXGI.Factory2(debugFactory))
                {
                    var desc = new DXGI.SwapChainDescription1()
                    {
                        BufferCount       = 2,
                        AlphaMode         = DXGI.AlphaMode.Premultiplied,
                        SampleDescription = new DXGI.SampleDescription(1, 0),
                        Usage             = DXGI.Usage.RenderTargetOutput,
                        SwapEffect        = DXGI.SwapEffect.FlipDiscard,
                        Format            = DXGI.Format.B8G8R8A8_UNorm,
                        Width             = form.Width,
                        Height            = form.Height,
                    };

                    this.swapChain = new DXGI.SwapChain1(dxgiFactory, dxgiDevice, ref desc, null);

                    this.deviceComp        = new DComp.Device(dxgiDevice);
                    this.compositionTarget = DComp.Target.FromHwnd(this.deviceComp, form.Handle, true);

                    using (var visual = new DComp.Visual(this.deviceComp))
                    {
                        visual.Content = this.swapChain;
                        this.compositionTarget.Root = visual;
                    }

                    this.deviceComp.Commit();
                }
            }

            using (var device = this.device.QueryInterface <DXGI.Device>())
            {
                this.device2d = new D2D.Device(this.factory2d, device);
            }

            this.deviceContext2D = new D2D.DeviceContext(this.device2d, D2D.DeviceContextOptions.None)
            {
                DotsPerInch   = this.factory2d.DesktopDpi,
                AntialiasMode = D2D.AntialiasMode.PerPrimitive,
            };

            this.CreateResources();
        }
Beispiel #6
0
		public VirtualSurface(Device device, int initialWidth, int initialHeight, DXGI.Format format, DXGI.AlphaMode alphaMode) : base(IntPtr.Zero)
		{
			device.CreateVirtualSurface(initialWidth, initialHeight, format, alphaMode, this);
		}
Beispiel #7
0
		public RectangleClip(Device device) : base(IntPtr.Zero)
		{
			device.CreateRectangleClip(this);
		}
Beispiel #8
0
		public ScaleTransform(Device device) : base(IntPtr.Zero)
		{
			device.CreateScaleTransform(this);
		}
Beispiel #9
0
		public Visual(Device device)
			: base(IntPtr.Zero)
		{
			device.CreateVisual(this);
		}
Beispiel #10
0
		public RotateTransform(Device device) : base(IntPtr.Zero)
		{
			device.CreateRotateTransform(this);
		}
Beispiel #11
0
        /// <summary>
		/// Creates a composition target object that is bound to the window that is represented by the specified window handle.
		/// </summary>
		/// <param name="device">A device the target is to be associated with.</param>
		/// <param name="hwnd">The window to which the composition object will be bound. This cannot be null.</param>
		/// <param name="topmost">TRUE if the visual tree should be displayed on top of the children of the window specified by the hwnd parameter; otherwise, the visual tree is displayed behind the children.</param>
		/// <returns></returns>
      public static Target FromHwnd(Device device, IntPtr hwnd, bool topmost)
      {
         Target target;
         device.CreateTargetForHwnd(hwnd, topmost, out target);
         return target;
      }
Beispiel #12
0
		public EffectGroup(Device device)
			: base(IntPtr.Zero)
		{
			device.CreateEffectGroup(this);
		}
Beispiel #13
0
		public MatrixTransform(Device device) : base(IntPtr.Zero)
		{
			device.CreateMatrixTransform(this);
		}