Exemplo n.º 1
0
void Vid::Update() {
	BackBuffer.Clear( RGB32( 255, 0, 0 ) );
	DrawRect( BackBuffer, RGB32( 0, 255, 0 ), 10, 10, 400, 200 );

	// Draw buffer to the screen
	HDC DC = GetDC( MainWindow );
	StretchDIBits( DC,
		0, 0, BufferWidth, BufferHeight,
		0, 0, BufferWidth, BufferHeight,
		BackBuffer, (BITMAPINFO*)&BitMapInfo,
		DIB_RGB_COLORS, SRCCOPY
		);
	ReleaseDC( MainWindow, DC );
}
Exemplo n.º 2
0
void ImageFormat_GIF::CopyPixels(unsigned int* destination)
	{
	if (!image_)
		{
		return;
		}

	MemSet(destination,0,GetWidth()*GetHeight()*GetCelCount()*sizeof(unsigned int));
	for (int i=0; i<GetCelCount(); i++)
		{
		GifLoader::Cel* cel=image_->cels_.Get(i);
		for (int y=0; y<cel->height; y++)
			{
			for (int x=0; x<cel->width; x++)
				{
				unsigned char p=cel->pixels[x+y*cel->width];
				if (cel->transparency!=p)
					{
					unsigned int c=cel->palette[p];
					unsigned char r=(unsigned char)((c&0x00ff0000)>>16);
					unsigned char g=(unsigned char)((c&0x0000ff00)>>8);
					unsigned char b=(unsigned char)((c&0x000000ff));
					destination[GetWidth()*GetHeight()*i+(x+cel->x)+(y+cel->y)*GetWidth()]=RGB32(r,g,b);
					}
				}
			}
		}
Exemplo n.º 3
0
void platycanvasdata::SetColor(byte r, byte g, byte b)
{
	const color_x888 RGB = RGB32(r, g, b);
	PenTool("Stroke").Notify("SetColor", RGB);

	const color_x888 HLS = ColorRGBToHLS(r, g, b);
	const byte Hue = BxDrawGlobal::ColorToRed(HLS);
	const byte Lightness = BxDrawGlobal::ColorToGreen(HLS);
	const byte Saturation = BxDrawGlobal::ColorToBlue(HLS);
	PenTool("Color").Notify("SetHue", Hue);
	PenTool("Color").Notify("SetLightness", Lightness);
    PenTool("Color").Notify("SetSaturation", Saturation);
}
Exemplo n.º 4
0
Arquivo: gdi.c Projeto: AMV007/FreeRDP
static void gdi_palette_update(rdpContext* context, PALETTE_UPDATE* palette)
{
	int index;
	PALETTE_ENTRY* pe;
	UINT32* palette32;
	rdpGdi* gdi = context->gdi;

	palette32 = (UINT32*) gdi->palette;

	for (index = 0; index < palette->number; index++)
	{
		pe = &(palette->entries[index]);
		palette32[index] = RGB32(pe->red, pe->green, pe->blue);
	}
}
Exemplo n.º 5
0
void xf_gdi_palette_update(rdpContext* context, PALETTE_UPDATE* palette)
{
	int index;
	PALETTE_ENTRY* pe;
	UINT32* palette32;
	xfContext* xfc = (xfContext*) context;

	xf_lock_x11(xfc, FALSE);

	palette32 = (UINT32*) xfc->palette;

	for (index = 0; index < palette->number; index++)
	{
		pe = &(palette->entries[index]);
		palette32[index] = RGB32(pe->red, pe->green, pe->blue);
	}

	xf_unlock_x11(xfc, FALSE);
}
Exemplo n.º 6
0
	sDefaultContext.cc_SetLowColor = Standard_SetLowColor;
	sDefaultContext.cc_SetOutlineColor = Standard_SetOutlineColor;
}


/************************ TrueColor-Amiga Context ************************/


static void
True_SetHighColor(struct RastPort *rp, ULONG id)
{
    ULONG red = (id >> 16) & 0xff;
    ULONG green = (id >> 8) & 0xff;
    ULONG blue = id & 0xff;

    SetRGB32(&scr->ViewPort, sTruePen, RGB32(red), RGB32(green), RGB32(blue));
	SetAPen(rp, sTruePen);
}


static void
True_SetLowColor(struct RastPort *rp, ULONG id)
{
    ULONG red = (id >> 16) & 0xff;
    ULONG green = (id >> 8) & 0xff;
    ULONG blue = id & 0xff;

    SetRGB32(&scr->ViewPort, sLowTruePen, RGB32(red), RGB32(green), RGB32(blue));
	SetBPen(rp, sLowTruePen);
}
Exemplo n.º 7
0
static UINT32 YUV_to_RGB(BYTE Y, BYTE U, BYTE V)
{
	BYTE R, G, B;

#if USE_GRAY_SCALE
	/*
	 * Displays the Y plane as a gray-scale image.
	 */
	R = Y;
	G = Y;
	B = Y;
#else
	int C, D, E;

#if 0
	/*
	 * Documented colorspace conversion from YUV to RGB.
	 * See http://msdn.microsoft.com/en-us/library/ms893078.aspx
	 */

	C = Y - 16;
	D = U - 128;
	E = V - 128;

	R = clip(( 298 * C           + 409 * E + 128) >> 8);
	G = clip(( 298 * C - 100 * D - 208 * E + 128) >> 8);
	B = clip(( 298 * C + 516 * D           + 128) >> 8);
#endif

#if 0
	/*
	 * These coefficients produce better results.
	 * See http://www.microchip.com/forums/m599060.aspx
	 */

	C = Y;
	D = U - 128;
	E = V - 128;

	R = clip(( 256 * C           + 359 * E + 128) >> 8);
	G = clip(( 256 * C -  88 * D - 183 * E + 128) >> 8);
	B = clip(( 256 * C + 454 * D           + 128) >> 8);
#endif

#if 1
	/*
	 * These coefficients produce excellent results.
	 */

	C = Y;
	D = U - 128;
	E = V - 128;

	R = clip(( 256 * C           + 403 * E + 128) >> 8);
	G = clip(( 256 * C -  48 * D - 120 * E + 128) >> 8);
	B = clip(( 256 * C + 475 * D           + 128) >> 8);
#endif

#endif

	return RGB32(R, G, B);
}