void DrawBitmapFrameCustom2( CCDrawContext* pDC, sRect& r, CCBitmap* Bms[9], sColor bgColor, bool bStretch /* = true */) { // pDC->SetOpacity(255); // Fill Background pDC->SetColor( bgColor ); pDC->FillRectangle(r); //Draw Top Frame HLineBitmap(pDC, r.x, r.y, r.w, Bms[7], bStretch ); int h = Bms[1]->GetHeight(); //Draw Bottom Frame HLineBitmap( pDC, r.x, r.y+r.h - h, r.w, Bms[1], bStretch ); }
void DrawBitmapButtonCustom1( CCDrawContext* pDC, sRect& r, CCBitmap* Bms[9], bool bDown, bool bStretch ) { int bx,by; if( bDown ) { bx = r.x + 1; by = r.y + 1; } else { bx = r.x; by = r.y; } // pDC->SetOpacity(255); //쉐도우 pDC->SetColor(10, 10, 10, 255); pDC->FillRectangle( r.x+2, r.y+2, r.w, r.h ); // 아웃라인 pDC->SetColor( 0, 0, 0, 255 ); pDC->FillRectangle( bx - 1, by - 1, r.w + 1, r.h + 1); //버튼 그리기 HLineBitmap( pDC, bx, by, r.w, Bms[4], bStretch ); }
void CCBButtonLook::OnDraw( CCButton* pButton, CCDrawContext* pDC ) { if(GetWireLook()) // 위젯의 오른쪽에 붙는 방식일 경우에... { sRect rect = pButton->GetInitialClientRect(); // 배경 그리고... pDC->SetColor(19,19,19,255); pDC->FillRectangle( rect); // 버튼이 그려질 크기를 구한다. sRect rectButtonBmp; rectButtonBmp.x = rect.x + rect.w - rect.h + 1; // 버튼이 그려질 시작 위치를 구한다. rectButtonBmp.y = rect.y + 1; // 테두리 두께(1 pixel)때문에 1 pixel 아래로 내려서 그린다. rectButtonBmp.w = rect.h - 2; // 위젯의 높이를 기준으로 폭과 높이를 맞춘다. rectButtonBmp.h = rect.h - 2; // 위젯의 높이를 기준으로 폭과 높이를 맞춘다. float fScale = (float)(rect.h - 2) / (float)m_pDownBitmaps[1]->GetHeight(); // 버튼의 비트맵을 그린다 if( pButton->GetComboDropped() ) { HLineBitmap( pDC, rectButtonBmp.x, rectButtonBmp.y, rectButtonBmp.w, m_pDownBitmaps[2], false, fScale); } else { if( pButton->IsFocus() ) HLineBitmap( pDC, rectButtonBmp.x, rectButtonBmp.y, rectButtonBmp.w, m_pDownBitmaps[0], false, fScale); else HLineBitmap( pDC, rectButtonBmp.x, rectButtonBmp.y, rectButtonBmp.w, m_pDownBitmaps[1], false, fScale); } sRect rectText = rect; rectText.w -= rect.h; pDC->SetColor(205,205,205,255); pDC->Text(rectText, pButton->m_szName, pButton->GetAlignment() ); // 테두리 그리고... pDC->SetColor(205,205,205,255); pDC->Rectangle( rect); } else CCButtonLook::OnDraw( pButton, pDC ); }
void DrawBitmapFrameCustom1( CCDrawContext* pDC, sRect& r, CCBitmap* Bms[9], bool bStretch /* = true */ ) { int upperFrame[2]; upperFrame[0] = GETWIDTH(Bms[7]); upperFrame[1] = GETHEIGHT(Bms[7]); // pDC->SetOpacity(255); // Fill Frame innerSpace pDC->SetColor( 19,19,19,255); pDC->FillRectangle( r.x + FRAME_OUTLINE_WIDTH, r.y+FRAME_OUTLINE_WIDTH, r.w - 2*FRAME_OUTLINE_WIDTH, r.h - 2*FRAME_OUTLINE_WIDTH); //Draw Gradiation HLineBitmap(pDC, r.x+FRAME_OUTLINE_WIDTH+FRAME_WIDTH, r.y+FRAME_OUTLINE_WIDTH+upperFrame[1], r.w-2*FRAME_OUTLINE_WIDTH-2*FRAME_WIDTH, Bms[4], false); //Fill Frame OutLine... pDC->SetColor(10,10,10,255); //pDC->FillRectangle( r.x, r.y, r.w, r.h ); pDC->FillRectangle( r.x, r.y, r.w, FRAME_OUTLINE_WIDTH ); pDC->FillRectangle( r.x, r.y, FRAME_OUTLINE_WIDTH, r.h ); pDC->FillRectangle( r.x + r.w - FRAME_OUTLINE_WIDTH, r.y, FRAME_OUTLINE_WIDTH, r.h ); pDC->FillRectangle( r.x, r.y + r.h - FRAME_OUTLINE_WIDTH, r.w, FRAME_OUTLINE_WIDTH ); // //Draw Frame HLineBitmap(pDC, r.x+FRAME_OUTLINE_WIDTH, r.y+FRAME_OUTLINE_WIDTH, r.w-2*FRAME_OUTLINE_WIDTH, Bms[7], bStretch); // pDC->SetColor(61,61,61,255); pDC->FillRectangle( r.x+FRAME_OUTLINE_WIDTH, r.y+FRAME_OUTLINE_WIDTH+upperFrame[1], FRAME_WIDTH, r.h-(upperFrame[1]+FRAME_OUTLINE_WIDTH*2) ); pDC->FillRectangle( r.x + r.w - FRAME_OUTLINE_WIDTH-FRAME_WIDTH, r.y+upperFrame[1]+FRAME_OUTLINE_WIDTH, FRAME_WIDTH, r.h-(upperFrame[1]+FRAME_OUTLINE_WIDTH*2)); pDC->FillRectangle( r.x+FRAME_OUTLINE_WIDTH+FRAME_WIDTH, r.y + r.h - FRAME_OUTLINE_WIDTH-FRAME_WIDTH, r.w-2*FRAME_OUTLINE_WIDTH-2*FRAME_WIDTH, FRAME_WIDTH ); // // Draw inOutline pDC->SetColor( 0,0,0,255); pDC->FillRectangle( r.x + FRAME_OUTLINE_WIDTH + FRAME_WIDTH, r.y+FRAME_OUTLINE_WIDTH + upperFrame[1], r.w - 2*FRAME_OUTLINE_WIDTH - 2*FRAME_WIDTH, FRAME_INLINE_WIDTH); pDC->FillRectangle( r.x + FRAME_OUTLINE_WIDTH + FRAME_WIDTH, r.y+r.h - FRAME_OUTLINE_WIDTH -FRAME_WIDTH - FRAME_INLINE_WIDTH, r.w - 2*FRAME_OUTLINE_WIDTH - 2*FRAME_WIDTH, FRAME_INLINE_WIDTH); pDC->FillRectangle( r.x + FRAME_OUTLINE_WIDTH + FRAME_WIDTH,r.y+FRAME_OUTLINE_WIDTH + upperFrame[1], FRAME_INLINE_WIDTH, r.h-upperFrame[1]-2*FRAME_OUTLINE_WIDTH-FRAME_WIDTH); pDC->FillRectangle( r.x + r.w - FRAME_OUTLINE_WIDTH - FRAME_WIDTH-FRAME_INLINE_WIDTH, r.y+FRAME_OUTLINE_WIDTH + upperFrame[1]+FRAME_INLINE_WIDTH, FRAME_INLINE_WIDTH, r.h-upperFrame[1]-4*FRAME_OUTLINE_WIDTH-FRAME_WIDTH); }
void MBEditLook::OnFrameDraw(MEdit* pEdit, MDrawContext* pDC) { MRECT r = pEdit->GetInitialClientRect(); if(GetCustomLook()) { pDC->SetColor(MCOLOR(200,200,200,255)); pDC->Rectangle(r); HLineBitmap( pDC, r.x+1, r.y+1, r.w-2, m_pFrameBitmaps[4], false ); return; } DrawBitmapFrame9(pDC, r, m_pFrameBitmaps); }
void DrawBitmapFrame9(CCDrawContext* pDC, sRect& r, CCBitmap* Bms[9],bool bStretch,float fScale) { //if(IsNull(Bms, 9)==true) return; /* 6 7 8 3 4 5 0 1 2 */ int add_h = 0;//버튼이 너무 작아졌을때 뭉개지는것 우선 땜질~ //if(button && (r.h < 24)) add_h = 1; int bmw[9] = {0,}; int bmh[9] = {0,}; int dtw[9] = {0,}; // scale 이 감안된 크기 int dth[9] = {0,}; for(int i=0; i<9; i++){ bmw[i] = GETWIDTH(Bms[i]); bmh[i] = GETHEIGHT(Bms[i]); dtw[i] = (int)(fScale * bmw[i]); dth[i] = (int)(fScale * bmh[i]); } // Body(4) pDC->SetBitmap(Bms[4]); int bdw = dtw[4]; int bdh = dth[4]; int sx = min(min(dtw[3], dtw[0]), dtw[6]); int sy = min(min(dth[7], dth[6]), dth[8]); int ex = min(min(dtw[5], dtw[8]), dtw[2]); int ey = min(min(dth[1], dth[0]), dth[2]); int bw = r.w-sx-ex; int bh = r.h-sy-ey; int wc = 0; if(bdw>0) wc = bw/bdw; int hc = 0; if(bdh>0) hc = bh/bdh; /* if(bw%bdw!=0) wc += 1; if(bh%bdh!=0) hc += 1; */ if (!bStretch) { for(int y=0; y<hc; y++){ for(int x=0; x<wc; x++){ pDC->Draw(r.x+sx+x*bdw, r.y+sy+y*bdh , bdw, bdh); } } // Bms[4] 크기로는 모자른 부분을 짤라서 맞춰 찍음 if(bdw>0 && (bw%bdw)>0){ for(int y=0; y<hc; y++){ //pDC->Draw(r.x+sx+bw-bdw, r.y+sy+y*bdh, true); pDC->Draw(r.x+sx+wc*bdw, r.y+sy+y*bdh, bw%bdw, bdh, 0, 0, bw%bdw, bdh); } } if(bdh>0 && (bh%bdh)>0){ for(int x=0; x<wc; x++){ //pDC->Draw(r.x+sx+x*bdw, r.y+sy+bh-bdh, true); pDC->Draw(r.x+sx+x*bdw, r.y+sy+hc*bdh, bdw, bh%bdh, 0, 0, bdw, bh%bdh); } } //모서리 if(bdw>0 && bdh>0 && (bw%bdw)>0 && (bh%bdh)>0){ pDC->Draw(r.x+sx+wc*bdw, r.y+sy+hc*bdh, bw%bdw, bh%bdh, 0, 0, bw%bdw, bh%bdh); //pDC->Draw(r.x+sx+bw-bdw, r.y+sy+bh-bdh, true); } } else { sRect rcClient = sRect(sx, sy, bw, bh); pDC->Draw(rcClient); } // Upper int uw = r.w - (dtw[6]+dtw[8]); HLineBitmap(pDC, r.x+dtw[6], r.y, uw, Bms[7], bStretch, fScale); // Bottom int dw = r.w - (dtw[0]+dtw[2]); HLineBitmap(pDC, r.x+dtw[0], r.y+r.h-dth[1], dw, Bms[1], bStretch, fScale); // Left int lh = r.h - (dth[0]+dth[6]); VLineBitmap(pDC, r.x, r.y+dth[6]+add_h, lh, Bms[3], bStretch, fScale); // Right int rh = r.h - (dth[2]+dth[8]); VLineBitmap(pDC, r.x+r.w-dtw[5], r.y+dth[8]+add_h, rh, Bms[5], bStretch, fScale); // 6 pDC->SetBitmap(Bms[6]); pDC->Draw(r.x, r.y, dtw[6], dth[6]); // 8 pDC->SetBitmap(Bms[8]); pDC->Draw(r.x+r.w-dtw[8], r.y, dtw[8], dth[8]); // 0 pDC->SetBitmap(Bms[0]); pDC->Draw(r.x, r.y+r.h-dth[0], dtw[0], dth[0]); // 2 pDC->SetBitmap(Bms[2]); pDC->Draw(r.x+r.w-dtw[2], r.y+r.h-dth[2], dtw[2], dth[2]); }