Exemplo n.º 1
0
        public void Render()
        {
            ////////////////////////////////////
            HostDC.EndDraw();

            using (D2DBitmap loadBp = new D2DBitmap(HostDC, Size,
                                                    new BitmapProperties1(HostDC.PixelFormat, HostDC.DotsPerInch.Width, HostDC.DotsPerInch.Height, BitmapOptions.Target | BitmapOptions.CannotDraw)), loadBp2 = new D2DBitmap(HostDC, Size,
                                                                                                                                                                                                                              new BitmapProperties1(HostDC.PixelFormat, HostDC.DotsPerInch.Width, HostDC.DotsPerInch.Height, BitmapOptions.None)))
            {
                var old_target = HostDC.Target;


                HostDC.Target = loadBp;

                HostDC.BeginDraw();
                HostDC.Clear(Color);
                var RCP = RenderGroup.ToArray();
                foreach (var i in RCP)
                {
                    i?.Render();
                }

                HostDC.EndDraw();

                if (Effecting != null)
                {
                    loadBp2.CopyFromBitmap(loadBp);
                    var resultEff = Effecting(loadBp2, HostDC);

                    if (resultEff == null)
                    {
                        Effecting = null;
                        goto tag;
                    }
                    var resultIm = resultEff.Output;
                    HostDC.BeginDraw();
                    HostDC.Clear(Color);
                    HostDC.DrawImage(resultIm, new RawVector2(0, 0), null, SharpDX.Direct2D1.InterpolationMode.Linear, CompositeMode.SourceOver);
                    HostDC.EndDraw();
                    resultEff.Dispose();
                    resultIm.Dispose();
                }
tag:
                loadBp2.CopyFromBitmap(loadBp);
                HostDC.Target = old_target;
                HostDC.BeginDraw();

                if (old_target as D2DBitmap == null)
                {
                    old_target.Dispose();
                }

                if (Effecting != null)
                {
                }

                HostDC.DrawBitmap(loadBp2, OutPutRange, 1f, SharpDX.Direct2D1.InterpolationMode.Linear, Range, null);
            }
        }
Exemplo n.º 2
0
 public void SetEffect(EffectProc Proc)
 {
     Effecting = Proc;
 }