2using System.Threading.Tasks;
32 : base(
Variables, DefaultWidth, DefaultHeight)
42 : base(
Variables, Pixels.Width, Pixels.Height)
53 : base(
Settings, Pixels.Width, Pixels.Height)
69 if (!(this.pixels is
null))
71 Settings.Width = this.pixels.
Width;
72 Settings.Height = this.pixels.
Height;
77 using (SKSurface Surface = SKSurface.Create(
new SKImageInfo(Math.Max(Pixels.
Width,
this.pixels?.Width ?? 0),
78 Math.Max(Pixels.
Height,
this.pixels?.Height ?? 0), SKImageInfo.PlatformColorType, SKAlphaType.Premul)))
80 SKCanvas Canvas = Surface.Canvas;
84 Canvas.DrawImage(Bmp, 0, 0);
87 if (!(this.pixels is
null))
91 Canvas.DrawImage(Image, 0, 0);
95 using (SKImage Result = Surface.Snapshot())
113 if (!(this.pixels is
null))
115 Settings.Width = this.pixels.
Width;
116 Settings.Height = this.pixels.
Height;
121 using (SKSurface Surface = SKSurface.Create(
new SKImageInfo(Math.Max(Pixels.
Width,
this.pixels?.Width ?? 0),
122 Math.Max(Pixels.
Height,
this.pixels?.Height ?? 0), SKImageInfo.PlatformColorType, SKAlphaType.Premul)))
124 SKCanvas Canvas = Surface.Canvas;
126 if (!(this.pixels is
null))
130 Canvas.DrawImage(Image, 0, 0);
136 Canvas.DrawImage(Bmp, 0, 0);
139 using (SKImage Result = Surface.Snapshot())
155 States =
new object[0];
166 return new Tuple<int, int>(this.pixels?.Width ?? 0, this.pixels?.Height ?? 0);
185 return (obj is
GraphBitmap B && (this.pixels?.
Equals(B.pixels) ?? (B.pixels is
null)));
191 return this.pixels?.GetHashCode() ?? 0;
207 if (!(this.pixels is
null))
209 Output.WriteStartElement(
"GraphBitmap");
210 Output.WriteAttributeString(
"width", this.pixels.
Width.ToString());
211 Output.WriteAttributeString(
"height", this.pixels.
Height.ToString());
213 Output.WriteElementString(
"Png", Convert.ToBase64String(
this.pixels.EncodeAsPng()));
215 Output.WriteEndElement();
225 int Width =
int.Parse(Xml.GetAttribute(
"width"));
226 int Height =
int.Parse(Xml.GetAttribute(
"height"));
228 foreach (XmlNode N
in Xml.ChildNodes)
230 if (N is XmlElement E && E.LocalName ==
"Png")
232 byte[] Data = Convert.FromBase64String(E.InnerText);
238 return Task.CompletedTask;
Base class for all types of elements.
Class managing a script expression.
static string ToString(double Value)
Converts a value to a string, that can be parsed as part of an expression.
Handles bitmap-based graphs.
override bool Equals(object obj)
Compares the element to another. If elements are equal.
override Tuple< int, int > RecommendedBitmapSize
The recommended bitmap size of the graph, if such is available.
GraphBitmap(Variables Variables)
Handles bitmap-based graphs.
override ISemiGroupElement AddRight(ISemiGroupElement Element)
Tries to add an element to the current element, from the right.
GraphBitmap(Variables Variables, PixelInformation Pixels)
Handles bitmap-based graphs.
override void ExportGraph(XmlWriter Output)
Exports graph specifics to XML.
override int GetHashCode()
Calculates a hash code of the element. Hash code.
override Task ImportGraphAsync(XmlElement Xml)
Imports graph specifics from XML.
override ISemiGroupElement AddLeft(ISemiGroupElement Element)
Tries to add an element to the current element, from the left.
override bool UsesDefaultColor
If graph uses default color
override bool TrySetDefaultColor(SKColor Color)
Tries to set the default color.
GraphBitmap(GraphSettings Settings, PixelInformation Pixels)
Handles bitmap-based graphs.
override string GetBitmapClickScript(double X, double Y, object[] States)
Gets script corresponding to a point in a generated bitmap representation of the graph.
override PixelInformation CreatePixels(GraphSettings Settings, out object[] States)
Creates a bitmap of the graph.
GraphBitmap(Variables Variables, int? DefaultWidth, int? DefaultHeight)
Handles bitmap-based graphs.
void Dispose()
IDisposable.Dispose
GraphSettings Settings
Graph settings available during creation.
Basic interface for all types of semigroup elements.