programsinglelinetext.go 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. package colorlight
  2. type Style struct {
  3. I uint8 `json:"i"` //Italic
  4. B uint8 `json:"b"` //Bold
  5. U uint8 `json:"u"` //Underline
  6. }
  7. type Scroll struct {
  8. Dir string `json:"dir"`
  9. Isconnected string `json:"isconnected"`
  10. Speed string `json:"speed"`
  11. }
  12. type Font struct {
  13. Name string `json:"name"` //"隶书|楷体|黑体|宋体|仿宋|default", (For English please use default)
  14. Size int `json:"size"`
  15. Style Style `json:"style"`
  16. Color string `json:"color"`
  17. }
  18. //Quick Send Single-Line Text Program
  19. type ProgramSingleLineText struct {
  20. Text string `json:"text"` //节目内容
  21. X int `json:"x"`
  22. Y int `json:"y"`
  23. Width int `json:"width"`
  24. Height int `json:"height"`
  25. Font Font `json:"font"`
  26. Bgcolor string `json:"bgcolor"`
  27. Scroll Scroll `json:"scroll"`
  28. }
  29. func NewProgramSingleLineText(
  30. text string, //显示内容
  31. textColor, Bgcolor string, //显示颜色
  32. X, Y, width, height int, //显示位置
  33. fontname string, fontsize int, I, B, U uint8, //显示字体
  34. ScrollDir, Speed string, //滚动方向和速度
  35. ) *ProgramSingleLineText {
  36. return &ProgramSingleLineText{
  37. Text: text,
  38. X: X,
  39. Y: Y,
  40. Width: width,
  41. Height: height,
  42. Font: Font{
  43. Name: fontname,
  44. Size: fontsize,
  45. Style: Style{
  46. I: I,
  47. B: B,
  48. U: U,
  49. },
  50. Color: textColor,
  51. },
  52. Bgcolor: Bgcolor,
  53. Scroll: Scroll{
  54. Dir: ScrollDir,
  55. Isconnected: "0",
  56. Speed: Speed,
  57. },
  58. }
  59. }