protected override void OnSetRenderInfo(PropertyBasedEffectConfigToken newToken, RenderArgs dstArgs, RenderArgs srcArgs) { int colorValue = newToken.GetProperty <Int32Property>(PropertyNames.Int32ColorWheel).Value; this.color = ColorBgra.FromOpaqueInt32(colorValue); base.OnSetRenderInfo(newToken, dstArgs, srcArgs); }
protected override void OnSetRenderInfo(PropertyBasedEffectConfigToken newToken, RenderArgs dstArgs, RenderArgs srcArgs) { this.thickness = newToken.GetProperty <Int32Property>(PropertyNames.Thickness).Value; this.intensity = newToken.GetProperty <Int32Property>(PropertyNames.Intensity).Value; base.OnSetRenderInfo(newToken, dstArgs, srcArgs); }
protected override void OnSetRenderInfo(PropertyBasedEffectConfigToken newToken, RenderArgs dstArgs, RenderArgs srcArgs) { this.radius = newToken.GetProperty <Int32Property>(PropertyNames.Radius).Value; this.percentile = newToken.GetProperty <Int32Property>(PropertyNames.Percentile).Value; base.OnSetRenderInfo(newToken, dstArgs, srcArgs); }
protected override void OnSetRenderInfo(PropertyBasedEffectConfigToken newToken, RenderArgs dstArgs, RenderArgs srcArgs) { this.angle = newToken.GetProperty <DoubleProperty>(PropertyNames.Angle).Value; this.weights = new double[3][]; for (int i = 0; i < this.weights.Length; ++i) { this.weights[i] = new double[3]; } // adjust and convert angle to radians double r = (double)this.angle * 2.0 * Math.PI / 360.0; // angle delta for each weight double dr = Math.PI / 4.0; // for r = 0 this builds an Relief filter pointing straight left this.weights[0][0] = Math.Cos(r + dr); this.weights[0][1] = Math.Cos(r + 2.0 * dr); this.weights[0][2] = Math.Cos(r + 3.0 * dr); this.weights[1][0] = Math.Cos(r); this.weights[1][1] = 1; this.weights[1][2] = Math.Cos(r + 4.0 * dr); this.weights[2][0] = Math.Cos(r - dr); this.weights[2][1] = Math.Cos(r - 2.0 * dr); this.weights[2][2] = Math.Cos(r - 3.0 * dr); base.OnSetRenderInfo(newToken, dstArgs, srcArgs); }
protected override void OnSetRenderInfo(PropertyBasedEffectConfigToken newToken, RenderArgs dstArgs, RenderArgs srcArgs) { this.amount = newToken.GetProperty <Int32Property>(PropertyNames.Amount).Value; this.offset = newToken.GetProperty <DoubleVectorProperty>(PropertyNames.Offset).Value; base.OnSetRenderInfo(newToken, dstArgs, srcArgs); }
protected override void OnSetRenderInfo2(PropertyBasedEffectConfigToken newToken, RenderArgs dstArgs, RenderArgs srcArgs) { this.amount = newToken.GetProperty <DoubleProperty>(PropertyNames.Amount).Value; base.Offset = newToken.GetProperty <DoubleVectorProperty>(PropertyNames.Offset).Value; base.EdgeBehavior = (WarpEdgeBehavior)newToken.GetProperty <StaticListChoiceProperty>(PropertyNames.EdgeBehavior).Value; base.Quality = newToken.GetProperty <Int32Property>(PropertyNames.Quality).Value; }
protected override void OnSetRenderInfo(PropertyBasedEffectConfigToken newToken, RenderArgs dstArgs, RenderArgs srcArgs) { this.radius = newToken.GetProperty <Int32Property>(PropertyNames.Radius).Value; this.strength = -0.2 * newToken.GetProperty <DoubleProperty>(PropertyNames.Strength).Value; base.OnSetRenderInfo(newToken, dstArgs, srcArgs); }
protected override void OnSetRenderInfo(PropertyBasedEffectConfigToken newToken, RenderArgs dstArgs, RenderArgs srcArgs) { this.radius = newToken.GetProperty <Int32Property>(PropertyName.Radius).Value; this.threshold = newToken.GetProperty <Int32Property>(PropertyName.Threshold).Value; this.intensityFunction = PrecalculateIntensityFunction(this.threshold); base.OnSetRenderInfo(newToken, dstArgs, srcArgs); }
protected override void OnSetRenderInfo(PropertyBasedEffectConfigToken newToken, RenderArgs dstArgs, RenderArgs srcArgs) { this.intensity = newToken.GetProperty <Int32Property>(PropertyNames.Intensity).Value; this.saturation = newToken.GetProperty <Int32Property>(PropertyNames.Saturation).Value; this.coverage = 0.01 * newToken.GetProperty <DoubleProperty>(PropertyNames.Coverage).Value; base.OnSetRenderInfo(newToken, dstArgs, srcArgs); }
protected override void OnSetRenderInfo(PropertyBasedEffectConfigToken newToken, RenderArgs dstArgs, RenderArgs srcArgs) { this.tolerance = newToken.GetProperty<Int32Property>(PropertyNames.Tolerance).Value; this.saturation = newToken.GetProperty<Int32Property>(PropertyNames.Saturation).Value; this.redEyeOp = new UnaryPixelOps.RedEyeRemove(this.tolerance, this.saturation); base.OnSetRenderInfo(newToken, dstArgs, srcArgs); }
protected override void OnSetRenderInfo(PropertyBasedEffectConfigToken newToken, RenderArgs dstArgs, RenderArgs srcArgs) { HistogramRgb histogram = new HistogramRgb(); histogram.UpdateHistogram(srcArgs.Surface, this.EnvironmentParameters.GetSelection(dstArgs.Bounds)); this.levels = histogram.MakeLevelsAuto(); base.OnSetRenderInfo(newToken, dstArgs, srcArgs); }
protected override void OnSetRenderInfo(PropertyBasedEffectConfigToken newToken, RenderArgs dstArgs, RenderArgs srcArgs) { int fragments = newToken.GetProperty <Int32Property>(PropertyNames.Fragments).Value; double rotation = newToken.GetProperty <DoubleProperty>(PropertyNames.Rotation).Value; int distance = newToken.GetProperty <Int32Property>(PropertyNames.Distance).Value; RecalcPointOffsets(fragments, rotation, distance); base.OnSetRenderInfo(newToken, dstArgs, srcArgs); }
protected override void OnSetRenderInfo(PropertyBasedEffectConfigToken newToken, RenderArgs dstArgs, RenderArgs srcArgs) { this.zoom = newToken.GetProperty <DoubleProperty>(PropertyNames.Zoom).Value; this.quality = newToken.GetProperty <Int32Property>(PropertyNames.Quality).Value; this.angle = newToken.GetProperty <DoubleProperty>(PropertyNames.Angle).Value; this.angleTheta = (this.angle * Math.PI * 2) / 360.0; this.factor = newToken.GetProperty <DoubleProperty>(PropertyNames.Factor).Value; base.OnSetRenderInfo(newToken, dstArgs, srcArgs); }
protected override void OnSetRenderInfo(PropertyBasedEffectConfigToken newToken, RenderArgs dstArgs, RenderArgs srcArgs) { double minRadiusP = newToken.GetProperty <DoubleProperty>(PropertyNames.MinScatterRadius).Value; this.minRadius = Math.Min(minRadiusP, Math.Min(srcArgs.Width, srcArgs.Height) / 2); this.maxRadius = newToken.GetProperty <DoubleProperty>(PropertyNames.MaxScatterRadius).Value; this.sampleCount = newToken.GetProperty <Int32Property>(PropertyNames.NumSamples).Value; base.OnSetRenderInfo(newToken, dstArgs, srcArgs); }
protected override void OnSetRenderInfo(PropertyBasedEffectConfigToken newToken, RenderArgs dstArgs, RenderArgs srcArgs) { int red = newToken.GetProperty <Int32Property>(PropertyNames.RedLevels).Value; int green = newToken.GetProperty <Int32Property>(PropertyNames.GreenLevels).Value; int blue = newToken.GetProperty <Int32Property>(PropertyNames.BlueLevels).Value; this.op = new PosterizePixelOp(red, green, blue); base.OnSetRenderInfo(newToken, dstArgs, srcArgs); }
protected override void OnSetRenderInfo(PropertyBasedEffectConfigToken newToken, RenderArgs dstArgs, RenderArgs srcArgs) { this.angle = newToken.GetProperty <DoubleProperty>(PropertyNames.Angle).Value; this.offsetX = newToken.GetProperty <DoubleVectorProperty>(PropertyNames.Offset).ValueX; this.offsetY = newToken.GetProperty <DoubleVectorProperty>(PropertyNames.Offset).ValueY; this.quality = newToken.GetProperty <Int32Property>(PropertyNames.Quality).Value; base.OnSetRenderInfo(newToken, dstArgs, srcArgs); }
protected override void OnSetRenderInfo(EffectConfigToken parameters, RenderArgs dstArgs, RenderArgs srcArgs) { lock (this) { this.gbToken = new PropertyBasedEffectConfigToken(this.gbProps); this.gbToken.SetPropertyValue(GaussianBlurEffect.PropertyNames.Radius, ((AmountEffectConfigToken)parameters).Amount); this.gbEffect.SetRenderInfo(this.gbToken, dstArgs, srcArgs); } base.OnSetRenderInfo(parameters, dstArgs, srcArgs); }
protected override void OnSetRenderInfo(PropertyBasedEffectConfigToken newToken, RenderArgs dstArgs, RenderArgs srcArgs) { this.inkOutline = newToken.GetProperty <Int32Property>(PropertyNames.InkOutline).Value; this.coloring = newToken.GetProperty <Int32Property>(PropertyNames.Coloring).Value; PropertyBasedEffectConfigToken glowToken = new PropertyBasedEffectConfigToken(this.glowProps); glowToken.SetPropertyValue(GlowEffect.PropertyNames.Radius, 6); glowToken.SetPropertyValue(GlowEffect.PropertyNames.Brightness, -(this.coloring - 50) * 2); glowToken.SetPropertyValue(GlowEffect.PropertyNames.Contrast, -(this.coloring - 50) * 2); this.glowEffect.SetRenderInfo(glowToken, dstArgs, srcArgs); base.OnSetRenderInfo(newToken, dstArgs, srcArgs); }
protected override sealed void OnSetRenderInfo(PropertyBasedEffectConfigToken newToken, RenderArgs dstArgs, RenderArgs srcArgs) { Rectangle selection = this.EnvironmentParameters.GetSelection(srcArgs.Bounds).GetBoundsInt(); this.defaultRadius = Math.Min(selection.Width, selection.Height) * 0.5; this.defaultRadius2 = this.defaultRadius * this.defaultRadius; this.defaultRadiusR = 1.0 / this.defaultRadius; this.width = selection.Width; this.height = selection.Height; OnSetRenderInfo2(newToken, dstArgs, srcArgs); this.xCenterOffset = selection.Left + (this.width * (1.0 + this.offset.First) * 0.5); this.yCenterOffset = selection.Top + (this.height * (1.0 + this.offset.Second) * 0.5); base.OnSetRenderInfo(newToken, dstArgs, srcArgs); }
protected override void OnSetRenderInfo(PropertyBasedEffectConfigToken newToken, RenderArgs dstArgs, RenderArgs srcArgs) { this.softness = newToken.GetProperty <Int32Property>(PropertyNames.Softness).Value; this.lighting = newToken.GetProperty <Int32Property>(PropertyNames.Lighting).Value; this.warmth = newToken.GetProperty <Int32Property>(PropertyNames.Warmth).Value; PropertyBasedEffectConfigToken blurToken = new PropertyBasedEffectConfigToken(this.blurProps); blurToken.SetPropertyValue(GaussianBlurEffect.PropertyNames.Radius, this.softness * 3); this.blurEffect.SetRenderInfo(blurToken, dstArgs, srcArgs); PropertyBasedEffectConfigToken bacToken = new PropertyBasedEffectConfigToken(this.bacProps); bacToken.SetPropertyValue(BrightnessAndContrastAdjustment.PropertyNames.Brightness, this.lighting); bacToken.SetPropertyValue(BrightnessAndContrastAdjustment.PropertyNames.Contrast, -this.lighting / 2); this.bacAdjustment.SetRenderInfo(bacToken, dstArgs, dstArgs); base.OnSetRenderInfo(newToken, dstArgs, srcArgs); }
//private PointF[] aaPointsArray; protected override void OnSetRenderInfo(PropertyBasedEffectConfigToken newToken, RenderArgs dstArgs, RenderArgs srcArgs) { this.rotation = -newToken.GetProperty <DoubleProperty>(PropertyNames.Rotation).Value; this.squareSize = newToken.GetProperty <DoubleProperty>(PropertyNames.SquareSize).Value; this.curvature = newToken.GetProperty <DoubleProperty>(PropertyNames.Curvature).Value; this.sin = (float)Math.Sin(this.rotation * Math.PI / 180.0); this.cos = (float)Math.Cos(this.rotation * Math.PI / 180.0); this.scale = (float)(Math.PI / this.squareSize); this.intensity = (float)(this.curvature * this.curvature / 10.0 * Math.Sign(this.curvature)); this.quality = newToken.GetProperty <Int32Property>(PropertyNames.Quality).Value; if (this.quality != 1) { ++this.quality; } base.OnSetRenderInfo(newToken, dstArgs, srcArgs); }
protected override void OnSetRenderInfo(PropertyBasedEffectConfigToken newToken, RenderArgs dstArgs, RenderArgs srcArgs) { this.offset = newToken.GetProperty <DoubleVectorProperty>(PropertyNames.Offset).Value; this.amount = newToken.GetProperty <DoubleProperty>(PropertyNames.Amount).Value; this.amount1 = 1d - amount; Rectangle bounds = this.EnvironmentParameters.GetSelection(srcArgs.Surface.Bounds).GetBoundsInt(); double width = bounds.Width; double height = bounds.Height; this.xCenterOffset = bounds.Left + (width * (1d + offset.First) * 0.5d); this.yCenterOffset = bounds.Top + (height * (1d + offset.Second) * 0.5d); this.radius = Math.Max(width, height) * 0.5d; this.radius *= newToken.GetProperty <DoubleProperty>(PropertyNames.Radius).Value; this.radius *= radius; this.radiusR = Math.PI / (8 * radius); base.OnSetRenderInfo(newToken, dstArgs, srcArgs); }
protected override void OnSetRenderInfo2(PropertyBasedEffectConfigToken newToken, RenderArgs dstArgs, RenderArgs srcArgs) { double scale = newToken.GetProperty <DoubleProperty>(PropertyNames.Scale).Value; double refraction = newToken.GetProperty <DoubleProperty>(PropertyNames.Refraction).Value; double detail1 = newToken.GetProperty <DoubleProperty>(PropertyNames.Roughness).Value; double detail2 = detail1; double roughness = detail2; double turbulence = newToken.GetProperty <DoubleProperty>(PropertyNames.Tension).Value; int quality = newToken.GetProperty <Int32Property>(PropertyNames.Quality).Value; byte newSeed = (byte)newToken.GetProperty <Int32Property>(PropertyNames.Seed).Value; this.seed = (byte)(this.instanceSeed ^ newSeed); this.scaleR = (400.0 / base.DefaultRadius) / scale; this.refractionScale = (refraction / 100.0) / scaleR; this.theta = Math.PI * 2.0 * turbulence / 10.0; this.roughness = roughness / 100.0; double detail3 = 1.0 + (detail2 / 10.0); // we don't want the perlin noise frequency components exceeding // the nyquist limit, so we will limit 'detail' appropriately double maxDetail = Math.Floor(Math.Log(this.scaleR) / Math.Log(0.5)); if (detail3 > maxDetail && maxDetail >= 1.0) { this.detail = maxDetail; } else { this.detail = detail3; } base.Quality = quality; base.OnSetRenderInfo2(newToken, dstArgs, srcArgs); }
protected override void OnSetRenderInfo(PropertyBasedEffectConfigToken newToken, RenderArgs dstArgs, RenderArgs srcArgs) { this.angle = newToken.GetProperty <DoubleProperty>(PropertyNames.Angle).Value; this.distance = newToken.GetProperty <Int32Property>(PropertyNames.Distance).Value; this.centered = newToken.GetProperty <BooleanProperty>(PropertyNames.Centered).Value; PointF start = new PointF(0, 0); double theta = ((double)(this.angle + 180) * 2 * Math.PI) / 360.0; double alpha = (double)distance; double x = alpha * Math.Cos(theta); double y = alpha * Math.Sin(theta); PointF end = new PointF((float)x, (float)(-y)); if (this.centered) { start.X = -end.X / 2.0f; start.Y = -end.Y / 2.0f; end.X /= 2.0f; end.Y /= 2.0f; } this.points = new PointF[((1 + this.distance) * 3) / 2]; if (this.points.Length == 1) { this.points[0] = new PointF(0, 0); } else { for (int i = 0; i < this.points.Length; ++i) { float frac = (float)i / (float)(this.points.Length - 1); this.points[i] = Utility.Lerp(start, end, frac); } } base.OnSetRenderInfo(newToken, dstArgs, srcArgs); }
protected override void OnSetRenderInfo(PropertyBasedEffectConfigToken newToken, RenderArgs dstArgs, RenderArgs srcArgs) { this.pencilTipSize = newToken.GetProperty <Int32Property>(PropertyNames.PencilTipSize).Value; this.colorRange = newToken.GetProperty <Int32Property>(PropertyNames.ColorRange).Value; PropertyBasedEffectConfigToken blurToken = new PropertyBasedEffectConfigToken(this.blurProps); blurToken.SetPropertyValue(GaussianBlurEffect.PropertyNames.Radius, this.pencilTipSize); this.blurEffect.SetRenderInfo(blurToken, dstArgs, srcArgs); PropertyBasedEffectConfigToken bacToken = new PropertyBasedEffectConfigToken(this.bacProps); bacToken.SetPropertyValue(BrightnessAndContrastAdjustment.PropertyNames.Brightness, this.colorRange); bacToken.SetPropertyValue(BrightnessAndContrastAdjustment.PropertyNames.Contrast, -this.colorRange); this.bacAdjustment.SetRenderInfo(bacToken, dstArgs, dstArgs); this.desaturateEffect.SetRenderInfo(null, dstArgs, dstArgs); this.invertEffect.SetRenderInfo(null, dstArgs, dstArgs); base.OnSetRenderInfo(newToken, dstArgs, srcArgs); }
protected override void OnSetRenderInfo(PropertyBasedEffectConfigToken newToken, RenderArgs dstArgs, RenderArgs srcArgs) { this.hue = newToken.GetProperty <Int32Property>(PropertyNames.Hue).Value; this.saturation = newToken.GetProperty <Int32Property>(PropertyNames.Saturation).Value; this.lightness = newToken.GetProperty <Int32Property>(PropertyNames.Lightness).Value; // map the range [0,100] -> [0,100] and the range [101,200] -> [103,400] //if (this.saturation > 100) { // this.saturation = ((this.saturation - 100) * 3) + 100; } if (this.hue == 0 && this.saturation == 100 && this.lightness == 0) { this.pixelOp = new UnaryPixelOps.Identity(); } else { this.pixelOp = new UnaryPixelOps.HueSaturationLightness(this.hue, this.saturation, this.lightness); } base.OnSetRenderInfo(newToken, dstArgs, srcArgs); }
protected override void OnSetRenderInfo(PropertyBasedEffectConfigToken newToken, RenderArgs dstArgs, RenderArgs srcArgs) { PropertyCollection blurValues = this.blurProps.Clone(); blurValues[GaussianBlurEffect.PropertyNames.Radius].Value = newToken.GetProperty <Int32Property>(PropertyNames.Radius).Value; PropertyBasedEffectConfigToken blurToken = new PropertyBasedEffectConfigToken(blurValues); this.blurEffect.SetRenderInfo(blurToken, dstArgs, srcArgs); PropertyCollection bcValues = this.bcProps.Clone(); bcValues[BrightnessAndContrastAdjustment.PropertyNames.Brightness].Value = newToken.GetProperty <Int32Property>(PropertyNames.Brightness).Value; bcValues[BrightnessAndContrastAdjustment.PropertyNames.Contrast].Value = newToken.GetProperty <Int32Property>(PropertyNames.Contrast).Value; PropertyBasedEffectConfigToken bcToken = new PropertyBasedEffectConfigToken(bcValues); this.bcAdjustment.SetRenderInfo(bcToken, dstArgs, dstArgs); // have to do adjustment in place, hence dstArgs for both 'args' parameters base.OnSetRenderInfo(newToken, dstArgs, srcArgs); }
protected override void OnSetRenderInfo(PropertyBasedEffectConfigToken newToken, RenderArgs dstArgs, RenderArgs srcArgs) { this.scale = newToken.GetProperty <Int32Property>(PropertyNames.Scale).Value; int intSeed = newToken.GetProperty <Int32Property>(PropertyNames.Seed).Value; this.seed = (byte)(intSeed ^ instanceSeed); this.power = newToken.GetProperty <DoubleProperty>(PropertyNames.Power).Value; Type blendOpType = (Type)newToken.GetProperty <StaticListChoiceProperty>(PropertyNames.BlendOp).Value; this.blendOp = UserBlendOps.CreateBlendOp(blendOpType); if (this.blendOp is UserBlendOps.NormalBlendOp && EnvironmentParameters.PrimaryColor.A == 255 && EnvironmentParameters.SecondaryColor.A == 255) { // this is just an optimization this.blendOp = null; } base.OnSetRenderInfo(newToken, dstArgs, srcArgs); }
protected virtual void OnSetRenderInfo2(PropertyBasedEffectConfigToken newToken, RenderArgs dstArgs, RenderArgs srcArgs) { }
protected override void OnSetRenderInfo(PropertyBasedEffectConfigToken newToken, RenderArgs dstArgs, RenderArgs srcArgs) { this.cellSize = newToken.GetProperty <Int32Property>(PropertyNames.CellSize).Value; base.OnSetRenderInfo(newToken, dstArgs, srcArgs); }