Ejemplo n.º 1
0
        //void set_shadow_dRGB32(int mode, int dr, int dg, int db, bool noclip);


        //-------------------------------------------------
        //  configure_rgb_shadows - configure shadows
        //  for the RGB tables
        //-------------------------------------------------
        void configure_rgb_shadows(int mode, float factor)
        {
            // only applies to RGB direct modes
            assert(m_format != bitmap_format.BITMAP_FORMAT_IND16);

            // verify the shadow table
            assert(mode >= 0 && mode < m_shadow_tables.Length);
            shadow_table_data stable = m_shadow_tables[mode];

            assert(stable.base_ != null);

            // regenerate the table
            int ifactor = (int)(factor * 256.0f);

            for (int rgb555 = 0; rgb555 < 32768; rgb555++)
            {
                u8 r = rgb_t.clamp((pal5bit((uint8_t)(rgb555 >> 10)) * ifactor) >> 8);
                u8 g = rgb_t.clamp((pal5bit((uint8_t)(rgb555 >> 5)) * ifactor) >> 8);
                u8 b = rgb_t.clamp((pal5bit((uint8_t)(rgb555 >> 0)) * ifactor) >> 8);

                // store either 16 or 32 bit
                rgb_t final = new rgb_t(r, g, b);
                if (m_format == bitmap_format.BITMAP_FORMAT_RGB32)
                {
                    stable.base_[rgb555] = final;
                }
                else
                {
                    stable.base_[rgb555] = final.as_rgb15();
                }
            }
        }
Ejemplo n.º 2
0
        /**
         * @fn  void palette_t::update_adjusted_color(UINT32 group, UINT32 index)
         *
         * @brief   -------------------------------------------------
         *            update_adjusted_color - update a color index by group and index pair
         *          -------------------------------------------------.
         *
         * @param   group   The group.
         * @param   index   Zero-based index of the.
         */
        void update_adjusted_color(uint32_t group, uint32_t index)
        {
            // compute the adjusted value
            rgb_t adjusted = adjust_palette_entry(m_entry_color[index],
                                                  m_group_bright[group] + m_brightness,
                                                  m_group_contrast[group] * m_entry_contrast[index] * m_contrast,
                                                  m_gamma_map);

            // if not different, ignore
            uint32_t finalindex = group * m_numcolors + index;

            if (m_adjusted_color[finalindex] == adjusted)
            {
                return;
            }

            // otherwise, modify the adjusted color array
            m_adjusted_color[finalindex] = adjusted;
            m_adjusted_rgb15[finalindex] = adjusted.as_rgb15();

            // mark dirty in all clients
            for (palette_client client = m_client_list; client != null; client = client.next())
            {
                client.mark_dirty(finalindex);
            }
        }