Esempio n. 1
0
void Componentality::Graphics::operator-=(ISurface& dst, ISurface& src)
{
	for (size_t i = 0; i < ____min(dst.getWidth(), src.getWidth()); i++)
		for (size_t j = 0; j < ____min(dst.getHeight(), src.getHeight()); j++)
		{
			ColorRGB dst_color = dst.peek(i, j);
			ColorRGB src_color = src.peek(i, j);
			dst_color.red -= src_color.red;
			dst_color.green -= src_color.green;
			dst_color.blue -= src_color.blue;
			dst.plot(i, j, dst_color);
		}
}
Esempio n. 2
0
void BitmapSprite::apply(ISurface& surface, const size_t x, const size_t y)
{
	for (size_t yi = 0; yi < mHeight; yi++)
		for (size_t xi = 0; xi < mWidth; xi++)
			{
				ColorRGB original_color = surface.peek(xi + x, yi + y);
				ColorRGB new_color = peek(xi, yi);
				new_color.blue = ____applyAlpha(original_color.blue, new_color.blue, mAlpha);
				new_color.green = ____applyAlpha(original_color.green, new_color.green, mAlpha);
				new_color.red = ____applyAlpha(original_color.red, new_color.red, mAlpha);
				surface.plot(xi + x, yi + y, new_color);
			}
}