Ejemplo n.º 1
0
/*!
*/
static void executeBlit_TextureBlendColor_32_to_32( const SBlitJob * job )
{
	u32 *src = (u32*) job->src;
	u32 *dst = (u32*) job->dst;

	for ( s32 dy = 0; dy != job->height; ++dy )
	{
		for ( s32 dx = 0; dx != job->width; ++dx )
		{
			dst[dx] = PixelBlend32( dst[dx], PixelMul32_2( src[dx], job->argb ) );
		}
		src = (u32*) ( (u8*) (src) + job->srcPitch );
		dst = (u32*) ( (u8*) (dst) + job->dstPitch );
	}
}
Ejemplo n.º 2
0
/*!
*/
static void executeBlit_ColorAlpha_32_to_32( const SBlitJob * job )
{
	u32 *dst = (u32*) job->dst;

	const u32 alpha = extractAlpha( job->argb );
	const u32 src = job->argb;

	for ( s32 dy = 0; dy != job->height; ++dy )
	{
		for ( s32 dx = 0; dx != job->width; ++dx )
		{
			dst[dx] = PixelBlend32( dst[dx], src, alpha );
		}
		dst = (u32*) ( (u8*) (dst) + job->dstPitch );
	}
}
Ejemplo n.º 3
0
	//! sets a pixel
	void CImage::setPixel(UINT32 x, UINT32 y, const ColourValue &color, bool blend)
	{
		ColourValue c = color;
		if (x >= Size.Width || y >= Size.Height)
			return;

		switch (Format)
		{
		case ECF_A1R5G5B5:
		{
			UINT16 * dest = (UINT16*)(Data + (y * Pitch) + (x << 1));
			*dest = A8R8G8B8toA1R5G5B5(color.getAsARGB());
		} break;

		case ECF_R5G6B5:
		{
			UINT16 * dest = (UINT16*)(Data + (y * Pitch) + (x << 1));
			*dest = A8R8G8B8toR5G6B5(color.getAsARGB());
		} break;

		case ECF_R8G8B8:
		{
			UINT8* dest = Data + (y * Pitch) + (x * 3);
			
			dest[0] = (UINT8)c.getRed();
			dest[1] = (UINT8)c.getGreen();
			dest[2] = (UINT8)c.getBlue();
		} break;

		case ECF_A8R8G8B8:
		{
			UINT32 * dest = (UINT32*)(Data + (y * Pitch) + (x << 2));
			*dest = blend ? PixelBlend32(*dest, color.getAsARGB()) : color.getAsARGB();
		} break;
#ifndef _DEBUG
		default:
			break;
#endif
		}
	}
Ejemplo n.º 4
0
static void RenderLine32_Blend(video::IImage *t,
				const core::position2d<s32> &p0,
				const core::position2d<s32> &p1,
				u32 argb, u32 alpha)
{
	s32 dx = p1.X - p0.X;
	s32 dy = p1.Y - p0.Y;

	s32 c;
	s32 m;
	s32 d = 0;
	s32 run;

	s32 xInc = 4;
	s32 yInc = (s32) t->getPitch();

	if ( dx < 0 )
	{
		xInc = -xInc;
		dx = -dx;
	}

	if ( dy < 0 )
	{
		yInc = -yInc;
		dy = -dy;
	}

	u32 *dst;
	dst = (u32*) ( (u8*) t->lock() + ( p0.Y * t->getPitch() ) + ( p0.X << 2 ) );

	if ( dy > dx )
	{
		s32 tmp;
		tmp = dx;
		dx = dy;
		dy = tmp;
		tmp = xInc;
		xInc = yInc;
		yInc = tmp;
	}

	c = dx << 1;
	m = dy << 1;

	run = dx;
	while ( run )
	{
		*dst = PixelBlend32( *dst, argb, alpha );

		dst = (u32*) ( (u8*) dst + xInc );	// x += xInc
		d += m;
		if ( d > dx )
		{
			dst = (u32*) ( (u8*) dst + yInc );	// y += yInc
			d -= c;
		}
		run -= 1;
	}

	t->unlock();
}