智慧水务管理系统 - 精河县供水工程综合管理平台

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. // @ts-check
  2. import BlendEquation from "./BlendEquation.js";
  3. import BlendFunction from "./BlendFunction.js";
  4. /**
  5. * The blending state combines {@link BlendEquation} and {@link BlendFunction} and the
  6. * <code>enabled</code> flag to define the full blending state for combining source and
  7. * destination fragments when rendering.
  8. * <p>
  9. * This is a helper when using custom render states with {@link Appearance#renderState}.
  10. * </p>
  11. *
  12. * @namespace
  13. */
  14. const BlendingState = {
  15. /**
  16. * Blending is disabled.
  17. *
  18. * @type {object}
  19. * @constant
  20. */
  21. DISABLED: Object.freeze({
  22. enabled: false,
  23. }),
  24. /**
  25. * Blending is enabled using alpha blending, <code>source(source.alpha) + destination(1 - source.alpha)</code>.
  26. *
  27. * @type {object}
  28. * @constant
  29. */
  30. ALPHA_BLEND: Object.freeze({
  31. enabled: true,
  32. equationRgb: BlendEquation.ADD,
  33. equationAlpha: BlendEquation.ADD,
  34. functionSourceRgb: BlendFunction.SOURCE_ALPHA,
  35. functionSourceAlpha: BlendFunction.ONE,
  36. functionDestinationRgb: BlendFunction.ONE_MINUS_SOURCE_ALPHA,
  37. functionDestinationAlpha: BlendFunction.ONE_MINUS_SOURCE_ALPHA,
  38. }),
  39. /**
  40. * Blending is enabled using alpha blending with premultiplied alpha, <code>source + destination(1 - source.alpha)</code>.
  41. *
  42. * @type {object}
  43. * @constant
  44. */
  45. PRE_MULTIPLIED_ALPHA_BLEND: Object.freeze({
  46. enabled: true,
  47. equationRgb: BlendEquation.ADD,
  48. equationAlpha: BlendEquation.ADD,
  49. functionSourceRgb: BlendFunction.ONE,
  50. functionSourceAlpha: BlendFunction.ONE,
  51. functionDestinationRgb: BlendFunction.ONE_MINUS_SOURCE_ALPHA,
  52. functionDestinationAlpha: BlendFunction.ONE_MINUS_SOURCE_ALPHA,
  53. }),
  54. /**
  55. * Blending is enabled using additive blending, <code>source(source.alpha) + destination</code>.
  56. *
  57. * @type {object}
  58. * @constant
  59. */
  60. ADDITIVE_BLEND: Object.freeze({
  61. enabled: true,
  62. equationRgb: BlendEquation.ADD,
  63. equationAlpha: BlendEquation.ADD,
  64. functionSourceRgb: BlendFunction.SOURCE_ALPHA,
  65. functionSourceAlpha: BlendFunction.ONE,
  66. functionDestinationRgb: BlendFunction.ONE,
  67. functionDestinationAlpha: BlendFunction.ONE,
  68. }),
  69. };
  70. Object.freeze(BlendingState);
  71. export default BlendingState;