Beispiel #1
0
	//! fills the surface with given color
	void CImage::fill(const ColourValue &color)
	{
		UINT32 c;

		switch (Format)
		{
		case ECF_A1R5G5B5:
			c = A8R8G8B8toA1R5G5B5(color.getAsARGB());
			c |= c << 16;
			break;
		case ECF_R5G6B5:
			c = A8R8G8B8toR5G6B5(color.getAsARGB());
			c |= c << 16;
			break;
		case ECF_A8R8G8B8:
			c = color.getAsARGB();
			break;
		case ECF_R8G8B8:
		{
			UINT8 rgb[3];
			CColorConverter::convert_A8R8G8B8toR8G8B8(&color, 1, rgb);
			const UINT32 size = getImageDataSizeInBytes();
			for (UINT32 i = 0; i<size; i += 3)
			{
				memcpy(Data + i, rgb, 3);
			}
			return;
		}
		break;
		default:
			// TODO: Handle other formats
			return;
		}
		memset32(Data, c, getImageDataSizeInBytes());
	}
Beispiel #2
0
//! fills the surface with given color
void CImage::fill(const SColor &color)
{
	u32 c;

	switch ( Format )
	{
		case ECF_A1R5G5B5:
			c = color.toA1R5G5B5();
			c |= c << 16;
			break;
		case ECF_R5G6B5:
			c = video::A8R8G8B8toR5G6B5( color.color );
			c |= c << 16;
			break;
		case ECF_A8R8G8B8:
			c = color.color;
			break;
		case ECF_R8G8B8:
		{
			u8 rgb[3];
			CColorConverter::convert_A8R8G8B8toR8G8B8(&color, 1, rgb);
			const u32 size = getImageDataSizeInBytes();
			for (u32 i=0; i<size; i+=3)
			{
				memcpy(Data+i, rgb, 3);
			}
			return;
		}
		break;
		default:
		// TODO: Handle other formats
			return;
	}
	memset32( Data, c, getImageDataSizeInBytes() );
}
Beispiel #3
0
		//! fills the surface with given color
		void CImage::fill(const SColor &color)
		{
			u32 c;

			switch (Format)
			{
				case ECF_A1R5G5B5:
				{
					c = color.toA1R5G5B5();
					c |= c << 16;
					break;
				}
				case ECF_R5G6B5:
				{
					c = SharedColorConverter::getInstance().A8R8G8B8toR5G6B5(
							color.color);
					c |= c << 16;
					break;
				}
				case ECF_A8R8G8B8:
				{
					c = color.color;
					break;
				}
				case ECF_R8G8B8:
				{
					u8 rgb[3];
					SharedColorConverter::getInstance().convert_A8R8G8B8toR8G8B8(
							&color, 1, rgb);
					const u32 size = getImageDataSizeInBytes();
					for (u32 i = 0; i < size; i += 3)
					{
						memcpy(Data + i, rgb, 3);
					}
					return;

					break;
				}

				case ECF_R16F:
				case ECF_G16R16F:
				case ECF_A16B16G16R16F:
				case ECF_R32F:
				case ECF_G32R32F:
				case ECF_A32B32G32R32F:
				case ECF_UNKNOWN:
				default:
				{
					break;
				}
			}

			if (Format != ECF_A1R5G5B5 && Format != ECF_R5G6B5
					&& Format != ECF_A8R8G8B8)
			{
				return;
			}

			StaticVideoUtils::memset32(Data, c, getImageDataSizeInBytes());
		}