public TrainLoadCalculator(TrainLoadInput trainLoadInput) { this.trainLoadInput = trainLoadInput; this.gradient = new LinearGradient(this.trainLoadInput.MaxColor, this.trainLoadInput.MinColor, this.trainLoadInput.MiddleColor); this.femCalculator = new FEMCalculator(this.trainLoadInput); this.resultCreator = new ResultCreator(this.gradient, trainLoadInput.TimeSettings); }
public AudioSpectrumEffect(SoundDataProcessor dataProcessor, IGradient gradient) { this._dataProcessor = dataProcessor; _audioSpectrumBrush = new AudioSpectrumBrush(gradient); // Give this effect a high Z-Index to keep it in the foreground ZIndex = 10; }
/// <summary> /// Copies from another Function2D. /// </summary> public override void CopyFrom(Item src) { base.CopyFrom(src); Function2DItem f = (Function2DItem)src; Gradient = f.Gradient.Clone(); Source = f.Source; Compiler.Compile(this); }
private void DrawGradientItem(object sender, System.Windows.Forms.DrawItemEventArgs e) { e.DrawBackground(); if (e.Index >= 0 && e.Index < Gradients.List.Count) { IGradient g = Gradients.List[e.Index]; GradientPainter.FillRectangle(e.Graphics, g, e.Bounds, GradientPainter.Direction.Right); } e.DrawFocusRectangle(); }
public LabelRequestContext(Vector2 root, float radius, float speed, float angle, float timeToLive, IGradient color, string text) { this.root = root; this.radius = radius; this.speed = speed; this.angle = angle; this.timeToLive = timeToLive; this.color = color; this.text = text; }
public void Initialize(LabelRequestContext ctx) { text.sortingOrder = ++rendererPriority; velocity0 = ctx.speed * M.CosSinDeg(ctx.angle); tr.localPosition = loc = ctx.root + ctx.radius * M.CosSinDeg(ctx.angle); this.ttl = ctx.timeToLive; time = 0; gradient = ctx.color; text.text = ctx.text; SetColor(); }
//-------------------------------------------------------------------- public SpanGradient(ISpanInterpolator inter, IGradient gradient_function, IColorFunction color_function, double d1, double d2) { m_interpolator = inter; m_gradient_function = gradient_function; m_color_function = color_function; m_d1 = (Basics.Round(d1 * gradientSubpixelScale)); m_d2 = (Basics.Round(d2 * gradientSubpixelScale)); }
//-------------------------------------------------------------------- public span_gradient(ISpanInterpolator inter, IGradient gradient_function, IColorFunction color_function, double d1, double d2) { m_interpolator = inter; m_gradient_function = gradient_function; m_color_function = color_function; m_d1 = (agg_basics.iround(d1 * gradient_subpixel_scale)); m_d2 = (agg_basics.iround(d2 * gradient_subpixel_scale)); }
private static XElementBuilder BuildGradientElement(IGradient gradient) { if (gradient is LinearGradient linearGradient) { return(BuildLinearGradientElement(linearGradient)); } if (gradient is RadialGradient radialGradient) { return(BuildRadialGradient(radialGradient)); } throw new GradientNotSupportedException(gradient.GetType()); }
private SKShader GetShader(IGradient gradient, DrawContext context) { if (gradient is ILinearGradient linear) { return(_linearPainter.CreateShader(linear, context)); } if (gradient is IRadialGradient radial) { return(_radialPainter.CreateShader(radial, context)); } throw new ArgumentException("Type not supported"); }
private Paint GetPaint(IGradient gradient, DrawContext context) { if (gradient is ILinearGradient linear) { return(CreateLinearPaint(linear, context)); } if (gradient is IRadialGradient radial) { return(CreateRadialPaint(radial, context)); } return(new SolidPaint(Colors.Black)); }
private void LowerClick(object sender, EventArgs e) { IGradient g = gradientChooser.SelectedGradient; if (g is LinearGradient) { LinearGradient lg = (LinearGradient)g; colorDialog.ShowDialog(); lg.UpperColor = colorDialog.Color; lowerColor.BackColor = colorDialog.Color; Gradients.LinearGradient.LowerColor = colorDialog.Color; gradientChooser.Refresh(); } }
public void Reset() { if (oldItem == null) { dimensions = Dimensions.One; fSource.Text = "return 0;"; } else { if (oldItem is Function1DItem) { SetDimensions(Dimensions.One); } else if (oldItem is Function2DItem) { SetDimensions(Dimensions.Two); } else if (oldItem is FunctionColorItem) { SetDimensions(Dimensions.TwoColor); } else { throw new System.ApplicationException("invalid item-type"); } name.Text = oldItem.Name; this.Text = oldItem.Name; if (oldItem is Function1DItem) { Function1DItem f1 = (Function1DItem)oldItem; fSource.Text = f1.Source; style.Color = f1.Color; style.LineWidth = f1.LineWidth; style.LineStyle = f1.LineStyle; } else if (oldItem is Function2DItem) { Function2DItem f1 = (Function2DItem)oldItem; fSource.Text = f1.Source; Gradient = f1.Gradient; } else if (oldItem is FunctionColorItem) { FunctionColorItem f1 = (FunctionColorItem)oldItem; fSource.Text = f1.Source; } } }
private void StyleClick(object sender, EventArgs e) { if (dimensions == Dimensions.One) { style.Name = name.Text; FunctionLineStyleForm.New(Model, style); } else if (dimensions == Dimensions.Two) { Gradient = GradientForm.ShowDialog(); Model.Items.Update(f); } else { Debug.Fail("No Style for Color function"); } }
protected PaintGradientStop[] GetRenderStops(IGradient gradient) { var stops = gradient.GetStops(); if (stops.Count == 1) { return(new[] { new PaintGradientStop(0, stops[0].Color), new PaintGradientStop(1, stops[0].Color) }); } return(stops .OrderBy(x => x.RenderOffset) .Select(x => new PaintGradientStop(x.RenderOffset, x.Color)) .ToArray()); }
public void FillRectangle(RectangleF rectangle, IGradient gradient) { Contract.Requires <ArgumentException>(!rectangle.IsEmpty); Contract.Requires <ArgumentException>(gradient != null); float[] widthSegments; float[] heightSegments; switch (gradient.Type) { default: case GradientType.Uniform: widthSegments = new float[] { 0, 1 }; heightSegments = new float[] { 0, 1 }; break; case GradientType.LinearVerticalGradient: widthSegments = (from gs in gradient.GradientStops select gs.Offset).ToArray(); heightSegments = new float[] { 0, 1 }; break; } ushort[] indices; Vector4[] vertices = CreateRectangleMesh(rectangle, widthSegments, heightSegments, out indices); Color4[] colors = new Color4[vertices.Length]; for (int i = 0; i < colors.Length; i++) { colors[i] = Color.BlueViolet; } VertexPositionColor[] vertexArray = (from vertex in vertices from color in colors select new VertexPositionColor() { Position = vertex, Color = color }).ToArray(); shapes.Add(new ShapeMeshDescription() { Vertices = vertexArray, Indices = indices }); }
protected IGradientStop[] GetRenderStops(IGradient gradient) { var stops = gradient.GetStops(); if (stops.Count == 1) { return(new[] { new GradientStop { RenderOffset = 0, Color = stops[0].Color }, new GradientStop { RenderOffset = 1, Color = stops[0].Color } }); } return(stops.OrderBy(x => x.RenderOffset).ToArray()); }
public void SetControlledObject(object item) { try { if (item != null && item is IGradient) { m_Item = (IGradient)item; FillControls(); if (item is IChangeNotify) { ((IChangeNotify)item).ItemChanged += External_ItemChanged; } this.Enabled = true; } else { ClearControls(); this.Enabled = false; } } catch (System.Exception) { } }
public static void GradientHelpers() { IGradient g = EvenlySpaced(Color.red, Color.blue); ColorEq(g.Evaluate(0f), Color.red); ColorEq(g.Evaluate(1f), Color.blue); var gr = g.Reverse(); ColorEq(gr.Evaluate(0f), Color.blue); ColorEq(gr.Evaluate(1f), Color.red); var gsr = gr.RemapTime(0.2f, 0.7f); ColorEq(gsr.Evaluate(0), Color.Lerp(Color.blue, Color.red, 0.2f)); ColorEq(gsr.Evaluate(1), Color.Lerp(Color.blue, Color.red, 0.7f)); ColorEq(gsr.Evaluate(0.5f), Color.Lerp(Color.blue, Color.red, 0.45f)); Assert.IsTrue(gsr is DGradient); var red0 = new Color(1f, 0, 0, 0); g = EvenlySpaced(red0, Color.blue); //Alpha in color DOES matter as fallback ColorEq(g.Evaluate(0f), Color.red.WithA(0f)); ColorEq(g.Evaluate(1f), Color.blue); g = FromKeys(new[] { new GradientColorKey(Color.red, 0f), new GradientColorKey(Color.blue, 1f) }, new[] { new GradientAlphaKey(0f, 0f), new GradientAlphaKey(1f, 1f) }); ColorEq(g.Evaluate(0f), red0); ColorEq(g.Evaluate(1f), Color.blue); g = g.RemapTime(0.2f, 0.7f); ColorEq(g.Evaluate(0), Color.Lerp(red0, Color.blue, 0.2f)); ColorEq(g.Evaluate(1), Color.Lerp(red0, Color.blue, 0.7f)); ColorEq(g.Evaluate(0.5f), Color.Lerp(red0, Color.blue, 0.45f)); g = g.RemapTime(0f, 2f); ColorEq(g.Evaluate(0), Color.Lerp(red0, Color.blue, 0.2f)); ColorEq(g.Evaluate(1), Color.Lerp(red0, Color.blue, 0.7f)); ColorEq(g.Evaluate(0.5f), Color.Lerp(red0, Color.blue, 0.7f)); Assert.IsTrue(g is DGradient); }
public gradient_reflect_adaptor(IGradient gradient) { m_gradient = gradient; }
public GradientReflectAdaptor(IGradient gradient) { m_gradient = gradient; }
public GradientClampAdaptor(IGradient gradient) { m_gradient = gradient; }
public gradient_clamp_adaptor(IGradient gradient) { m_gradient = gradient; }
public GradientRepeatAdaptor(IGradient gradient) { m_gradient = gradient; }
/// <summary> /// Initializes a new instance of the <see cref="ConicalGradientBrush"/> class. /// </summary> /// <param name="center">The center point (as percentage in the range [0..1]).</param> /// <param name="origin">The origin (radian-angle) the brush is drawn to.</param> /// <param name="gradient">The gradient drawn by the brush.</param> public ConicalGradientBrush(PointF center, float origin, IGradient gradient) { this.Center = center; this.Origin = origin; this.Gradient = gradient; }
public void gradient_function(IGradient gf) { m_gradient_function = gf; }
/// <summary> /// Initializes a new instance of the <see cref="RadialGradientBrush"/> class. /// </summary> /// <param name="center">The center point (as percentage in the range [0..1]).</param> /// <param name="gradient">The gradient drawn by the brush.</param> public RadialGradientBrush(PointF center, IGradient gradient) { this.Center = center; this.Gradient = gradient; }
/// <summary> /// Initializes a new instance of the <see cref="ConicalGradientBrush"/> class. /// </summary> /// <param name="center">The center point (as percentage in the range [0..1]).</param> /// <param name="gradient">The gradient drawn by the brush.</param> public ConicalGradientBrush(PointF center, IGradient gradient) { this.Center = center; this.Gradient = gradient; }
// default values for start/end are fine public AudioSpectrumBrush(IGradient gradient) : base(gradient) { }
/// <summary> /// Initializes a new instance of the <see cref="RadialGradientBrush"/> class. /// </summary> /// <param name="gradient">The gradient drawn by the brush.</param> public RadialGradientBrush(IGradient gradient) { this.Gradient = gradient; }
public gradient_repeat_adaptor(IGradient gradient) { m_gradient = gradient; }
public LinearGradientBrush(IGradient gradient) { this.Gradient = gradient; }
/// <inheritdoc /> /// <summary> /// Initializes a new instance of the <see cref="T:RGB.NET.Brushes.LinearGradientBrush" /> class. /// </summary> /// <param name="startPoint">The start <see cref="T:RGB.NET.Core.Point" /> (as percentage in the range [0..1]).</param> /// <param name="endPoint">The end <see cref="T:RGB.NET.Core.Point" /> (as percentage in the range [0..1]).</param> /// <param name="gradient">The <see cref="T:RGB.NET.Brushes.Gradients.IGradient" /> drawn by this <see cref="T:RGB.NET.Brushes.LinearGradientBrush" />.</param> public LinearGradientBrush(Point startPoint, Point endPoint, IGradient gradient) { this.StartPoint = startPoint; this.EndPoint = endPoint; this.Gradient = gradient; }
/// <inheritdoc /> /// <summary> /// Initializes a new instance of the <see cref="T:RGB.NET.Brushes.LinearGradientBrush" /> class. /// </summary> /// <param name="gradient">The <see cref="T:RGB.NET.Brushes.Gradients.IGradient" /> drawn by this <see cref="T:RGB.NET.Brushes.LinearGradientBrush" />.</param> public LinearGradientBrush(IGradient gradient) { this.Gradient = gradient; }
public ColorProvider(IGradient gradient, double max, double min) { this.gradient = gradient; this.max = max; this.min = min; }
public GradientRepeatAdaptor(IGradient gradient) { m_gradient= gradient; }
public LinearGradientBrush(PointF startPoint, PointF endPoint, IGradient gradient) { this.StartPoint = startPoint; this.EndPoint = endPoint; this.Gradient = gradient; }
// default values for start/end are fine public AudioSpectrumBrush(SoundDataProcessor soundDataProcessor, IGradient gradient) : base(gradient) { this._soundDataProcessor = soundDataProcessor; }