コード例 #1
0
ファイル: XTColorRef.cpp プロジェクト: killbug2004/ghost2013
CXTColorRef& CXTColorRef::blend(const CXTColorRef& clr, int opacity)
{
	*this = RGB(BlendColor(clr.getRValue(), getRValue(), opacity),
				BlendColor(clr.getGValue(), getGValue(), opacity),
				BlendColor(clr.getBValue(), getBValue(), opacity));
	return *this;
}
コード例 #2
0
ファイル: EfbInterface.cpp プロジェクト: DigidragonZX/dolphin
	void BlendTev(u16 x, u16 y, u8 *color)
	{
		u32 dstClr;
		u32 offset = GetColorOffset(x, y);

		u8 *dstClrPtr = (u8*)&dstClr;

		GetPixelColor(offset, dstClrPtr);

		if (bpmem.blendmode.blendenable)
		{
			if (bpmem.blendmode.subtract)
				SubtractBlend(color, dstClrPtr);
			else
				BlendColor(color, dstClrPtr);
		}
		else if (bpmem.blendmode.logicopenable)
		{
			LogicBlend(*((u32*)color), dstClr, bpmem.blendmode.logicmode);
		}
		else
		{
			dstClrPtr = color;
		}

		if (bpmem.dstalpha.enable)
			dstClrPtr[ALP_C] = bpmem.dstalpha.alpha;

		if (bpmem.blendmode.colorupdate)
		{
			if (bpmem.blendmode.alphaupdate)
				SetPixelAlphaColor(offset, dstClrPtr);
			else
				SetPixelColorOnly(offset, dstClrPtr);
		}
		else if (bpmem.blendmode.alphaupdate)
		{
			SetPixelAlphaOnly(offset, dstClrPtr[ALP_C]);
		}

		// branchless bounding box update
		PixelEngine::bbox[0] = std::min(x, PixelEngine::bbox[0]);
		PixelEngine::bbox[1] = std::max(x, PixelEngine::bbox[1]);
		PixelEngine::bbox[2] = std::min(y, PixelEngine::bbox[2]);
		PixelEngine::bbox[3] = std::max(y, PixelEngine::bbox[3]);
	}
コード例 #3
0
ファイル: EfbInterface.cpp プロジェクト: Annovae/dolphin
	void BlendTev(u16 x, u16 y, u8 *color)
	{
		u32 dstClr;
		u32 offset = GetColorOffset(x, y);

		u8 *dstClrPtr = (u8*)&dstClr;

		GetPixelColor(offset, dstClrPtr);

		if (bpmem.blendmode.blendenable)
		{
			if (bpmem.blendmode.subtract)
				SubtractBlend(color, dstClrPtr);
			else
				BlendColor(color, dstClrPtr);
		}
		else if (bpmem.blendmode.logicopenable)
		{
			LogicBlend(*((u32*)color), dstClr, bpmem.blendmode.logicmode);
		}
		else
		{
			dstClrPtr = color;
		}

		if (bpmem.dstalpha.enable)
			dstClrPtr[ALP_C] = bpmem.dstalpha.alpha;

		if (bpmem.blendmode.colorupdate)
		{
			if (bpmem.blendmode.alphaupdate)
				SetPixelAlphaColor(offset, dstClrPtr);
			else
				SetPixelColorOnly(offset, dstClrPtr);
		}
		else if (bpmem.blendmode.alphaupdate)
		{
			SetPixelAlphaOnly(offset, dstClrPtr[ALP_C]);
		}

		// branchless bounding box update
		SWPixelEngine::pereg.boxLeft = SWPixelEngine::pereg.boxLeft>x?x:SWPixelEngine::pereg.boxLeft;
		SWPixelEngine::pereg.boxRight = SWPixelEngine::pereg.boxRight<x?x:SWPixelEngine::pereg.boxRight;
		SWPixelEngine::pereg.boxTop = SWPixelEngine::pereg.boxTop>y?y:SWPixelEngine::pereg.boxTop;
		SWPixelEngine::pereg.boxBottom = SWPixelEngine::pereg.boxBottom<y?y:SWPixelEngine::pereg.boxBottom;
	}
コード例 #4
0
ファイル: title_bar.cpp プロジェクト: CyberShadow/graphstudio
	void TitleBar::DoPaint(CDC *dc, int cx, int cy)
	{
		int			x,y;
		BITMAP		b;
		GetObject(backbuffer, sizeof(b), &b);

		cy -= 1;

		// draw gradient
		int			stride = (b.bmWidthBytes / 4);
		DWORD		*pix = (DWORD*)(b.bmBits);
		DWORD		base_color;
		DWORD		color;
		int			y_mid = cy/2;

		for (y=0; y<cy; y++) {
			DWORD	*line = pix + y*stride;
			DWORD	glow_color;
			int		glow_alpha;

			// calculate glow parameters
			if (y < y_mid) {
				glow_color = col_glow_up;
				glow_alpha = (topfade_up + (((topfade_bottom-topfade_up)*(y+1))/y_mid));
			} else {
				glow_color = col_glow_bottom;
				glow_alpha = (bottomfade_up + (((bottomfade_bottom-bottomfade_up)*(y-y_mid+1))/y_mid));

				float	temp = glow_alpha / 256.0;
				temp = pow((float)temp, (float)3.0);
				glow_alpha = temp * 255.0;
			}

			for (x=0; x<cx; x++) {

				// base gradient color
				base_color = BlendColor(col_left, col_right, (x+1)*255/cx);
				color = BlendColor(base_color, glow_color, glow_alpha);

				line[x] = color;
			}
		}

		// draw border lines
		DWORD	*line1 = pix + 0*stride;
		DWORD	*line2 = pix + (cy-1)*stride;
		for (x=0; x<cx; x++) {
			line1[x] = BlendColor(line1[x], MAKECOLOR(255,255,255), 100);
			line2[x] = BlendColor(line2[x], MAKECOLOR(255,255,255), 100);
		}
		for (y=0; y<cy; y++) {
			line1 = pix + y*stride;
			line1[0]    = BlendColor(line1[0],    MAKECOLOR(255,255,255), 100);
			line1[cx-1] = BlendColor(line1[cx-1], MAKECOLOR(255,255,255), 100);
		}

		cy += 1;

		// black line at the bottom
		line1 = pix + (cy-1)*stride;
		for (x=0; x<cx; x++) {
			line1[x] = 0;
		}
	}