Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
HSVA.cs
1using System;
2using System.Collections.Generic;
3using SkiaSharp;
8
10{
15 {
28 {
29 }
30
34 public override string[] DefaultArgumentNames
35 {
36 get
37 {
38 return new string[] { "H", "S", "V", "A" };
39 }
40 }
41
45 public override string FunctionName
46 {
47 get
48 {
49 return "HSVA";
50 }
51 }
52
60 {
61 double H = Expression.ToDouble(Arguments[0].AssociatedObjectValue);
62 double S = Expression.ToDouble(Arguments[1].AssociatedObjectValue);
63 double V = Expression.ToDouble(Arguments[2].AssociatedObjectValue);
64 int A = (int)(Expression.ToDouble(Arguments[3].AssociatedObjectValue) + 0.5);
65
66 H = Math.IEEERemainder(H, 360);
67 if (H < 0)
68 H += 360;
69
70 if (S < 0)
71 S = 0;
72 else if (S > 1)
73 S = 1;
74
75 if (V < 0)
76 V = 0;
77 else if (V > 1)
78 V = 1;
79
80 if (A < 0)
81 A = 0;
82 else if (A > 255)
83 A = 255;
84
85 return new ObjectValue(Graph.ToColorHSV(H, S, V, (byte)A));
86 }
87 }
88}
Class managing a script expression.
Definition: Expression.cs:39
static double ToDouble(object Object)
Converts an object to a double value.
Definition: Expression.cs:4824
Returns a color value using HSV coordinates, and an alpha component.
Definition: HSVA.cs:15
override string[] DefaultArgumentNames
Default Argument names
Definition: HSVA.cs:35
override string FunctionName
Name of the function
Definition: HSVA.cs:46
override IElement Evaluate(IElement[] Arguments, Variables Variables)
Evaluates the function.
Definition: HSVA.cs:59
HSVA(ScriptNode H, ScriptNode S, ScriptNode V, ScriptNode A, int Start, int Length, Expression Expression)
Returns a color value using HSV coordinates, and an alpha component.
Definition: HSVA.cs:26
Base class for graphs.
Definition: Graph.cs:79
static SKColor ToColorHSV(double H, double S, double V)
Creates a Color from its HSV representation.
Definition: Graph.cs:877
Base class for multivariate funcions.
ScriptNode[] Arguments
Function arguments.
static readonly ArgumentType[] argumentTypes4Scalar
Four scalar parameters.
Base class for all nodes in a parsed script tree.
Definition: ScriptNode.cs:69
int Length
Length of expression covered by node.
Definition: ScriptNode.cs:101
Expression Expression
Expression of which the node is a part.
Definition: ScriptNode.cs:177
int Start
Start position in script expression.
Definition: ScriptNode.cs:92
Collection of variables.
Definition: Variables.cs:25
Basic interface for all types of elements.
Definition: IElement.cs:20