diff options
author | 2022-02-25 19:29:20 +0100 | |
---|---|---|
committer | 2022-02-25 19:29:32 +0100 | |
commit | d196d072ff54277a7c3ad0c5048f8fdc6b7e18c8 (patch) | |
tree | 57a626d3764d1e650dff09f6783ab46f5d80b7e3 /src/emu/rendlay.cpp | |
parent | 45b02a490f066feb186df56b83c5c19c5499bff5 (diff) |
rendlay: add optional alpha attribute to digit elements
Diffstat (limited to 'src/emu/rendlay.cpp')
-rw-r--r-- | src/emu/rendlay.cpp | 52 |
1 files changed, 41 insertions, 11 deletions
diff --git a/src/emu/rendlay.cpp b/src/emu/rendlay.cpp index 88cc161e22f..b312637c0a9 100644 --- a/src/emu/rendlay.cpp +++ b/src/emu/rendlay.cpp @@ -2465,6 +2465,7 @@ public: // construction/destruction led7seg_component(environment &env, util::xml::data_node const &compnode) : component(env, compnode) + , m_alpha(std::clamp(env.get_attribute_float(compnode, "alpha", 0.125F), 0.0F, 1.0F)) { } @@ -2475,7 +2476,7 @@ protected: virtual void draw_aligned(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state) override { rgb_t const onpen = rgb_t(0xff, 0xff, 0xff, 0xff); - rgb_t const offpen = rgb_t(0x20, 0xff, 0xff, 0xff); + rgb_t const offpen = rgb_t(m_alpha * 0xff, 0xff, 0xff, 0xff); // sizes for computation int const bmwidth = 250; @@ -2517,6 +2518,10 @@ protected: // resample to the target size render_resample_argb_bitmap_hq(dest, tempbitmap, color(state)); } + +private: + // internal state + float m_alpha; // opacity for off-segments }; @@ -2527,6 +2532,7 @@ public: // construction/destruction led8seg_gts1_component(environment &env, util::xml::data_node const &compnode) : component(env, compnode) + , m_alpha(std::clamp(env.get_attribute_float(compnode, "alpha", 0.125F), 0.0F, 1.0F)) { } @@ -2537,7 +2543,7 @@ protected: virtual void draw_aligned(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state) override { rgb_t const onpen = rgb_t(0xff, 0xff, 0xff, 0xff); - rgb_t const offpen = rgb_t(0x20, 0xff, 0xff, 0xff); + rgb_t const offpen = rgb_t(m_alpha * 0xff, 0xff, 0xff, 0xff); rgb_t const backpen = rgb_t(0x00, 0x00, 0x00, 0x00); // sizes for computation @@ -2585,6 +2591,10 @@ protected: // resample to the target size render_resample_argb_bitmap_hq(dest, tempbitmap, color(state)); } + +private: + // internal state + float m_alpha; // opacity for off-segments }; @@ -2595,6 +2605,7 @@ public: // construction/destruction led14seg_component(environment &env, util::xml::data_node const &compnode) : component(env, compnode) + , m_alpha(std::clamp(env.get_attribute_float(compnode, "alpha", 0.125F), 0.0F, 1.0F)) { } @@ -2605,7 +2616,7 @@ protected: virtual void draw_aligned(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state) override { rgb_t const onpen = rgb_t(0xff, 0xff, 0xff, 0xff); - rgb_t const offpen = rgb_t(0x20, 0xff, 0xff, 0xff); + rgb_t const offpen = rgb_t(m_alpha * 0xff, 0xff, 0xff, 0xff); // sizes for computation int const bmwidth = 250; @@ -2697,6 +2708,10 @@ protected: // resample to the target size render_resample_argb_bitmap_hq(dest, tempbitmap, color(state)); } + +private: + // internal state + float m_alpha; // opacity for off-segments }; @@ -2707,6 +2722,7 @@ public: // construction/destruction led16seg_component(environment &env, util::xml::data_node const &compnode) : component(env, compnode) + , m_alpha(std::clamp(env.get_attribute_float(compnode, "alpha", 0.125F), 0.0F, 1.0F)) { } @@ -2716,14 +2732,14 @@ protected: virtual void draw_aligned(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state) override { - const rgb_t onpen = rgb_t(0xff, 0xff, 0xff, 0xff); - const rgb_t offpen = rgb_t(0x20, 0xff, 0xff, 0xff); + rgb_t const onpen = rgb_t(0xff, 0xff, 0xff, 0xff); + rgb_t const offpen = rgb_t(m_alpha * 0xff, 0xff, 0xff, 0xff); // sizes for computation - int bmwidth = 250; - int bmheight = 400; - int segwidth = 40; - int skewwidth = 40; + int const bmwidth = 250; + int const bmheight = 400; + int const segwidth = 40; + int const skewwidth = 40; // allocate a temporary bitmap for drawing bitmap_argb32 tempbitmap(bmwidth + skewwidth, bmheight); @@ -2819,6 +2835,10 @@ protected: // resample to the target size render_resample_argb_bitmap_hq(dest, tempbitmap, color(state)); } + +private: + // internal state + float m_alpha; // opacity for off-segments }; @@ -2829,6 +2849,7 @@ public: // construction/destruction led14segsc_component(environment &env, util::xml::data_node const &compnode) : component(env, compnode) + , m_alpha(std::clamp(env.get_attribute_float(compnode, "alpha", 0.125F), 0.0F, 1.0F)) { } @@ -2839,7 +2860,7 @@ protected: virtual void draw_aligned(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state) override { rgb_t const onpen = rgb_t(0xff, 0xff, 0xff, 0xff); - rgb_t const offpen = rgb_t(0x20, 0xff, 0xff, 0xff); + rgb_t const offpen = rgb_t(m_alpha * 0xff, 0xff, 0xff, 0xff); // sizes for computation int const bmwidth = 250; @@ -2942,6 +2963,10 @@ protected: // resample to the target size render_resample_argb_bitmap_hq(dest, tempbitmap, color(state)); } + +private: + // internal state + float m_alpha; // opacity for off-segments }; @@ -2952,6 +2977,7 @@ public: // construction/destruction led16segsc_component(environment &env, util::xml::data_node const &compnode) : component(env, compnode) + , m_alpha(std::clamp(env.get_attribute_float(compnode, "alpha", 0.125F), 0.0F, 1.0F)) { } @@ -2962,7 +2988,7 @@ protected: virtual void draw_aligned(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state) override { rgb_t const onpen = rgb_t(0xff, 0xff, 0xff, 0xff); - rgb_t const offpen = rgb_t(0x20, 0xff, 0xff, 0xff); + rgb_t const offpen = rgb_t(m_alpha * 0xff, 0xff, 0xff, 0xff); // sizes for computation int const bmwidth = 250; @@ -3074,6 +3100,10 @@ protected: // resample to the target size render_resample_argb_bitmap_hq(dest, tempbitmap, color(state)); } + +private: + // internal state + float m_alpha; // opacity for off-segments }; |