Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
Canvas3D.cs
1using SkiaSharp;
2using System;
6
8{
13 {
24 public Canvas3D(ScriptNode Width, ScriptNode Height, ScriptNode Oversampling,
25 ScriptNode BackgroupColor, int Start, int Length, Expression Expression)
26 : base(new ScriptNode[] { Width, Height, Oversampling, BackgroupColor },
28 {
29 }
30
34 public override string FunctionName => nameof(Canvas3D);
35
39 public override string[] DefaultArgumentNames => new string[]
40 {
41 "Width",
42 "Height",
43 "Oversampling",
44 "BackgroundColor"
45 };
46
54 {
55 int Width = (int)Expression.ToDouble(Arguments[0].AssociatedObjectValue);
56 int Height = (int)Expression.ToDouble(Arguments[1].AssociatedObjectValue);
57 int Oversampling = (int)Expression.ToDouble(Arguments[2].AssociatedObjectValue);
58 SKColor BackgroundColor = Graphs.Graph.ToColor(Arguments[3].AssociatedObjectValue);
59
60 if (Width <= 0)
61 throw new ScriptRuntimeException("Invalid width.", this);
62
63 if (Height <= 0)
64 throw new ScriptRuntimeException("Invalid height.", this);
65
66 if (Oversampling <= 0)
67 throw new ScriptRuntimeException("Invalid oversampling.", this);
68
69 return new Graphs3D.Canvas3D(Variables, Width, Height, Oversampling, BackgroundColor);
70 }
71 }
72}
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
Generates a Graphs3D.Canvas3D object.
Definition: Canvas3D.cs:13
override IElement Evaluate(IElement[] Arguments, Variables Variables)
Evaluates the function.
Definition: Canvas3D.cs:53
Canvas3D(ScriptNode Width, ScriptNode Height, ScriptNode Oversampling, ScriptNode BackgroupColor, int Start, int Length, Expression Expression)
Generates a Graphs3D.Canvas3D object.
Definition: Canvas3D.cs:24
override string[] DefaultArgumentNames
Default Argument names
Definition: Canvas3D.cs:39
override string FunctionName
Name of the function
Definition: Canvas3D.cs:34
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