void image::render(HDC hdc, int sourX, int sourY, int sourWidth, int sourHeight)
{
	if (_trans)
	{
		//TransparentBlt도 있다
		//
		GdiTransparentBlt(hdc,	//복사할 장소의 DC
			(int)_imageInfo->x,	//복사될 좌표 시작점 X
			(int)_imageInfo->y,	//복사될 좌표 시작점 Y
			sourWidth,			//복사될 크기 width
			sourHeight,			//복사될 크기 height
			_imageInfo->hMemDC,	//복사대상 DC,
			sourX,				//복사 시작지점 x
			sourY,				//복사 시작지점 y
			sourWidth,			//복사될 영역지정 width
			sourHeight,			//복사될 영역지정 height
			_transColor);		//복사에서 제외할 색상 지정
	}
	else 
	{
		//BitBlt 는 DC간의 영역끼리 서로 고속복사를 해주는 함수이다.
		BitBlt(hdc, (int)_imageInfo->x, (int)_imageInfo->y, 
			sourWidth, sourHeight, 
			_imageInfo->hMemDC, sourX, sourY, SRCCOPY);
	}
}
void image::alphaRender(HDC hdc, int destX, int destY, int sourX, int sourY, int sourWidth, int sourHeight, bool reverse, BYTE alpha, BOOL bAlphaFormat)
{
	_blendFunc.SourceConstantAlpha = alpha;
	if (bAlphaFormat) _blendFunc.AlphaFormat = AC_SRC_ALPHA;

	HDC hTempDC;
	if (reverse)
	{
		hTempDC = _imageInfo->hMemDC2;
	}
	else
	{
		hTempDC = _imageInfo->hMemDC;
	}
	if (_trans)
	{
		//출력해야될DC에 그려져있는 내용을 Blend에 그린다.
		BitBlt(_blendImage->hMemDC, 0, 0, _imageInfo->width, _imageInfo->height,
			hdc, destX, destY, SRCCOPY);

		//출력해야될 이미지를 Blend에 그린다.
		GdiTransparentBlt(_blendImage->hMemDC, 0, 0, sourWidth, sourHeight,
			hTempDC, sourX, sourY, sourWidth, sourHeight, _transColor);

		//BlendDC를 출력해야 될 DC에 그린다.
		AlphaBlend(hdc, destX, destY, sourWidth, sourHeight, _blendImage->hMemDC,
			0, 0, sourWidth, sourHeight, _blendFunc);
	}
	else
	{
		AlphaBlend(hdc, destX, destY, sourWidth, sourHeight, hTempDC,
			sourX, sourY, sourWidth, sourHeight, _blendFunc);
	}
}
void image::render(HDC hdc, int destX, int destY)
{
	if (_trans)
	{
		//TransparentBlt도 있다
		//
		GdiTransparentBlt(hdc,	//복사할 장소의 DC
			destX,				//복사될 좌표 시작점 X
			destY,				//복사될 좌표 시작점 Y
			_imageInfo->width,	//복사될 크기 width
			_imageInfo->height,	//복사될 크기 height
			_imageInfo->hMemDC,	//복사대상 DC,
			0, 0,				//복사 시작지점
			_imageInfo->width,	//복사될 영역지정 width
			_imageInfo->height,	//복사될 영역지정 height
			_transColor);		//복사에서 제외할 색상 지정
	}
	else 
	{
		//BitBlt 는 DC간의 영역끼리 서로 고속복사를 해주는 함수이다.
		BitBlt(hdc, destX, destY, 
			_imageInfo->width, _imageInfo->height, 
			_imageInfo->hMemDC, 0, 0, SRCCOPY);
	}
}
Beispiel #4
0
void cImage::Draw( HDC hdc, int x, int y, RECT& rcSour )
{
	DWORD sourW = rcSour.right - rcSour.left;
	DWORD sourH = rcSour.bottom - rcSour.top;
	DWORD sourX = rcSour.left;
	DWORD sourY = rcSour.top;

	//뺄컬러키가 없다면
	if( m_TransColorKey == -1 ){

		BitBlt(
			hdc,			//Target DC
			x, y,			//Target DC 위치
			sourW, sourH,   //그리기 가로세로 량
			m_BitDC,		//Source DC
			sourX, sourY,	//Source 시잣 위치
			SRCCOPY			//복사 옵션
			);
	}

	//뺄컬러가 있다면..
	else{

		GdiTransparentBlt(
			hdc,			//Target DC
			x, y,			//Target DC 위치
			sourW, sourH,   //크리기 가로세로 량
			m_BitDC,		//Source DC
			sourX, sourY,	//Source 시작
			sourW, sourH,
			m_TransColorKey );
	}
}
Beispiel #5
0
//비트맵 그리기
void cImage::Draw( HDC hdc, int x, int y )
{
	//뺄컬러키가 없다면
	if( m_TransColorKey == -1 ){
		BitBlt(
			hdc,			//Target DC
			x, y,			//Target DC 위치
			m_dwWidth, m_dwHeight,  //크리기 가로세로 량
			m_BitDC,		//Source DC
			0, 0,			//Source 시잣 위치
			SRCCOPY			//복사 옵션
			);
	}

	//뺄컬러가 있다면..
	else{
		GdiTransparentBlt(
			hdc,			//Target DC
			x, y,			//Target DC 위치
			m_dwWidth, m_dwHeight,  //크리기 가로세로 량
			m_BitDC,		//Source DC
			0, 0,			//Source 시작
			m_dwWidth, m_dwHeight,
			m_TransColorKey );
	}




}
Beispiel #6
0
void cImage::Draw( HDC hdc, int x, int y, int sourX, int sourY, int sourW, int sourH )
{
	//뺄컬러키가 없다면
	if( m_TransColorKey == -1 ){

		BitBlt(
			hdc,			//Target DC
			x, y,			//Target DC 위치
			sourW, sourH,   //그리기 가로세로 량
			m_BitDC,		//Source DC
			sourX, sourY,	//Source 시잣 위치
			SRCCOPY			//복사 옵션
			);
	}

	//뺄컬러가 있다면..
	else{

		GdiTransparentBlt(
			hdc,			//Target DC
			x, y,			//Target DC 위치
			sourW, sourH,   //크리기 가로세로 량
			m_BitDC,		//Source DC
			sourX, sourY,	//Source 시작
			sourW, sourH,
			m_TransColorKey );
	}

}
Beispiel #7
0
void image::frameRender(HDC hdc, int destX, int destY, int currentFrameX, int currentFrameY)
{
	_imageInfo->currentFrameX = currentFrameX;
	_imageInfo->currentFrameY = currentFrameY;

	if (currentFrameX > _imageInfo->maxFrameX) _imageInfo->currentFrameX = _imageInfo->maxFrameX;
	if (currentFrameY > _imageInfo->maxFrameY) _imageInfo->currentFrameY = _imageInfo->maxFrameY;

	if (_trans)
	{
		GdiTransparentBlt(hdc, destX, destY,
			_imageInfo->frameWidth, _imageInfo->frameHeight,
			_imageInfo->hMemDC,
			currentFrameX * _imageInfo->frameWidth,
			currentFrameY * _imageInfo->frameHeight,
			_imageInfo->frameWidth, _imageInfo->frameHeight, _transColor);
	}
	else
	{
		BitBlt(hdc, destX, destY, _imageInfo->frameWidth, _imageInfo->frameHeight,
			_imageInfo->hMemDC,
			_imageInfo->currentFrameX * _imageInfo->frameWidth,
			_imageInfo->currentFrameY * _imageInfo->frameHeight, SRCCOPY);
	}

}
Beispiel #8
0
void image::alphaRender(HDC hdc, int destX, int destY, int sourX, int sourY, int sourWidth, int sourHeight, BYTE alpha)
{
	if (!_blendImage) alphaInit();
	_blendFunc.SourceConstantAlpha = alpha;

	if (_trans)
	{
		//출력해야 될 DC에 그려져 있는 내용을 blend에 그려준다
		BitBlt(_blendImage->hMemDC, 0, 0, _imageInfo->width, _imageInfo->height,
			hdc, destX, destY, SRCCOPY);

		//출력해야 될 이미지를 blend에 그려준다
		GdiTransparentBlt(_blendImage->hMemDC, 0, 0, sourWidth, sourHeight,
			_imageInfo->hMemDC, sourX, sourY, sourWidth, sourHeight, _transColor);

		//blendDC를 출력해야 될 DC에 그린다
		AlphaBlend(hdc, destX, destY, sourWidth, sourHeight,
			_blendImage->hMemDC, 0, 0, sourWidth, sourHeight, _blendFunc);
	}
	else
	{
		AlphaBlend(hdc, destX, destY, sourWidth, sourHeight,
			_imageInfo->hMemDC, sourX, sourY, sourWidth, sourHeight, _blendFunc);
	}
}
Beispiel #9
0
void cImage::DrawAlpha( HDC hdc, int x, int y, RECT& rcSour, BYTE alpha)
{

	DWORD sourW = rcSour.right - rcSour.left;
	DWORD sourH = rcSour.bottom - rcSour.top;
	DWORD sourX = rcSour.left;
	DWORD sourY = rcSour.top;


	m_BlendFunc.SourceConstantAlpha = alpha;

	//컬러키값이 있을때....
	if( m_TransColorKey != -1 ){

		//1. hdc TargetDC 내용을 BlendDC 에 그린다.
		BitBlt( 
			m_BlendDC, 
			0, 0, sourW, sourH,
			hdc, x, y, SRCCOPY );

		//2. Sour의 내용을 BlendDC 에 그린다.
		GdiTransparentBlt(
			m_BlendDC,				//Target DC
			0, 0,					//Target DC 위치
			sourW, sourH,  //크리기 가로세로 량
			m_BitDC,				//Source DC
			sourX, sourY,					//Source 시작
			sourW, sourH,
			m_TransColorKey );

		//3. BlendDC 의 내용을 hdc 에 Alpha 블렌드로 그린다.
		GdiAlphaBlend(
			hdc, 
			x, y, 
			sourW, sourH,
			m_BlendDC, 
			0, 0,
			sourW, sourH,
			m_BlendFunc );

	}

	//컬러 키 값이 없을때..
	else{
		GdiAlphaBlend(
			hdc, 
			x, y, 
			sourW, sourH,
			m_BitDC, 
			sourX, sourY,
			sourW, sourH,
			m_BlendFunc );

	}
}
Beispiel #10
0
void cImage::DrawAlpha( HDC hdc, int x, int y, BYTE alpha )
{
	m_BlendFunc.SourceConstantAlpha = alpha;

	//컬러키값이 있을때....
	if( m_TransColorKey != -1 ){
		
		//1. hdc TargetDC 내용을 BlendDC 에 그린다.
		BitBlt( 
			m_BlendDC, 
			0, 0, m_dwWidth, m_dwHeight,
			hdc, x, y, SRCCOPY );

		//2. Sour의 내용을 BlendDC 에 그린다.
		GdiTransparentBlt(
			m_BlendDC,				//Target DC
			0, 0,					//Target DC 위치
			m_dwWidth, m_dwHeight,  //크리기 가로세로 량
			m_BitDC,				//Source DC
			0, 0,					//Source 시작
			m_dwWidth, m_dwHeight,
			m_TransColorKey );

		//3. BlendDC 의 내용을 hdc 에 Alpha 블렌드로 그린다.
		GdiAlphaBlend(
			hdc, 
			x, y, 
			m_dwWidth, m_dwHeight,
			m_BlendDC, 
			0, 0, 
			m_dwWidth, m_dwHeight,
			m_BlendFunc );
	}

	//컬러 키 값이 없을때..
	else{
		GdiAlphaBlend(
			hdc, 
			x, y, 
			m_dwWidth, m_dwHeight,
			m_BitDC, 
			0, 0, 
			m_dwWidth, m_dwHeight,
			m_BlendFunc );

	}
}
//프레임 렌더
void image::frameRender(HDC hdc, int destX, int destY)
{
	if(_trans)
	{
		GdiTransparentBlt(hdc, destX, destY, _imageInfo->frameWidth, _imageInfo->frameHeight,
			_imageInfo->hMemDC, _imageInfo->currentFrameX * _imageInfo->frameWidth,
			_imageInfo->currentFrameY * _imageInfo->frameHeight, _imageInfo->frameWidth, 
			_imageInfo->frameHeight, _transColor);	
	}

	else
	{
		BitBlt(hdc, destX, destY, _imageInfo->frameWidth, _imageInfo->frameHeight,
			_imageInfo->hMemDC, _imageInfo->currentFrameX * _imageInfo->frameWidth,
			_imageInfo->currentFrameY * _imageInfo->frameHeight, SRCCOPY);
	}
}
Beispiel #12
0
//렌더
void image::render( HDC hdc, int destX, int destY )
{
	if (_trans)
	{
		GdiTransparentBlt(
			hdc,				//복사할 장소의 DC
			destX,				//복사될 좌표 시작X
			destY,				//복사될 좌표 시작Y
			_imageInfo->width,	//복사될 크기 width
			_imageInfo->height,	//복사될 크기 height
			_imageInfo->hMemDC,	//복사할 DC
			0, 0,				//복사 시작지점 x, y
			_imageInfo->width,	//복사할 크기 width
			_imageInfo->height,	//복사할 크기 height
			_transColor);		//복사에서 제외할 색상
	}
	else
	{
		BitBlt(hdc, destX, destY, _imageInfo->width, _imageInfo->height,
			_imageInfo->hMemDC, 0, 0, SRCCOPY);
	}
}
Beispiel #13
0
void image::render(HDC hdc, int destX, int destY, int sourX, int sourY, int sourWidth, int sourHeight)
{
	if (_trans)
	{
		GdiTransparentBlt(
			hdc,				//복사할 장소의 DC
			destX,				//복사될 좌표 시작X
			destY,				//복사될 좌표 시작Y
			sourWidth,			//복사될 크기 width
			sourHeight,			//복사될 크기 height
			_imageInfo->hMemDC,	//복사할 DC
			sourX, sourY,		//복사 시작지점 x, y
			sourWidth,			//복사할 크기 width
			sourHeight,			//복사할 크기 height
			_transColor);		//복사에서 제외할 색상
	}
	else
	{
		BitBlt(hdc, destX, destY, sourWidth, sourHeight,
			_imageInfo->hMemDC, sourX, sourY, SRCCOPY);
	}
}
//알파렌더
void image::alphaRender(HDC hdc, BYTE alpha)
{
	_blendFunc.SourceConstantAlpha = alpha;

	if (_trans)
	{
		//출력해야될DC에 그려져있는 내용을 Blend에 그린다.
		BitBlt(_blendImage->hMemDC, 0, 0, _imageInfo->width, _imageInfo->height,
			hdc, (int)_imageInfo->x, (int)_imageInfo->y, SRCCOPY);

		//출력해야될 이미지를 Blend에 그린다.
		GdiTransparentBlt(_blendImage->hMemDC, 0, 0, _imageInfo->width, _imageInfo->height,
			_imageInfo->hMemDC, 0, 0, _imageInfo->width, _imageInfo->height, _transColor);

		//BlendDC를 출력해야 될 DC에 그린다.
		AlphaBlend(hdc, (int)_imageInfo->x, (int)_imageInfo->y, _imageInfo->width, _imageInfo->height, _blendImage->hMemDC,
			0, 0, _imageInfo->width, _imageInfo->height, _blendFunc);
	}
	else
	{
		AlphaBlend(hdc, (int)_imageInfo->x, (int)_imageInfo->y, _imageInfo->width, _imageInfo->height, _blendImage->hMemDC,
			0, 0, _imageInfo->width, _imageInfo->height, _blendFunc);
	}
}
void image::render(HDC hdc, int destX, int destY,
	int sourX, int sourY, int sourWidth, int sourHeight, bool reverse)
{
	HDC hTempDC;
	if (reverse)
	{
		hTempDC = _imageInfo->hMemDC2;
	}
	else
	{
		hTempDC = _imageInfo->hMemDC;
	}
	if (_trans)
	{
		//TransparentBlt도 있다
		//
		GdiTransparentBlt(hdc,	//복사할 장소의 DC
			destX,				//복사될 좌표 시작점 X
			destY,				//복사될 좌표 시작점 Y
			sourWidth,			//복사될 크기 width
			sourHeight,			//복사될 크기 height
			hTempDC,			//복사대상 DC,
			sourX,				//복사 시작지점 x
			sourY,				//복사 시작지점 y
			sourWidth,			//복사될 영역지정 width
			sourHeight,			//복사될 영역지정 height
			_transColor);		//복사에서 제외할 색상 지정
	}
	else
	{
		//BitBlt 는 DC간의 영역끼리 서로 고속복사를 해주는 함수이다.
		BitBlt(hdc, destX, destY,
			sourWidth, sourHeight,
			hTempDC, sourX, sourY, SRCCOPY);
	}
}
Beispiel #16
0
static VOID
DrawBackgroundPreview(LPDRAWITEMSTRUCT draw, PDATA pData)
{
    float scaleX;
    float scaleY;
    int scaledWidth;
    int scaledHeight;
    int posX, desX;
    int posY, desY;
    HBRUSH hBrush;
    int x;
    int y;
    HDC hDC;
    HGDIOBJ hOldObj;
    RECT rcItem = {
        MONITOR_LEFT,
        MONITOR_TOP,
        MONITOR_RIGHT,
        MONITOR_BOTTOM
    };

    hDC = CreateCompatibleDC(draw->hDC);
    hOldObj = SelectObject(hDC, pData->hBitmap);

    if (pData->backgroundItems[pData->backgroundSelection].bWallpaper == FALSE)
    {
        /* Update desktop background color image */
        hBrush = CreateSolidBrush(g_GlobalData.desktop_color);
        FillRect(hDC, &rcItem, hBrush);
        DeleteObject(hBrush);
    }
    else
    if (pData->pWallpaperBitmap != NULL)
    {
        scaleX = ((float)GetSystemMetrics(SM_CXSCREEN) - 1) / (float)MONITOR_WIDTH;
        scaleY = ((float)GetSystemMetrics(SM_CYSCREEN) - 1) / (float)MONITOR_HEIGHT;

        scaledWidth = (int)(pData->pWallpaperBitmap->width / scaleX);
        scaledHeight = (int)(pData->pWallpaperBitmap->height / scaleY);

        FillRect(hDC, &rcItem, GetSysColorBrush(COLOR_BACKGROUND));

        SetStretchBltMode(hDC, COLORONCOLOR);

        switch (pData->placementSelection)
        {
            case PLACEMENT_CENTER:
                posX = (MONITOR_WIDTH - scaledWidth + 1) / 2;
                posY = (MONITOR_HEIGHT - scaledHeight + 1) / 2;
                desX = 0;
                desY = 0;

                if (posX < 0) { desX = -posX / 2; posX = 0; }
                if (posY < 0) { desY = -posY / 2; posY = 0; }

                if (scaledWidth > MONITOR_WIDTH)
                    scaledWidth = MONITOR_WIDTH;

                if (scaledHeight > MONITOR_HEIGHT)
                    scaledHeight = MONITOR_HEIGHT;

                StretchDIBits(hDC,
                              MONITOR_LEFT+posX,
                              MONITOR_TOP+posY,
                              scaledWidth,
                              scaledHeight,
                              desX,
                              desY,
                              pData->pWallpaperBitmap->width - (int)(desX * scaleX),
                              pData->pWallpaperBitmap->height - (int)(desY * scaleY),
                              pData->pWallpaperBitmap->bits,
                              pData->pWallpaperBitmap->info,
                              DIB_RGB_COLORS,
                              SRCCOPY);
                break;

            case PLACEMENT_STRETCH:
                StretchDIBits(hDC,
                              MONITOR_LEFT,
                              MONITOR_TOP,
                              MONITOR_WIDTH,
                              MONITOR_HEIGHT,
                              0,
                              0,
                              pData->pWallpaperBitmap->width,
                              pData->pWallpaperBitmap->height,
                              pData->pWallpaperBitmap->bits,
                              pData->pWallpaperBitmap->info,
                              DIB_RGB_COLORS,
                              SRCCOPY);
                break;

            case PLACEMENT_TILE:
                for (y = 0; y < MONITOR_HEIGHT; y += scaledHeight)
                {
                    for (x = 0; x < MONITOR_WIDTH; x += scaledWidth)
                    {
                        if ((MONITOR_WIDTH-x) >= scaledWidth)
                            posX = scaledWidth;
                        else
                            posX = MONITOR_WIDTH-x;


                        if ((MONITOR_HEIGHT-y) >= scaledHeight)
                            posY = scaledHeight;
                        else
                            posY = MONITOR_HEIGHT-y;

                        StretchDIBits(hDC,
                                      MONITOR_LEFT + x,
                                      MONITOR_TOP + y,
                                      posX,
                                      posY,
                                      0,
                                      0,
                                      pData->pWallpaperBitmap->width * posX / scaledWidth,
                                      pData->pWallpaperBitmap->height * posY / scaledHeight,
                                      pData->pWallpaperBitmap->bits,
                                      pData->pWallpaperBitmap->info,
                                      DIB_RGB_COLORS,
                                      SRCCOPY);
                    }

                }

                break;
        }
    }

    GdiTransparentBlt(draw->hDC,
                      draw->rcItem.left, draw->rcItem.top,
                      draw->rcItem.right-draw->rcItem.left+1,
                      draw->rcItem.bottom-draw->rcItem.top+1,
                      hDC,
                      0, 0,
                      pData->cxSource, pData->cySource,
                      0xFF00FF);

    SelectObject(hDC, hOldObj);
    DeleteDC(hDC);
}