1using System.Threading.Tasks;
26 : base(Document, Parent)
41 set => this.font = value;
50 set => this.pen = value;
58 get => this.background;
59 set => this.background = value;
67 get => this.textColor;
68 set => this.textColor = value;
76 get => this.background;
77 set => this.background = value;
84 public override Task
FromXml(XmlElement Input)
91 return base.FromXml(Input);
100 base.ExportAttributes(Output);
102 this.font?.
Export(Output);
104 this.background?.
Export(Output);
105 this.textColor?.
Export(Output);
116 return new Layout2D(Document, Parent);
125 base.CopyContents(Destination);
136 private Font fontDef =
null;
137 private Pen penDef =
null;
147 SKFont FontBak =
null;
148 SKPaint TextBak =
null;
149 SKPaint PenBak =
null;
150 SKPaint BackgroundBak =
null;
161 FontBak = State.
Font;
162 State.Font = this.fontDef.
FontDef;
164 TextBak = State.
Text;
165 State.Text = this.fontDef.
Text;
170 this.Document.TryGetElement(RefId.
Result, out Element) &&
180 this.Document.TryGetElement(RefId.
Result, out Element) &&
188 await base.DoMeasureDimensions(State);
190 if (!(FontBak is
null))
191 State.Font = FontBak;
193 if (!(TextBak is
null))
194 State.Text = TextBak;
196 if (!(PenBak is
null))
197 State.ShapePen = PenBak;
199 if (!(BackgroundBak is
null))
200 State.ShapeFill = BackgroundBak;
209 SKFont FontBak =
null;
210 SKPaint TextBak =
null;
211 SKPaint PenBak =
null;
212 SKPaint BackgroundBak =
null;
214 if (!(this.fontDef is
null))
216 FontBak = State.
Font;
217 State.Font = this.fontDef.
FontDef;
219 TextBak = State.
Text;
220 State.Text = this.fontDef.
Text;
223 if (!(this.penDef is
null))
226 State.ShapePen = this.penDef.
Paint;
229 if (!(this.backgroundDef is
null))
232 State.ShapeFill = this.backgroundDef.
Paint;
235 base.MeasurePositions(State);
237 if (!(FontBak is
null))
238 State.Font = FontBak;
240 if (!(TextBak is
null))
241 State.Text = TextBak;
243 if (!(PenBak is
null))
244 State.ShapePen = PenBak;
246 if (!(BackgroundBak is
null))
247 State.ShapeFill = BackgroundBak;
256 SKFont FontBak =
null;
257 SKPaint TextBak =
null;
258 SKPaint PenBak =
null;
259 SKPaint BackgroundBak =
null;
261 if (!(this.fontDef is
null))
263 FontBak = State.
Font;
264 State.Font = this.fontDef.
FontDef;
266 TextBak = State.
Text;
267 State.Text = this.fontDef.
Text;
270 if (!(this.penDef is
null))
273 State.ShapePen = this.penDef.
Paint;
276 if (!(this.backgroundDef is
null))
279 State.ShapeFill = this.backgroundDef.
Paint;
285 await base.Draw(State);
287 if (!(FontBak is
null))
288 State.Font = FontBak;
290 if (!(TextBak is
null))
291 State.Text = TextBak;
293 if (!(PenBak is
null))
294 State.ShapePen = PenBak;
296 if (!(BackgroundBak is
null))
297 State.ShapeFill = BackgroundBak;
306 base.ExportStateAttributes(Output);
Contains a 2D layout document.
void Export(XmlWriter Output)
Exports the attribute.
void ExportState(XmlWriter Output)
Exports the state of the attribute.
static async Task< EvaluationResult< T > > TryEvaluate(Attribute< T > Attribute, Variables Session)
Tries to evaluate the attribute value.
ColorAttribute CopyIfNotPreset(Layout2DDocument ForDocument)
Copies the attribute object if undefined, or defined by an expression. Returns a reference to itself,...
Result of asynchronous evaluation.
T Result
Evaluated result, if successful.
bool Ok
If evaluation was successful.
StringAttribute CopyIfNotPreset(Layout2DDocument ForDocument)
Copies the attribute object if undefined, or defined by an expression. Returns a reference to itself,...
Abstract base class for backgrounds.
Root node for two-dimensional layouts
override void ExportStateAttributes(XmlWriter Output)
Exports the local attributes of the current element.
StringAttribute PenIdAttribute
Pen ID
override void CopyContents(ILayoutElement Destination)
Copies contents (attributes and children) to the destination element.
override ILayoutElement Create(Layout2DDocument Document, ILayoutElement Parent)
Creates a new instance of the layout element.
ColorAttribute TextColorAttribute
Text Color
override void ExportAttributes(XmlWriter Output)
Exports attributes to XML.
StringAttribute BackgroundColorAttribute
Background Color
override async Task DoMeasureDimensions(DrawingState State)
Measures layout entities and defines unassigned properties, related to dimensions.
override Task FromXml(XmlElement Input)
Populates the element (including children) with information from its XML definition.
override async Task Draw(DrawingState State)
Draws layout entities.
StringAttribute BackgroundIdAttribute
Background ID
override void MeasurePositions(DrawingState State)
Measures layout entities and defines unassigned properties, related to positions.
override string LocalName
Local name of type of element.
StringAttribute FontIdAttribute
Font ID
Layout2D(Layout2DDocument Document, ILayoutElement Parent)
Root node for two-dimensional layouts
SKPaint Text
Current text paint settings
SKCanvas Canvas
Current drawing canvas.
float AreaWidth
Width of current area
float AreaHeight
Height of current area
Variables Session
Current session.
SKPaint ShapeFill
Fill to use for shape, if no other is specified in the shape.
SKPaint ShapePen
Pen to use for shape, if no other is specified in the shape.
Abstract base class for fonts.
SKFont FontDef
Measured Font
SKPaint Text
Measured Text
Abstract base class for layout containers (area elements containing embedded layout elements).
async Task MeasureDimensions(DrawingState State)
Measures layout entities and defines unassigned properties, related to dimensions....
Layout2DDocument Document
Layout document.
Abstract base class for pens.
Base interface for all layout elements.
Layout2DDocument Document
Layout document.