本文整理汇总了C++中rgb_t函数的典型用法代码示例。如果您正苦于以下问题:C++ rgb_t函数的具体用法?C++ rgb_t怎么用?C++ rgb_t使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rgb_t函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PALETTE_INIT_MEMBER
PALETTE_INIT_MEMBER(gunsmoke_state, gunsmoke)
{
const UINT8 *color_prom = memregion("proms")->base();
int i;
/* create a lookup table for the palette */
for (i = 0; i < 0x100; i++)
{
int r = pal4bit(color_prom[i + 0x000]);
int g = pal4bit(color_prom[i + 0x100]);
int b = pal4bit(color_prom[i + 0x200]);
palette.set_indirect_color(i, rgb_t(r, g, b));
}
/* color_prom now points to the beginning of the lookup table */
color_prom += 0x300;
/* characters use colors 0x40-0x4f */
for (i = 0; i < 0x80; i++)
{
UINT8 ctabentry = color_prom[i] | 0x40;
palette.set_pen_indirect(i, ctabentry);
}
/* background tiles use colors 0-0x3f */
for (i = 0x100; i < 0x200; i++)
{
UINT8 ctabentry = color_prom[i] | ((color_prom[i + 0x100] & 0x03) << 4);
palette.set_pen_indirect(i - 0x80, ctabentry);
}
/* sprites use colors 0x80-0xff */
for (i = 0x300; i < 0x400; i++)
{
UINT8 ctabentry = color_prom[i] | ((color_prom[i + 0x100] & 0x07) << 4) | 0x80;
palette.set_pen_indirect(i - 0x180, ctabentry);
}
}
示例2: PALETTE_INIT_MEMBER
/* guess: use the same resistor values as Crazy Climber (needs checking on the real HW) */
PALETTE_INIT_MEMBER(nightgal_state, nightgal)
{
const uint8_t *color_prom = memregion("proms")->base();
static const int resistances_rg[3] = { 1000, 470, 220 };
static const int resistances_b [2] = { 470, 220 };
double weights_rg[3], weights_b[2];
int i;
/* compute the color output resistor weights */
compute_resistor_weights(0, 255, -1.0,
3, resistances_rg, weights_rg, 0, 0,
2, resistances_b, weights_b, 0, 0,
0, nullptr, nullptr, 0, 0);
for (i = 0; i < palette.entries(); i++)
{
int bit0, bit1, bit2;
int r, g, b;
/* red component */
bit0 = BIT(color_prom[i], 0);
bit1 = BIT(color_prom[i], 1);
bit2 = BIT(color_prom[i], 2);
r = combine_3_weights(weights_rg, bit0, bit1, bit2);
/* green component */
bit0 = BIT(color_prom[i], 3);
bit1 = BIT(color_prom[i], 4);
bit2 = BIT(color_prom[i], 5);
g = combine_3_weights(weights_rg, bit0, bit1, bit2);
/* blue component */
bit0 = BIT(color_prom[i], 6);
bit1 = BIT(color_prom[i], 7);
b = combine_2_weights(weights_b, bit0, bit1);
palette.set_pen_color(i, rgb_t(r, g, b));
}
}
示例3: switch
void tc0110pcr_device::restore_colors()
{
int i, color, r = 0, g = 0, b = 0;
for (i = 0; i < (256 * 16); i++)
{
color = m_ram[i];
switch (m_type)
{
case 0x00:
{
r = pal5bit(color >> 0);
g = pal5bit(color >> 5);
b = pal5bit(color >> 10);
break;
}
case 0x01:
{
b = pal5bit(color >> 0);
g = pal5bit(color >> 5);
r = pal5bit(color >> 10);
break;
}
case 0x02:
{
r = pal4bit(color >> 0);
g = pal4bit(color >> 4);
b = pal4bit(color >> 8);
break;
}
}
m_palette->set_pen_color(i, rgb_t(r, g, b));
}
}
示例4: memregion
void kontest_state::kontest_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
for (int i = 0; i < 0x20; ++i)
{
int bit0, bit1, bit2;
bit0 = 0;
bit1 = BIT(color_prom[i], 6);
bit2 = BIT(color_prom[i], 7);
int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
bit0 = BIT(color_prom[i], 3);
bit1 = BIT(color_prom[i], 4);
bit2 = BIT(color_prom[i], 5);
int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
bit0 = BIT(color_prom[i], 0);
bit1 = BIT(color_prom[i], 1);
bit2 = BIT(color_prom[i], 2);
int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
palette.set_pen_color(i, rgb_t(r, g, b));
}
}
示例5: PALETTE_INIT_MEMBER
PALETTE_INIT_MEMBER(equites_state,splndrbt)
{
const UINT8 *color_prom = memregion("proms")->base();
int i;
for (i = 0; i < 0x100; i++)
palette.set_indirect_color(i, rgb_t(pal4bit(color_prom[i]), pal4bit(color_prom[i + 0x100]), pal4bit(color_prom[i + 0x200])));
for (i = 0; i < 0x100; i++)
palette.set_pen_indirect(i, i);
// point to the bg CLUT
color_prom += 0x300;
for (i = 0; i < 0x80; i++)
palette.set_pen_indirect(i + 0x100, color_prom[i] + 0x10);
// point to the sprite CLUT
color_prom += 0x100;
for (i = 0; i < 0x100; i++)
palette.set_pen_indirect(i + 0x180, color_prom[i]);
}
示例6: dview_draw_vsb
static void dview_draw_vsb(DView *dv)
{
int vt;
int ts;
//int sz = SLIDER_SIZE;
int sz;
rectangle r;
adjustment *sb = &dv->vsb;
dview_get_rect(dv, RECT_DVIEW_VSB, r);
dview_draw_outlined_box(dv, RECT_DVIEW_VSB, 0, r.height() - HSB_HEIGHT, VSB_WIDTH, HSB_HEIGHT, rgb_t(0xff, 0xff, 0x00, 0x00));
dview_draw_outlined_box(dv, RECT_DVIEW_VSB, 0, 0, VSB_WIDTH, HSB_HEIGHT, rgb_t(0xff, 0xff, 0x00, 0x00));
ts = r.height() - 2 * HSB_HEIGHT;
sz = (ts * (sb->page_size)) / (sb->upper - sb->lower);
ts = ts - sz;
vt = (ts * (sb->value - sb->lower)) / (sb->upper - sb->lower - sb->page_size) + sz / 2 + HSB_HEIGHT;
dview_draw_outlined_box(dv, RECT_DVIEW_VSB, 0, vt - sz / 2, VSB_WIDTH, sz, rgb_t(0xff, 0xff, 0x00, 0x00));
}
示例7: PALETTE_INIT_MEMBER
PALETTE_INIT_MEMBER(olibochu_state, olibochu)
{
const UINT8 *color_prom = memregion("proms")->base();
int i;
for (i = 0; i < palette.entries(); i++)
{
UINT8 pen;
int bit0, bit1, bit2, r, g, b;
if (i < 0x100)
/* characters */
pen = (color_prom[0x020 + (i - 0x000)] & 0x0f) | 0x10;
else
/* sprites */
pen = (color_prom[0x120 + (i - 0x100)] & 0x0f) | 0x00;
/* red component */
bit0 = BIT(color_prom[pen], 0);
bit1 = BIT(color_prom[pen], 1);
bit2 = BIT(color_prom[pen], 2);
r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
/* green component */
bit0 = BIT(color_prom[pen], 3);
bit1 = BIT(color_prom[pen], 4);
bit2 = BIT(color_prom[pen], 5);
g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
/* blue component */
bit0 = BIT(color_prom[pen], 6);
bit1 = BIT(color_prom[pen], 7);
b = 0x4f * bit0 + 0xa8 * bit1;
palette.set_pen_color(i, rgb_t(r, g, b));
}
}
示例8: memregion
// guess: use the same resistor values as Crazy Climber (needs checking on the real hardware)
void jangou_state::jangou_palette(palette_device &palette) const
{
uint8_t const *const color_prom = memregion("proms")->base();
static constexpr int resistances_rg[3] = { 1000, 470, 220 };
static constexpr int resistances_b [2] = { 470, 220 };
// compute the color output resistor weights
double weights_rg[3], weights_b[2];
compute_resistor_weights(0, 255, -1.0,
3, resistances_rg, weights_rg, 0, 0,
2, resistances_b, weights_b, 0, 0,
0, nullptr, nullptr, 0, 0);
for (int i = 0;i < palette.entries(); i++)
{
int bit0, bit1, bit2;
// red component
bit0 = BIT(color_prom[i], 0);
bit1 = BIT(color_prom[i], 1);
bit2 = BIT(color_prom[i], 2);
int const r = combine_weights(weights_rg, bit0, bit1, bit2);
// green component
bit0 = BIT(color_prom[i], 3);
bit1 = BIT(color_prom[i], 4);
bit2 = BIT(color_prom[i], 5);
int const g = combine_weights(weights_rg, bit0, bit1, bit2);
// blue component
bit0 = BIT(color_prom[i], 6);
bit1 = BIT(color_prom[i], 7);
int const b = combine_weights(weights_b, bit0, bit1);
palette.set_pen_color(i, rgb_t(r, g, b));
}
}
示例9: map_attr_to_fg_bg
INLINE void map_attr_to_fg_bg(unsigned char attr, rgb_t *fg, rgb_t *bg)
{
*bg = rgb_t(0xff,0xff,0xff,0xff);
*fg = rgb_t(0xff,0x00,0x00,0x00);
if(attr & DCA_ANCILLARY)
*bg = rgb_t(0xff,0xe0,0xe0,0xe0);
if(attr & DCA_SELECTED) {
*bg = rgb_t(0xff,0xff,0x80,0x80);
}
if(attr & DCA_CURRENT) {
*bg = rgb_t(0xff,0xff,0xff,0x00);
}
if(attr & DCA_CHANGED) {
*fg = rgb_t(0xff,0xff,0x00,0x00);
}
if(attr & DCA_INVALID) {
*fg = rgb_t(0xff,0x00,0x00,0xff);
}
if(attr & DCA_DISABLED) {
*fg = rgb_t(fg->a(), (fg->r() + bg->r()) >> 1, (fg->g() + bg->g()) >> 1, (fg->b() + bg->b()) >> 1);
}
示例10: PALETTE_INIT_MEMBER
PALETTE_INIT_MEMBER(sprint4_state, sprint4)
{
palette.set_indirect_color(0, rgb_t(0x00, 0x00, 0x00)); /* black */
palette.set_indirect_color(1, rgb_t(0xfc, 0xdf, 0x80)); /* peach */
palette.set_indirect_color(2, rgb_t(0xf0, 0x00, 0xf0)); /* violet */
palette.set_indirect_color(3, rgb_t(0x00, 0xf0, 0x0f)); /* green */
palette.set_indirect_color(4, rgb_t(0x30, 0x4f, 0xff)); /* blue */
palette.set_indirect_color(5, rgb_t(0xff, 0xff, 0xff)); /* white */
palette.set_pen_indirect(0, 0);
palette.set_pen_indirect(2, 0);
palette.set_pen_indirect(4, 0);
palette.set_pen_indirect(6, 0);
palette.set_pen_indirect(8, 0);
palette.set_pen_indirect(1, 1);
palette.set_pen_indirect(3, 2);
palette.set_pen_indirect(5, 3);
palette.set_pen_indirect(7, 4);
palette.set_pen_indirect(9, 5);
}
示例11: rgb_t
void nc_state::video_start()
{
}
#if 0
/* two colours */
static const unsigned short nc_colour_table[NC_NUM_COLOURS] =
{
0, 1,2,3
};
#endif
/* black/white */
static const rgb_t nc_palette[NC_NUM_COLOURS] =
{
rgb_t(0x060, 0x060, 0x060),
rgb_t(0x000, 0x000, 0x000),
rgb_t(0x080, 0x0a0, 0x060),
rgb_t(0x000, 0x000, 0x000)
};
/* Initialise the palette */
PALETTE_INIT_MEMBER(nc_state, nc)
{
palette.set_pen_colors(0, nc_palette, ARRAY_LENGTH(nc_palette));
}
void nc_state::nc200_video_set_backlight(int state)
{
示例12: INPUT_PORTS_START
/* Input ports */
static INPUT_PORTS_START( tim100 )
INPUT_PORTS_END
static DEVICE_INPUT_DEFAULTS_START( tim100 )
DEVICE_INPUT_DEFAULTS( "RS232_TXBAUD", 0xff, RS232_BAUD_9600 )
DEVICE_INPUT_DEFAULTS( "RS232_RXBAUD", 0xff, RS232_BAUD_9600 )
DEVICE_INPUT_DEFAULTS( "RS232_STARTBITS", 0xff, RS232_STARTBITS_1 )
DEVICE_INPUT_DEFAULTS( "RS232_DATABITS", 0xff, RS232_DATABITS_8 )
DEVICE_INPUT_DEFAULTS( "RS232_PARITY", 0xff, RS232_PARITY_ODD )
DEVICE_INPUT_DEFAULTS( "RS232_STOPBITS", 0xff, RS232_STOPBITS_2 )
DEVICE_INPUT_DEFAULTS_END
static const rgb_t tim100_palette[3] = {
rgb_t(0x00, 0x00, 0x00), // black
rgb_t(0xa0, 0xa0, 0xa0), // white
rgb_t(0xff, 0xff, 0xff) // highlight
};
void tim100_state::machine_start()
{
m_charmap = memregion("chargen")->base();
m_palette->set_pen_colors(0, tim100_palette, ARRAY_LENGTH(tim100_palette));
}
const gfx_layout tim100_charlayout =
{
12, 16, /* 8x16 characters */
256, /* 128 characters */
1, /* 1 bits per pixel */
示例13: PORT_START
PORT_START("keyb_special")
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED)
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Left Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1)
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Right Shift") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1)
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Control") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2)
PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED)
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RESET") PORT_CODE(KEYCODE_F12)
INPUT_PORTS_END
// this is an apple II palette; it seems more likely the
// actual laser3000 has a digital RGB palette...
static const rgb_t laser3k_palette[] =
{
rgb_t::black,
rgb_t(0xE3, 0x1E, 0x60), /* Dark Red */
rgb_t(0x60, 0x4E, 0xBD), /* Dark Blue */
rgb_t(0xFF, 0x44, 0xFD), /* Purple */
rgb_t(0x00, 0xA3, 0x60), /* Dark Green */
rgb_t(0x9C, 0x9C, 0x9C), /* Dark Gray */
rgb_t(0x14, 0xCF, 0xFD), /* Medium Blue */
rgb_t(0xD0, 0xC3, 0xFF), /* Light Blue */
rgb_t(0x60, 0x72, 0x03), /* Brown */
rgb_t(0xFF, 0x6A, 0x3C), /* Orange */
rgb_t(0x9C, 0x9C, 0x9C), /* Light Grey */
rgb_t(0xFF, 0xA0, 0xD0), /* Pink */
rgb_t(0x14, 0xF5, 0x3C), /* Light Green */
rgb_t(0xD0, 0xDD, 0x8D), /* Yellow */
rgb_t(0x72, 0xFF, 0xD0), /* Aquamarine */
rgb_t(0xFF, 0xFF, 0xFF) /* White */
};
示例14: machine
void ui_menu_dats_view::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
{
ui_manager &mui = machine().ui();
float maxwidth = origx2 - origx1;
float width;
std::string driver;
if (issoft)
driver = m_swinfo->longname;
else
driver = m_driver->description;
mui.draw_text_full(container, driver.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE,
DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr);
width += 2 * UI_BOX_LR_BORDER;
maxwidth = MAX(origx2 - origx1, width);
// compute our bounds
float x1 = 0.5f - 0.5f * maxwidth;
float x2 = x1 + maxwidth;
float y1 = origy1 - top;
float y2 = origy1 - 2.0f * UI_BOX_TB_BORDER - mui.get_line_height();
// draw a box
mui.draw_outlined_box(container, x1, y1, x2, y2, UI_GREEN_COLOR);
// take off the borders
x1 += UI_BOX_LR_BORDER;
x2 -= UI_BOX_LR_BORDER;
y1 += UI_BOX_TB_BORDER;
mui.draw_text_full(container, driver.c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER,
DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
// take off the borders
x1 -= UI_BOX_LR_BORDER;
x2 += UI_BOX_LR_BORDER;
y1 -= UI_BOX_TB_BORDER;
maxwidth = 0;
for (auto & elem : m_items_list)
{
mui.draw_text_full(container, elem.label.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_NEVER,
DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr);
maxwidth += width;
}
float space = (1.0f - maxwidth) / (m_items_list.size() * 2);
// compute our bounds
y1 = y2 + UI_BOX_TB_BORDER;
y2 += mui.get_line_height() + 2.0f * UI_BOX_TB_BORDER;
// draw a box
mui.draw_outlined_box(container, x1, y1, x2, y2, UI_BACKGROUND_COLOR);
// take off the borders
x2 -= UI_BOX_LR_BORDER;
y1 += UI_BOX_TB_BORDER;
// draw the text within it
int x = 0;
for (auto & elem : m_items_list)
{
x1 += space;
rgb_t fcolor = (actual == x) ? rgb_t(0xff, 0xff, 0xff, 0x00) : UI_TEXT_COLOR;
rgb_t bcolor = (actual == x) ? rgb_t(0xff, 0xff, 0xff, 0xff) : UI_TEXT_BG_COLOR;
mui.draw_text_full(container, elem.label.c_str(), x1, y1, 1.0f, JUSTIFY_LEFT, WRAP_NEVER,
DRAW_NONE, fcolor, bcolor, &width, nullptr);
if (bcolor != UI_TEXT_BG_COLOR)
mui.draw_textured_box(container, x1 - (space / 2), y1, x1 + width + (space / 2), y2, bcolor, rgb_t(255, 43, 43, 43),
hilight_main_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE));
mui.draw_text_full(container, elem.label.c_str(), x1, y1, 1.0f, JUSTIFY_LEFT, WRAP_NEVER,
DRAW_NORMAL, fcolor, bcolor, &width, nullptr);
x1 += width + space;
++x;
}
// bottom
std::string revision;
revision.assign(_("Revision: ")).append(m_items_list[actual].revision);
mui.draw_text_full(container, revision.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE,
DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr);
width += 2 * UI_BOX_LR_BORDER;
maxwidth = MAX(origx2 - origx1, width);
// compute our bounds
x1 = 0.5f - 0.5f * maxwidth;
x2 = x1 + maxwidth;
y1 = origy2 + UI_BOX_TB_BORDER;
y2 = origy2 + bottom;
// draw a box
mui.draw_outlined_box(container, x1, y1, x2, y2, UI_GREEN_COLOR);
// take off the borders
x1 += UI_BOX_LR_BORDER;
x2 -= UI_BOX_LR_BORDER;
//.........这里部分代码省略.........
示例15: auto_bitmap_ind16_alloc
m_prn_output = auto_bitmap_ind16_alloc(machine(),PCW_PRINTER_WIDTH,PCW_PRINTER_HEIGHT);
m_prn_output->fill(1, rect);
}
#if 0
/* two colours */
static const unsigned short pcw_colour_table[PCW_NUM_COLOURS] =
{
0, 1
};
#endif
/* black/white */
static const rgb_t pcw_palette[PCW_NUM_COLOURS] =
{
rgb_t(0x000, 0x000, 0x000),
rgb_t(0x0ff, 0x0ff, 0x0ff)
};
/* Initialise the palette */
PALETTE_INIT_MEMBER(pcw_state, pcw)
{
palette.set_pen_colors(0, pcw_palette, ARRAY_LENGTH(pcw_palette));
}
/***************************************************************************
Draw the game screen in the given bitmap_ind16.
Do NOT call osd_update_display() from this function,
it will be called by the main emulation engine.
***************************************************************************/