protected override void OnMouseMove(object o, Gtk.MotionNotifyEventArgs args, Cairo.PointD point) { base.OnMouseMove (o, args, point); if (tracking) { UserBlendOps.NormalBlendOp normalBlendOp = new UserBlendOps.NormalBlendOp(); GradientRenderer gr = null; switch (GradientType) { case eGradientType.Linear: gr = new GradientRenderers.LinearClamped (GradientColorMode == GradientColorMode.Transparency, normalBlendOp); break; case eGradientType.LinearReflected: gr = new GradientRenderers.LinearReflected (GradientColorMode == GradientColorMode.Transparency, normalBlendOp); break; case eGradientType.Radial: gr = new GradientRenderers.Radial (GradientColorMode == GradientColorMode.Transparency, normalBlendOp); break; case eGradientType.Diamond: gr = new GradientRenderers.LinearDiamond (GradientColorMode == GradientColorMode.Transparency, normalBlendOp); break; case eGradientType.Conical: gr = new GradientRenderers.Conical (GradientColorMode == GradientColorMode.Transparency, normalBlendOp); break; } if (button == 3) {//right gr.StartColor = PintaCore.Palette.SecondaryColor.ToColorBgra (); gr.EndColor = PintaCore.Palette.PrimaryColor.ToColorBgra (); } else {//1 left gr.StartColor = PintaCore.Palette.PrimaryColor.ToColorBgra (); gr.EndColor = PintaCore.Palette.SecondaryColor.ToColorBgra (); } gr.StartPoint = startpoint; gr.EndPoint = point; gr.AlphaBlending = UseAlphaBlending; gr.BeforeRender (); Gdk.Rectangle selection_bounds = PintaCore.Layers.SelectionPath.GetBounds (); ImageSurface scratch_layer = PintaCore.Layers.ToolLayer.Surface; gr.Render (scratch_layer, new Gdk.Rectangle[] { selection_bounds }); using (Context g = new Context (PintaCore.Layers.CurrentLayer.Surface)) { g.AppendPath (PintaCore.Layers.SelectionPath); g.FillRule = FillRule.EvenOdd; g.Clip (); g.SetSource (scratch_layer); g.Paint (); } selection_bounds.Inflate (5, 5); PintaCore.Workspace.Invalidate (selection_bounds); } }
protected override void OnMouseMove(object o, Gtk.MotionNotifyEventArgs args, Cairo.PointD point) { base.OnMouseMove (o, args, point); if (tracking) { UserBlendOps.NormalBlendOp normalBlendOp = new UserBlendOps.NormalBlendOp(); GradientRenderer gr = null; switch (GradientType) { case eGradientType.Linear: gr = new GradientRenderers.LinearClamped (GradientColorMode == eGradientColorMode.Transparency, normalBlendOp); break; case eGradientType.LinearReflected: gr = new GradientRenderers.LinearReflected (GradientColorMode == eGradientColorMode.Transparency, normalBlendOp); break; case eGradientType.Radial: gr = new GradientRenderers.Radial (GradientColorMode == eGradientColorMode.Transparency, normalBlendOp); break; case eGradientType.Diamond: gr = new GradientRenderers.LinearDiamond (GradientColorMode == eGradientColorMode.Transparency, normalBlendOp); break; case eGradientType.Conical: gr = new GradientRenderers.Conical (GradientColorMode == eGradientColorMode.Transparency, normalBlendOp); break; } if (button == 3) {//right gr.StartColor = PintaCore.Palette.SecondaryColor.ToColorBgra (); gr.EndColor = PintaCore.Palette.PrimaryColor.ToColorBgra (); } else {//1 left gr.StartColor = PintaCore.Palette.PrimaryColor.ToColorBgra (); gr.EndColor = PintaCore.Palette.SecondaryColor.ToColorBgra (); } gr.StartPoint = startpoint; gr.EndPoint = point; gr.AlphaBlending = UseAlphaBlending; gr.BeforeRender (); gr.Render (PintaCore.Layers.CurrentLayer.Surface, new Gdk.Rectangle[] {PintaCore.Layers.SelectionPath.GetBounds ()}); PintaCore.Workspace.Invalidate (); } }