BxArea.go 706 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. package bx
  2. type BxArea interface {
  3. Build() []byte
  4. Length() int16
  5. }
  6. type BaseArea struct {
  7. BxArea
  8. typ byte
  9. x uint16
  10. y uint16
  11. w uint16
  12. h uint16
  13. }
  14. func NewBxArea(typ byte, x uint16, y uint16, w uint16, h uint16) BaseArea {
  15. return BaseArea{
  16. typ: typ,
  17. x: x,
  18. y: y,
  19. w: w,
  20. h: h,
  21. }
  22. }
  23. func (a *BaseArea) GetX() uint16 {
  24. return a.x
  25. }
  26. func (a *BaseArea) SetX(x uint16) {
  27. a.x = x
  28. }
  29. func (a *BaseArea) GetY() uint16 {
  30. return a.y
  31. }
  32. func (a *BaseArea) SetY(y uint16) {
  33. a.y = y
  34. }
  35. func (a *BaseArea) GetW() uint16 {
  36. return a.w
  37. }
  38. func (a *BaseArea) SetW(w uint16) {
  39. a.w = w
  40. }
  41. func (a *BaseArea) GetH() uint16 {
  42. return a.h
  43. }
  44. func (a *BaseArea) SetH(h uint16) {
  45. a.h = h
  46. }