|
すみませんかき忘れです。
さっきの定義のところからGraphicEngine.cppになります。
ちなみにちゃんと#includeしています^^;
/*=================================================================================================
Change state
=================================================================================================*/
/*-------------------------------------------------------------------------------------------------
Change size
-------------------------------------------------------------------------------------------------*/
VOID ClassGraphicEngine::ChangeSize(INT cx,INT cy)
{
if (hBitmap)DeleteObject(this->hBitmap);
this->size.cx = cx;
this->size.cy = cy;
this->uiBitLength = size.cx * 3 + (4 - (size.cx * 3) % 4);
//--- Get device context ----------------------------------------------------------------------
HDC hDC = GetDC(this->hTargetWnd);
//--- Create DIB ------------------------------------------------------------------------------
this->lpBitmapInfo->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
this->lpBitmapInfo->bmiHeader.biWidth = cx;
this->lpBitmapInfo->bmiHeader.biHeight = cy;
this->lpBitmapInfo->bmiHeader.biPlanes = 1;
this->lpBitmapInfo->bmiHeader.biBitCount = DEFAULT_BIT_COUNT;
this->lpBitmapInfo->bmiHeader.biCompression = BI_RGB;
this->lpBitmapInfo->bmiHeader.biSizeImage = 0;
this->lpBitmapInfo->bmiHeader.biXPelsPerMeter = 0;
this->lpBitmapInfo->bmiHeader.biYPelsPerMeter = 0;
this->lpBitmapInfo->bmiHeader.biClrUsed = 0;
this->lpBitmapInfo->bmiHeader.biClrImportant = 0;
this->hBitmap = CreateDIBSection(hDC,this->lpBitmapInfo,DIB_RGB_COLORS,(LPVOID *)(&this->lpBit),NULL,0);
if (hBitmap == NULL){
DebugMessage("It failed in the initialization of the graphic engine.");
}
ReleaseDC(this->hTargetWnd,hDC);
}
/*=================================================================================================
Update
=================================================================================================*/
/*-------------------------------------------------------------------------------------------------
Transfer bit block
-------------------------------------------------------------------------------------------------*/
VOID ClassGraphicEngine::BitMove(HDC hDC,INT x,INT y,INT cx,INT cy)
{
if (hBitmap == NULL)return;
HDC hMemDC = CreateCompatibleDC(hDC);
SelectObject(hMemDC,this->hBitmap);
StretchBlt(hDC,x,y,cx,cy,hMemDC,0,0,this->size.cx,this->size.cy,SRCCOPY);
DeleteDC(hMemDC);
}
/*=================================================================================================
Update
=================================================================================================*/
/*-------------------------------------------------------------------------------------------------
Rectangle
-------------------------------------------------------------------------------------------------*/
VOID ClassGraphicEngine::DC_Rectangle(INT x,INT y,INT cx,INT cy,COLORREF color,DWORD uiAlfaPoint)
{
if (hBitmap == NULL)return;
POINT DrawPos;
DrawPos.x = x;
DrawPos.y = this->size.cy - y - cy;
//--- Get color -------------------------------------------------------------------------------
COLOR_RGB Rgb;
Rgb.bRed = GetRValue(color);
Rgb.bGreen = GetGValue(color);
Rgb.bBlue = GetBValue(color);
INT i,j;
for(j = DrawPos.y;j < DrawPos.y + cy;j++){
for(i = DrawPos.x;i < DrawPos.x + cx;i++){
*(this->lpBit + (this->uiBitLength * j) + (i * 3) + 0) = Rgb.bBlue;
*(this->lpBit + (this->uiBitLength * j) + (i * 3) + 1) = Rgb.bGreen;
*(this->lpBit + (this->uiBitLength * j) + (i * 3) + 2) = Rgb.bRed;
}
}
return;
}
VOID ClassGraphicEngine::DC_Rectangle(INT x,INT y,INT cy,INT cy,COLORREF color)
{
}
/**************************************************************************************************
File end
**************************************************************************************************/
|