models.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. // @ts-check
  2. // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
  3. // This file is automatically generated. DO NOT EDIT
  4. // eslint-disable-next-line @typescript-eslint/ban-ts-comment
  5. // @ts-ignore: Unused imports
  6. import { Create as $Create } from "@wailsio/runtime";
  7. /**
  8. * RGBA represents a traditional 32-bit alpha-premultiplied color, having 8
  9. * bits for each of red, green, blue and alpha.
  10. *
  11. * An alpha-premultiplied color component C has been scaled by alpha (A), so
  12. * has valid values 0 <= C <= A.
  13. */
  14. export class RGBA {
  15. /**
  16. * Creates a new RGBA instance.
  17. * @param {Partial<RGBA>} [$$source = {}] - The source object to create the RGBA.
  18. */
  19. constructor($$source = {}) {
  20. if (!("R" in $$source)) {
  21. /**
  22. * @member
  23. * @type {number}
  24. */
  25. this["R"] = 0;
  26. }
  27. if (!("G" in $$source)) {
  28. /**
  29. * @member
  30. * @type {number}
  31. */
  32. this["G"] = 0;
  33. }
  34. if (!("B" in $$source)) {
  35. /**
  36. * @member
  37. * @type {number}
  38. */
  39. this["B"] = 0;
  40. }
  41. if (!("A" in $$source)) {
  42. /**
  43. * @member
  44. * @type {number}
  45. */
  46. this["A"] = 0;
  47. }
  48. Object.assign(this, $$source);
  49. }
  50. /**
  51. * Creates a new RGBA instance from a string or object.
  52. * @param {any} [$$source = {}]
  53. * @returns {RGBA}
  54. */
  55. static createFrom($$source = {}) {
  56. let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
  57. return new RGBA(/** @type {Partial<RGBA>} */($$parsedSource));
  58. }
  59. }