[]
Represents a surface that can draw its views on a GcGraphics.
public class Surface
Initializes a new instance of the Surface object with a LayoutHost.
public Surface()
Gets the transformation matrix of the GcGraphics object when it was passed to the Render(GcGraphics) method.
Returns an identity matrix when checked outside of the Render(GcGraphics) method.
public Matrix3x2 BaseTransform { get; }
Gets the view that appears below all other views on this Surface.
public Layer BottomLayer { get; }
Gets the associated LayoutHost object.
public LayoutHost LayoutHost { get; }
Gets or sets the name of the Surface.
public string Name { get; set; }
Gets or sets an object that contains arbitrary data associated with this surface.
public object Tag { get; set; }
Gets or sets a value indicating whether a LayoutException should be thrown if the width or height of some LayoutRects becomes negative.
The default is true.
public bool ThrowIfNotFit { get; set; }
Gets the view that appears above all other views on this Surface.
public Layer TopLayer { get; }
Creates a View object that encapsulates a LayoutView and adds it as the top layer.
public View CreateView(float width, float height, Action<GcGraphics, Layer> draw)
width
floatThe width of the associated LayoutView.
height
floatThe height of the associated LayoutView.
draw
System.Action<T1, T2><GcGraphics, Layer>A delegate that accepts a GcGraphics object and a Layer, and draws the layer on the graphics.
Creates a View object that encapsulates a LayoutView and adds it as the top layer.
public View CreateView(float width, float height)
width
floatThe width of the associated LayoutView.
height
floatThe height of the associated LayoutView.
Returns the array of views on this Surface.
public View[] GetViews()
public bool PerformLayout()
true if successful, false if the width or height of any LayoutRect has become negative and the ThrowIfNotFit is false.
Draws this Surface on a specified GcGraphics object.
This method first calls PerformLayout(), if the call succeeds it then draws all layers starting with the bottom layer and going up. For each layer, it draws all visuals from the bottom to the top one, followed by drawing the layer's sub-layers. The process repeats until the topmost visual of the top layer has been drawn.
public bool Render(GcGraphics graphics)
graphics
GcGraphicsThe target GcGraphics object.
The result of executing the PerformLayout() method.
Returns a string that represents the current Surface.
public override string ToString()