private void Render() { App.Model.SecondCanvasImage = Adjust.GetDisplacementMap(App.Model.SecondSourceRenderTarget, turbulence, App.Setting.GlassAmount); App.Model.isReRender = true; //重新渲染 App.Model.Refresh++; //画布刷新 }
public static void Render() { if (App.Setting.PinchPunchRadius < 0) { App.Setting.PinchPunchRadius = 1; } else if (App.Setting.PinchPunchRadius > 1000) { App.Setting.PinchPunchRadius = 1000; } //偏移 float W = (float)App.Model.PunchDisplacement.Size.Width; float H = (float)App.Model.PunchDisplacement.Size.Height; Matrix3x2 m = Matrix3x2.CreateTranslation(-W / 2, -H / 2) * Matrix3x2.CreateScale(App.Setting.PinchPunchRadius / W * 2, App.Setting.PinchPunchRadius / H * 2) * Matrix3x2.CreateTranslation(App.Model.Width / 2, App.Model.Height / 2); //判断 if (App.Setting.PinchPunchAmount > 0) { DisScale = new Transform2DEffect { Source = App.Model.PunchDisplacement, TransformMatrix = m, } } ; else { DisScale = new Transform2DEffect { Source = App.Model.PinchDisplacement, TransformMatrix = m, } }; //绘画 using (var ds = DisTarget.CreateDrawingSession()) { ds.Clear(App.Setting.LiquifyColor); ds.DrawImage(DisScale); } //置换贴图 App.Model.SecondCanvasImage = Adjust.GetDisplacementMap(App.Model.SecondSourceRenderTarget, DisTarget, Math.Abs(App.Setting.PinchPunchAmount)); App.Model.isReRender = true; //重新渲染 App.Model.Refresh++; //画布刷新 } }