| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- package colorlight
- type Region struct {
- Layer string `json:"Layer"`
- Rect Rect `json:"Rect"`
- Items []interface{} `json:"Items"`
- }
- func (o *Region) SetData(layer string, rect *Rect) {
- o.Layer = layer
- o.Rect = *rect
- }
- func (o *Region) AddItemSingleLineText(
- Text, //文本内容
- TextColor, //文本显示颜色
- LfHeight, LfItalic, LfUnderline, LfFaceName, //文本显示字体
- IsScroll string, //文本是否滚动
- ) {
- item := ItemSingleLineText{
- Type: "4",
- TextColor: TextColor,
- LogFont: LogFont{
- LfHeight: LfHeight,
- LfWeight: "0",
- LfItalic: LfItalic,
- LfUnderline: LfUnderline,
- LfStrikeOut: "",
- LfFaceName: LfFaceName,
- },
- Text: Text,
- IsScroll: IsScroll,
- Speed: "60",
- IsScrollByTime: "0",
- IsHeadConnectTail: "0",
- RepeatCount: "1",
- PlayLenth: "",
- }
- o.Items = append(o.Items, item)
- }
- func (o *Region) AddItemMultiLineText(
- Text, //文本内容
- TextColor, //文本显示颜色
- LfHeight, LfItalic, LfUnderline, LfFaceName, //文本显示字体
- CenteralAlign, VerticalAlign, //对齐方式
- IsScroll string, //文本是否滚动
- ) {
- item := ItemMultiLineText{
- Type: "5",
- TextColor: TextColor,
- LogFont: LogFont{
- LfHeight: LfHeight,
- LfWeight: "0",
- LfItalic: LfItalic,
- LfUnderline: LfUnderline,
- LfStrikeOut: "",
- LfFaceName: LfFaceName,
- },
- CenteralAlign: CenteralAlign,
- VerticalAlign: VerticalAlign,
- Text: Text,
- IsScroll: IsScroll,
- Speed: "60",
- IsScrollByTime: "0",
- RepeatCount: "1",
- PlayLenth: "0",
- }
- o.Items = append(o.Items, item)
- }
- func (o *Region) AddItemPicture(filepath, duration, inEffectType string) {
- item := ItemPicture{
- Type: "2",
- FileSource: FileSource{
- FilePath: filepath,
- IsRelative: "1",
- },
- Duration: duration,
- InEffect: InEffect{
- Type: inEffectType,
- Time: "1000",
- },
- ReserveAS: "1",
- }
- o.Items = append(o.Items, item)
- }
- func (o *Region) AddItemVideo(filepath, Volume, duration string) {
- item := ItemVideo{
- Type: "3",
- Volume: Volume,
- Duration: duration,
- FileSource: FileSource{
- FilePath: filepath,
- IsRelative: "1",
- },
- ReserveAS: "1",
- }
- o.Items = append(o.Items, item)
- }
- func (o *Region) AddItemWebPage(url string, rect *Rect) {
- if rect == nil {
- rect = &o.Rect
- }
- item := ItemWebPage{
- Type: "27",
- Url: url,
- Rect: *rect,
- }
- o.Items = append(o.Items, item)
- }
|