Beispiel #1
0
void palette_device::configure_tilemap_groups(tilemap_t &tmap, gfx_element &gfx, int transcolor)
{
	int color;

	assert(gfx.colors() <= TILEMAP_NUM_GROUPS);

	// iterate over all colors in the tilemap
	for (color = 0; color < gfx.colors(); color++)
		tmap.set_transmask(color, transpen_mask(gfx, color, transcolor), 0);
}
Beispiel #2
0
UINT32 palette_device::transpen_mask(gfx_element &gfx, int color, int transcolor)
{
	UINT32 entry = gfx.colorbase() + (color % gfx.colors()) * gfx.granularity();

	// make sure we are in range
	assert(entry < m_indirect_pens.size());
	assert(gfx.depth() <= 32);

	// either gfx->color_depth entries or as many as we can get up until the end
	int count = MIN(gfx.depth(), m_indirect_pens.size() - entry);

	// set a bit anywhere the transcolor matches
	UINT32 mask = 0;
	for (int bit = 0; bit < count; bit++)
		if (m_indirect_pens[entry++] == transcolor)
			mask |= 1 << bit;

	// return the final mask
	return mask;
}