From 289f9461f440584dbc551c9268882720e9f12bc3 Mon Sep 17 00:00:00 2001 From: hap Date: Sat, 26 Feb 2022 12:05:21 +0100 Subject: Revert "rendlay: add optional alpha attribute to digit elements" This reverts commit d196d072ff54277a7c3ad0c5048f8fdc6b7e18c8. --- docs/source/techspecs/layout_files.rst | 44 +++++++++++++++------------- src/emu/rendlay.cpp | 52 +++++++--------------------------- src/emu/rendlay.h | 1 + 3 files changed, 37 insertions(+), 60 deletions(-) diff --git a/docs/source/techspecs/layout_files.rst b/docs/source/techspecs/layout_files.rst index de2ba2f8a8e..c43a7df8e1b 100644 --- a/docs/source/techspecs/layout_files.rst +++ b/docs/source/techspecs/layout_files.rst @@ -517,24 +517,36 @@ text be an integer, where 0 (zero) means centred, 1 (one) means left-aligned, and 2 (two) means right-aligned. If the ``align`` attribute is absent, the text will be centred. +dotmatrix + Draws an eight-pixel horizontal segment of a dot matrix display, using + circular pixels in the specified colour. The bits of the element’s state + determine which pixels are lit, with the least significant bit corresponding + to the leftmost pixel. Unlit pixels are drawn at low intensity (0x20/0xff). +dotmatrix5dot + Draws a five-pixel horizontal segment of a dot matrix display, using + circular pixels in the specified colour. The bits of the element’s state + determine which pixels are lit, with the least significant bit corresponding + to the leftmost pixel. Unlit pixels are drawn at low intensity (0x20/0xff). +dotmatrixdot + Draws a single element of a dot matrix display as a circular pixels in the + specified colour. The least significant bit of the element’s state + determines whether the pixel is lit. An unlit pixel is drawn at low + intensity (0x20/0xff). led7seg Draws a standard seven-segment (plus decimal point) digital LED/fluorescent display in the specified colour. The low eight bits of the element’s state control which segments are lit. Starting from the least significant bit, the bits correspond to the top segment, the upper right-hand segment, continuing clockwise to the upper left segment, the middle bar, and the - decimal point. An optional ``alpha`` attribute determines the opacity for - unlit segments. It ranges from 0.0 to 1.0 as with ``color``, and when - omitted, it defaults to 0.125. + decimal point. Unlit segments are drawn at low intensity (0x20/0xff). led8seg_gts1 Draws an eight-segment digital fluorescent display of the type used in Gottlieb System 1 pinball machines (actually a Futaba part). Compared to standard seven-segment displays, these displays have no decimal point, the horizontal middle bar is broken in the centre, and there is a broken vertical middle bar controlled by the bit that would control the decimal - point in a standard seven-segment display. An optional ``alpha`` attribute - determines the opacity for unlit segments. It ranges from 0.0 to 1.0 as - with ``color``, and when omitted, it defaults to 0.125. + point in a standard seven-segment display. Unlit segments are drawn at low + intensity (0x20/0xff). led14seg Draws a standard fourteen-segment alphanumeric LED/fluorescent display in the specified colour. The low fourteen bits of the element’s state control @@ -542,18 +554,15 @@ led14seg correspond to the top segment, the upper right-hand segment, continuing clockwise to the upper left segment, the left-hand and right-hand halves of the horizontal middle bar, the upper and lower halves of the vertical middle - bar, and the diagonal bars clockwise from lower left to lower right. An - optional ``alpha`` attribute determines the opacity for unlit segments. It - ranges from 0.0 to 1.0 as with ``color``, and when omitted, it defaults to - 0.125. + bar, and the diagonal bars clockwise from lower left to lower right. Unlit + segments are drawn at low intensity (0x20/0xff). led14segsc Draws a standard fourteen-segment alphanumeric LED/fluorescent display with decimal point/comma in the specified colour. The low sixteen bits of the element’s state control which segments are lit. The low fourteen bits correspond to the same segments as in the ``led14seg`` component. Two - additional bits correspond to the decimal point and comma tail. An optional - ``alpha`` attribute determines the opacity for unlit segments. It ranges - from 0.0 to 1.0 as with ``color``, and when omitted, it defaults to 0.125. + additional bits correspond to the decimal point and comma tail. Unlit + segments are drawn at low intensity (0x20/0xff). led16seg Draws a standard sixteen-segment alphanumeric LED/fluorescent display in the specified colour. The low sixteen bits of the element’s state control which @@ -562,17 +571,14 @@ led16seg top bar, continuing clockwise to the upper left segment, the left-hand and right-hand halves of the horizontal middle bar, the upper and lower halves of the vertical middle bar, and the diagonal bars clockwise from lower left - to lower right. An optional ``alpha`` attribute determines the opacity for - unlit segments. It ranges from 0.0 to 1.0 as with ``color``, and when - omitted, it defaults to 0.125. + to lower right. Unlit segments are drawn at low intensity (0x20/0xff). led16segsc Draws a standard sixteen-segment alphanumeric LED/fluorescent display with decimal point/comma in the specified colour. The low eighteen bits of the element’s state control which segments are lit. The low sixteen bits correspond to the same segments as in the ``led16seg`` component. Two - additional bits correspond to the decimal point and comma tail. An optional - ``alpha`` attribute determines the opacity for unlit segments. It ranges - from 0.0 to 1.0 as with ``color``, and when omitted, it defaults to 0.125. + additional bits correspond to the decimal point and comma tail. Unlit + segments are drawn at low intensity (0x20/0xff). simplecounter Displays the numeric value of the element’s state using the system font in the specified colour. The value is formatted in decimal notation. A diff --git a/src/emu/rendlay.cpp b/src/emu/rendlay.cpp index b312637c0a9..88cc161e22f 100644 --- a/src/emu/rendlay.cpp +++ b/src/emu/rendlay.cpp @@ -2465,7 +2465,6 @@ 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)) { } @@ -2476,7 +2475,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(m_alpha * 0xff, 0xff, 0xff, 0xff); + rgb_t const offpen = rgb_t(0x20, 0xff, 0xff, 0xff); // sizes for computation int const bmwidth = 250; @@ -2518,10 +2517,6 @@ 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 }; @@ -2532,7 +2527,6 @@ 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)) { } @@ -2543,7 +2537,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(m_alpha * 0xff, 0xff, 0xff, 0xff); + rgb_t const offpen = rgb_t(0x20, 0xff, 0xff, 0xff); rgb_t const backpen = rgb_t(0x00, 0x00, 0x00, 0x00); // sizes for computation @@ -2591,10 +2585,6 @@ 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 }; @@ -2605,7 +2595,6 @@ 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)) { } @@ -2616,7 +2605,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(m_alpha * 0xff, 0xff, 0xff, 0xff); + rgb_t const offpen = rgb_t(0x20, 0xff, 0xff, 0xff); // sizes for computation int const bmwidth = 250; @@ -2708,10 +2697,6 @@ 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 }; @@ -2722,7 +2707,6 @@ 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)) { } @@ -2732,14 +2716,14 @@ 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(m_alpha * 0xff, 0xff, 0xff, 0xff); + const rgb_t onpen = rgb_t(0xff, 0xff, 0xff, 0xff); + const rgb_t offpen = rgb_t(0x20, 0xff, 0xff, 0xff); // sizes for computation - int const bmwidth = 250; - int const bmheight = 400; - int const segwidth = 40; - int const skewwidth = 40; + int bmwidth = 250; + int bmheight = 400; + int segwidth = 40; + int skewwidth = 40; // allocate a temporary bitmap for drawing bitmap_argb32 tempbitmap(bmwidth + skewwidth, bmheight); @@ -2835,10 +2819,6 @@ 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 }; @@ -2849,7 +2829,6 @@ 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)) { } @@ -2860,7 +2839,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(m_alpha * 0xff, 0xff, 0xff, 0xff); + rgb_t const offpen = rgb_t(0x20, 0xff, 0xff, 0xff); // sizes for computation int const bmwidth = 250; @@ -2963,10 +2942,6 @@ 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 }; @@ -2977,7 +2952,6 @@ 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)) { } @@ -2988,7 +2962,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(m_alpha * 0xff, 0xff, 0xff, 0xff); + rgb_t const offpen = rgb_t(0x20, 0xff, 0xff, 0xff); // sizes for computation int const bmwidth = 250; @@ -3100,10 +3074,6 @@ 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 }; diff --git a/src/emu/rendlay.h b/src/emu/rendlay.h index d0e8bb2e582..c58823e18ce 100644 --- a/src/emu/rendlay.h +++ b/src/emu/rendlay.h @@ -183,6 +183,7 @@ private: // internal helpers static void element_scale(bitmap_argb32 &dest, bitmap_argb32 &source, const rectangle &sbounds, void *param); template static component::ptr make_component(environment &env, util::xml::data_node const &compnode); + template static component::ptr make_dotmatrix_component(environment &env, util::xml::data_node const &compnode); static make_component_map const s_make_component; // maps component XML names to creator functions -- cgit v1.2.3