mirror of
https://github.com/holub/mame
synced 2025-10-06 00:54:22 +03:00
Working blend based on the colors luma values.
This commit is contained in:
parent
ac76ec42c7
commit
2605c4d243
@ -558,6 +558,8 @@ mc6847_base_device::mc6847_base_device(const machine_config &mconfig, device_typ
|
||||
{
|
||||
m_bw_palette[i] = black_and_white(s_palette[i]);
|
||||
}
|
||||
|
||||
m_artifacter.create_luma_table( s_palette );
|
||||
}
|
||||
|
||||
|
||||
@ -1799,6 +1801,23 @@ mc6847_base_device::pixel_t mc6847_base_device::artifacter::mix_color(double fac
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// artifacter::create_luma_table
|
||||
//-------------------------------------------------
|
||||
|
||||
void mc6847_base_device::artifacter::create_luma_table( const pixel_t *palette )
|
||||
{
|
||||
// Luminance map for PAL color blend. Colors with same luminance value are blendable on a PAL display.
|
||||
m_luminance_map.insert(std::pair<uint32_t,uint8_t>(palette[0],2)); /* GREEN */
|
||||
m_luminance_map.insert(std::pair<uint32_t,uint8_t>(palette[1],1)); /* YELLOW */
|
||||
m_luminance_map.insert(std::pair<uint32_t,uint8_t>(palette[2],3)); /* BLUE */
|
||||
m_luminance_map.insert(std::pair<uint32_t,uint8_t>(palette[3],3)); /* RED */
|
||||
m_luminance_map.insert(std::pair<uint32_t,uint8_t>(palette[4],1)); /* BUFF */
|
||||
m_luminance_map.insert(std::pair<uint32_t,uint8_t>(palette[5],2)); /* CYAN */
|
||||
m_luminance_map.insert(std::pair<uint32_t,uint8_t>(palette[6],2)); /* MAGENTA */
|
||||
m_luminance_map.insert(std::pair<uint32_t,uint8_t>(palette[7],2)); /* ORANGE */
|
||||
}
|
||||
|
||||
//**************************************************************************
|
||||
// VARIATIONS
|
||||
//**************************************************************************
|
||||
|
@ -13,7 +13,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "screen.h"
|
||||
|
||||
#include <map>
|
||||
|
||||
//**************************************************************************
|
||||
// MC6847 CONFIGURATION / INTERFACE
|
||||
@ -181,6 +181,7 @@ protected:
|
||||
void poll_config() { m_artifacting = (m_config!=nullptr) ? m_config->read() : 0; }
|
||||
void set_pal_artifacting( bool palartifacting ) { m_palartifacting = palartifacting; }
|
||||
bool get_pal_artifacting() { return m_palartifacting; }
|
||||
void create_luma_table( const pixel_t *palette );
|
||||
|
||||
// artifacting application
|
||||
template<int xscale>
|
||||
@ -194,10 +195,18 @@ protected:
|
||||
uint32_t tmpPixel;
|
||||
pixel_t *line1 = &bitmap.pix32(y + base_y, base_x);
|
||||
pixel_t *line2 = &bitmap.pix32(y + base_y + 1, base_x);
|
||||
std::map<uint32_t,uint8_t>::const_iterator luma1;
|
||||
std::map<uint32_t,uint8_t>::const_iterator luma2;
|
||||
|
||||
for( int pixel = 0; pixel < bitmap.width(); ++pixel )
|
||||
for( int pixel = 0; pixel < bitmap.width() - (base_x * 2); ++pixel )
|
||||
{
|
||||
if( line1[pixel] != line2[pixel] )
|
||||
if( line1[pixel] == line2[pixel] )
|
||||
continue;
|
||||
|
||||
luma1 = m_luminance_map.find( line1[pixel] );
|
||||
luma2 = m_luminance_map.find( line2[pixel] );
|
||||
|
||||
if( luma1 != m_luminance_map.end() && luma2 != m_luminance_map.end() && (luma1->second == luma2->second))
|
||||
{
|
||||
tmpPixel = (( ((line1[pixel] & 0xFF0000) >> 16) + ((line2[pixel] & 0xFF0000) >> 16) / 2) << 16);
|
||||
tmpPixel |= (( ((line1[pixel] & 0xFF00 ) >> 8 ) + ((line2[pixel] & 0xFF00 ) >> 8 ) / 2) << 8 );
|
||||
@ -254,6 +263,9 @@ protected:
|
||||
pixel_t m_saved_c0, m_saved_c1;
|
||||
pixel_t m_expanded_colors[128];
|
||||
|
||||
// PAL color blend emulation values.
|
||||
std::map<uint32_t, unsigned char> m_luminance_map;
|
||||
|
||||
void update_colors(pixel_t c0, pixel_t c1);
|
||||
static pixel_t mix_color(double factor, uint8_t c0, uint8_t c1);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user