renderer_alpha_blending_01.rml 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <rml>
  2. <head>
  3. <title>Alpha blending 01</title>
  4. <link type="text/rcss" href="../style.rcss"/>
  5. <meta name="Description" content="Test alpha blending of the renderer with different combinations of vertex colors and textures. Ensures that blending with premultiplied alpha is handled consistently." />
  6. <meta name="Backend" content="Requires backend support for rendering with shaders and filters, for all parts to render correctly." />
  7. <style>
  8. @spritesheet theme
  9. {
  10. src: /assets/invader.tga;
  11. white: 230px 210px 1px 1px; /* #fff */
  12. black: 421px 44px 1px 1px; /* #000 */
  13. transparent-white: 292px 284px 1px 1px; /* #ffffff80 */
  14. transparent-gray: 85px 201.5px 1px 1px; /* #80808099 */
  15. transparent-black: 190px 56.499px 1px 0.002px; /* #0000004d */
  16. }
  17. .white { background: #fff; }
  18. .gray { background: #808080; }
  19. .black { background: #000; }
  20. body > div {
  21. padding: 15px;
  22. border: 1px #000;
  23. display: flow-root;
  24. margin: 10px 0 30px;
  25. }
  26. body > div > div {
  27. width: 32px;
  28. height: 32px;
  29. border: 1px transparent;
  30. float: left;
  31. margin-right: 15px;
  32. }
  33. .white .background { background: #fff; }
  34. .white .background_alpha { background: #fff4; }
  35. .white .background_opacity { background: #fff; opacity: 0.25; }
  36. .white .sprite { decorator: image(white); }
  37. .white .sprite_transparent { decorator: image(transparent-white); }
  38. .white .sprite_image_color { decorator: image(white); image-color: #fff4; }
  39. .white .black_transparent { background: #0000; }
  40. .white .linear_gradient { decorator: linear-gradient(to right, #fff, transparent); }
  41. .white .horizontal_gradient { decorator: horizontal-gradient(#fff transparent); }
  42. .gray .background { background: #808080; }
  43. .gray .background_alpha { background: #80808044; }
  44. .gray .background_opacity { background: #808080; opacity: 0.25; }
  45. .gray .sprite { decorator: image(transparent-gray); }
  46. .gray .sprite_image_color { decorator: image(white); image-color: #808080;}
  47. .gray .filter { background: #fff; filter: contrast(0); }
  48. .gray .linear_gradient { decorator: linear-gradient(to right, #808080, transparent); }
  49. .gray .horizontal_gradient { decorator: horizontal-gradient(#808080 transparent); }
  50. .black .background { background: #000; }
  51. .black .background_alpha { background: #0004; }
  52. .black .background_opacity { background: #000; opacity: 0.25; }
  53. .black .sprite { decorator: image(transparent-black); }
  54. .black .sprite_image_color { decorator: image(white); image-color: #000;}
  55. .black .filter { background: #fff; filter: brightness(0); }
  56. .black .linear_gradient { decorator: linear-gradient(to right, #000, transparent); }
  57. .black .horizontal_gradient { decorator: horizontal-gradient(#000 transparent); }
  58. </style>
  59. </head>
  60. <body>
  61. The following box should be filled by perfect white.
  62. <div class="white">
  63. <div class="background"/>
  64. <div class="background_alpha"/>
  65. <div class="background_opacity"/>
  66. <div class="sprite"/>
  67. <div class="sprite_transparent"/>
  68. <div class="sprite_image_color"/>
  69. <div class="black_transparent"/>
  70. <div class="linear_gradient"/>
  71. <div class="horizontal_gradient"/>
  72. </div>
  73. The following box should be filled by a single gray color.
  74. <div class="gray">
  75. <div class="background"/>
  76. <div class="background_alpha"/>
  77. <div class="background_opacity"/>
  78. <div class="sprite"/>
  79. <div class="sprite_image_color"/>
  80. <div class="filter"/>
  81. <div class="linear_gradient"/>
  82. <div class="horizontal_gradient"/>
  83. </div>
  84. The following box should be filled by perfect black.
  85. <div class="black">
  86. <div class="background"/>
  87. <div class="background_alpha"/>
  88. <div class="background_opacity"/>
  89. <div class="sprite"/>
  90. <div class="sprite_image_color"/>
  91. <div class="filter"/>
  92. <div class="linear_gradient"/>
  93. <div class="horizontal_gradient"/>
  94. </div>
  95. </body>
  96. </rml>