|
DefineShape
TShape( id : Int, data : ShapeData );
enum ShapeData
{
SHDShape1(bounds : Rect, shapes : ShapeWithStyleData);
SHDShape2(bounds : Rect, shapes : ShapeWithStyleData);
SHDShape3(bounds : Rect, shapes : ShapeWithStyleData);
SHDShape4(data: Shape4Data);
//SHDOther(ver : Int, data : haxe.io.Bytes);
}
typedef Rect =
{
var left : Int;
var right : Int;
var top : Int;
var bottom : Int;
}
typedef ShapeWithStyleData =
{
var fillStyles : Array<FillStyle>;
var lineStyles : Array<LineStyle>;
var shapeRecords : Array<ShapeRecord>;
}
//-------------------------------------------------------------------------
enum FillStyle
{
FSSolid(rgb : RGB); // Shape1&2
FSSolidAlpha(rgb : RGBA); // Shape3 (&4?)
FSLinearGradient(mat : Matrix, grad : Gradient);
FSRadialGradient(mat : Matrix, grad : Gradient);
FSFocalGradient(mat : Matrix, grad : FocalGradient); // Shape4 only
FSBitmap(cid : Int, mat : Matrix, repeat : Bool, smooth : Bool);
}
//----------------
typedef LineStyle =
{
var width : Int;
var data : LineStyleData;
}
enum LineStyleData
{
LSRGB(rgb : RGB); //Shape1&2
LSRGBA(rgba : RGBA); //Shape3
LS2(data : LS2Data); //Shape4
}
//----------------
enum ShapeRecord
{
SHREnd;
SHRChange( data : ShapeChangeRec );
SHREdge( dx : Int, dy : Int);
SHRCurvedEdge( cdx : Int, cdy : Int, adx : Int, ady : Int );
}
typedef ShapeChangeRec =
{
var moveTo : Null<SCRMoveTo>;
var fillStyle0 : Null<SCRIndex>;
var fillStyle1 : Null<SCRIndex>;
var lineStyle : Null<SCRIndex>;
var newStyles : Null<SCRNewStyles>;
}
typedef SCRMoveTo =
{
var dx : Int;
var dy : Int;
}
typedef SCRIndex =
{
var idx : Int;
}
typedef SCRNewStyles =
{
var fillStyles : Array<FillStyle>;
var lineStyles : Array<LineStyle>;
}
|