Drawing Example


$enum+ class ELineCompoundType
{
    Single,
    Double,
    ThinThick,
    ThickThin,
    Triple
};

$enum+ class ELineCap
{
    Square,
    Flat,
    Round
};

$enum+ class ELineJoin
{
    Round,
    Bevel,
    Miter
};

$enum+ class ELineEndType
{
    None,
    Arrow,
    StealthArrow,
    OpenArrow,
    ClosedCircle,
    OpenCircle,
    CloseDiamond,
    OpenDiamond
};

$model+ MLineEndStyle
{
    ELineEndType Type;
    float32 Width : [range(0,100)];
    float32 Height : [range(0,100)];
    float32 Offset : [range(-100,10000)];
};

$model+ MStroke
{
    bool Enable;
    TColourHSLA Colour;
    float32 Width : [range(0,100)];
    float32 PatternScale : [range(0,100)];
    uint64 PatternMask : [hex, uppercase(true)];
    ELineCompoundType CompoundType;
    ELineCap Cap;
    ELineJoin Join;
    MLineEndStyle BeginStyle;
    MLineEndStyle MiddleStyle;
    MLineEndStyle EndStyle;
};

$struct+ MGeLine isa IPersistable :
    model
    {
        MStroke Stroke;
        ELineCompoundType CompoundType;
        ELineCap Cap;
        ELineJoin Join;
        MLineEndStyle BeginStyle;
        MLineEndStyle EndStyle;
        MLine2d Line : [range(0,10000)];
    }
{
};

$model+ MFill
{
    bool Enable;
    TColourHSLA Colour;
};

$model+ MPolygon
{
    xvector< MPoint2d > Vertices;
};

$struct+ MGePolygon isa IPersistable :
    model
    {
        MStroke Stroke;
        MFill Fill;
        MPolygon Polygon : [hidden];
    }
{
};

$enum+ class EPathVertexType
{
    Cusp,
    Smooth,
    Symmetric,
    AutoSmooth,
};

$enum+ class EPathVertexKind
{
    Continue,
    Open,
    Close
};

$struct+ PPathVertex isa IPersistable :
    model
    {
        EPathVertexType Type;
        assignable<MPoint2d> Pos;
        assignable<MPoint2d> Trail;
        assignable<MPoint2d> Lead;
        EPathVertexKind Kind;
    }
{
};

$struct+ PGePath isa IPersistable :
    model
    {
        MHomogTrans2d HomogTrans;
        MStroke Stroke;
        MFill Fill;
        xvector<movable<cref<PPathVertex>>> Vertices : [hidden];
    }
{
};

$struct+ MDrawingCanvas isa IPersistable :
    model
    {
        assignable<MBox2d> Window;
        xvector<movable<pref<IPersistable>>> Elements : [hidden];
        assignable<MPoint2d> Size;
        bool IsMutable;
        bool IsMutableTranslation;
        bool IsMutableScale;
        float32 Alpha : [range(0,1), fixed, precision(3)];
    }
{
};