2using System.Threading.Tasks;
27 : base(Document, Parent)
42 set => this.font = value;
51 set => this.pen = value;
59 get => this.background;
60 set => this.background = value;
68 get => this.textColor;
69 set => this.textColor = value;
77 get => this.background;
78 set => this.background = value;
85 public override Task
FromXml(XmlElement Input)
92 return base.FromXml(Input);
101 base.ExportAttributes(Output);
103 this.font?.
Export(Output);
105 this.background?.
Export(Output);
106 this.textColor?.
Export(Output);
117 return new Layout2D(Document, Parent);
126 base.CopyContents(Destination);
137 private Font fontDef =
null;
138 private Pen penDef =
null;
148 SKFont FontBak =
null;
149 SKPaint TextPenBak =
null;
150 SKPaint PenBak =
null;
151 SKPaint BackgroundBak =
null;
162 FontBak = State.
Font;
163 State.Font = this.fontDef.
FontDef;
166 State.TextPen = this.fontDef.
TextPen;
171 this.Document.TryGetElement(RefId.
Result, out Element) &&
181 this.Document.TryGetElement(RefId.
Result, out Element) &&
189 await base.DoMeasureDimensions(State);
191 if (!(FontBak is
null))
192 State.Font = FontBak;
194 if (!(TextPenBak is
null))
195 State.TextPen = TextPenBak;
197 if (!(PenBak is
null))
198 State.ShapePen = PenBak;
200 if (!(BackgroundBak is
null))
201 State.ShapeFill = BackgroundBak;
210 SKFont FontBak =
null;
211 SKPaint TextPenBak =
null;
212 SKPaint PenBak =
null;
213 SKPaint BackgroundBak =
null;
215 if (!(this.fontDef is
null))
217 FontBak = State.
Font;
218 State.Font = this.fontDef.
FontDef;
221 State.TextPen = this.fontDef.
TextPen;
224 if (!(this.penDef is
null))
227 State.ShapePen = this.penDef.
Paint;
230 if (!(this.backgroundDef is
null))
233 State.ShapeFill = this.backgroundDef.
Paint;
236 base.MeasurePositions(State);
238 if (!(FontBak is
null))
239 State.Font = FontBak;
241 if (!(TextPenBak is
null))
242 State.TextPen = TextPenBak;
244 if (!(PenBak is
null))
245 State.ShapePen = PenBak;
247 if (!(BackgroundBak is
null))
248 State.ShapeFill = BackgroundBak;
257 SKFont FontBak =
null;
258 SKPaint TextPenBak =
null;
259 SKPaint PenBak =
null;
260 SKPaint BackgroundBak =
null;
262 if (!(this.fontDef is
null))
264 FontBak = State.
Font;
265 State.Font = this.fontDef.
FontDef;
268 State.TextPen = this.fontDef.
TextPen;
271 if (!(this.penDef is
null))
274 State.ShapePen = this.penDef.
Paint;
277 if (!(this.backgroundDef is
null))
280 State.ShapeFill = this.backgroundDef.
Paint;
286 await base.Draw(State);
288 if (!(FontBak is
null))
289 State.Font = FontBak;
291 if (!(TextPenBak is
null))
292 State.TextPen = TextPenBak;
294 if (!(PenBak is
null))
295 State.ShapePen = PenBak;
297 if (!(BackgroundBak is
null))
298 State.ShapeFill = BackgroundBak;
307 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.
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 TextPen
Current text paint settings
SKPaint ShapePen
Pen to use for shape, if no other is specified in the shape.
Abstract base class for fonts.
SKFont FontDef
Measured Font
Root node for two-dimensional layouts
StringAttribute FontIdAttribute
Font ID
StringAttribute BackgroundColorAttribute
Background Color
override void MeasurePositions(DrawingState State)
Measures layout entities and defines unassigned properties, related to positions.
override async Task Draw(DrawingState State)
Draws layout entities.
override void ExportAttributes(XmlWriter Output)
Exports attributes to XML.
StringAttribute BackgroundIdAttribute
Background ID
override ILayoutElement Create(Layout2DDocument Document, ILayoutElement Parent)
Creates a new instance of the layout element.
override string LocalName
Local name of type of element.
ColorAttribute TextColorAttribute
Text Color
StringAttribute PenIdAttribute
Pen ID
override void CopyContents(ILayoutElement Destination)
Copies contents (attributes and children) to the destination element.
override async Task DoMeasureDimensions(DrawingState State)
Measures layout entities and defines unassigned properties, related to dimensions.
override void ExportStateAttributes(XmlWriter Output)
Exports the local attributes of the current element.
Layout2D(Layout2DDocument Document, ILayoutElement Parent)
Root node for two-dimensional layouts
override Task FromXml(XmlElement Input)
Populates the element (including children) with information from its XML definition.
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.