// --------------------------------------------------------- // 名称: DrawBitmapItem // 功能: 绘制动画位图 // 参数: dc -- 相关DC,item --动画条项, ptNew -- 新位置 // bShow -- 是否显示 // 返回: 无 // 修改: 徐景周,2002.1.8 // --------------------------------------------------------- void CAnimationEngine::DrawBitmapItem( CDC& dc, CAnimationItem& item, CPoint ptNew, BOOL bShow ) { CPoint pt = item.m_pt; CRect rectBmp( 0, 0, item.m_pBitmap->GetWidth(), item.m_pBitmap->GetHeight() ); if ( item.m_nFirstPic != -1 ) { // 计算总帧位图中每一单帧小位图大小(单行总帧位图,其中每单帧位图长、宽需相等) int nWidth = rectBmp.Height(); rectBmp.right = nWidth; rectBmp.OffsetRect( item.m_nFirstPic*nWidth, 0 ); } CRect rect( 0,0,rectBmp.Width(),rectBmp.Height() ); rect.OffsetRect( pt ); if ( item.m_nEffects & item.AF_AlignCenter ) rect.OffsetRect( - rectBmp.Width()/2, 0 ); if ( ! bShow ) { // dc.FillRect( &rect, &m_brushBackground ); // 黑色背景添充,暂时去掉,jingzhou xu return; } if ( pt != ptNew ) { // Determine rects that need to be cleared CRect rectLeftOrRight( rect ), rectTopOrBottom( rect ); int nXDiff = ptNew.x - pt.x; int nYDiff = ptNew.y - pt.y; if ( nXDiff >= 0 ) // moving right rectLeftOrRight.right = rectTopOrBottom.left = rectLeftOrRight.left + nXDiff; else // moving left rectLeftOrRight.left = rectTopOrBottom.right = rectLeftOrRight.left + nXDiff; if ( nYDiff >= 0 ) // moving down rectTopOrBottom.bottom = rectTopOrBottom.top + nYDiff; else // moving up rectTopOrBottom.top = rectTopOrBottom.top + nYDiff; // dc.FillRect( &rectLeftOrRight, &m_brushBackground ); // 黑色背景添充,暂时去掉,jingzhou xu // dc.FillRect( &rectTopOrBottom, &m_brushBackground ); // 黑色背景添充,暂时去掉,jingzhou xu } rect.SetRect( 0,0,rectBmp.Width(),rectBmp.Height() ); rect.OffsetRect( ptNew ); if ( item.m_nEffects & item.AF_AlignCenter ) rect.OffsetRect( - rectBmp.Width()/2, 0 ); // item.m_pBitmap->DrawDIB( &dc, rect, rectBmp ); // 显示透明位图,jignzhou xu item.m_pBitmap->DrawTransparentBitmap( &dc, rect.left,rect.top); }
void draw(const RDPBitmapData & bitmap_data, const uint8_t * data, size_t size, const Bitmap & bmp) override { Rect rectBmp( bitmap_data.dest_left, bitmap_data.dest_top , bitmap_data.dest_right - bitmap_data.dest_left + 1 , bitmap_data.dest_bottom - bitmap_data.dest_top + 1); if (rectBmp.has_intersection(this->fg_rect)) { const subrect_t rect4 = this->subrect(rectBmp); this->front.flush(); this->mod.begin_update(); this->draw_bitmap_rect(rect4.top, rectBmp, bmp); this->draw_bitmap_rect(rect4.right, rectBmp, bmp); this->draw_bitmap_rect(rect4.bottom, rectBmp, bmp); this->draw_bitmap_rect(rect4.left, rectBmp, bmp); this->mod.end_update(); this->front.flush(); } else { this->mod.draw(bitmap_data, data, size, bmp); } }
void ProtectedGraphics::draw_impl(const RDPBitmapData & bitmap_data, const Bitmap & bmp) { Rect rectBmp( bitmap_data.dest_left, bitmap_data.dest_top , bitmap_data.dest_right - bitmap_data.dest_left + 1 , bitmap_data.dest_bottom - bitmap_data.dest_top + 1); if (rectBmp.has_intersection(this->protected_rect)) { this->drawable.begin_update(); for (const Rect & subrect : subrect4(rectBmp, this->protected_rect)) { if (!subrect.isempty()) { this->drawable.draw( RDPMemBlt(0, subrect, 0xCC, subrect.x - rectBmp.x, subrect.y - rectBmp.y, 0), subrect, bmp ); } } this->drawable.end_update(); } else { this->drawable.draw(bitmap_data, bmp); } }
void wxStdRenderer::DrawFrameButton(wxDC& dc, wxCoord x, wxCoord y, int button, int flags) { FrameButtonType idx; switch (button) { case wxTOPLEVEL_BUTTON_CLOSE: idx = FrameButton_Close; break; case wxTOPLEVEL_BUTTON_MAXIMIZE: idx = FrameButton_Maximize; break; case wxTOPLEVEL_BUTTON_ICONIZE: idx = FrameButton_Minimize; break; case wxTOPLEVEL_BUTTON_RESTORE: idx = FrameButton_Restore; break; case wxTOPLEVEL_BUTTON_HELP: idx = FrameButton_Help; break; default: wxFAIL_MSG(wxT("incorrect button specification")); return; } wxBitmap bmp = GetFrameButtonBitmap(idx); if ( !bmp.Ok() ) return; wxRect rectBtn(x, y, FRAME_BUTTON_WIDTH, FRAME_BUTTON_HEIGHT); if ( flags & wxCONTROL_PRESSED ) { DrawSunkenBorder(dc, &rectBtn); rectBtn.Offset(1, 1); } else { DrawRaisedBorder(dc, &rectBtn); } DrawBackground(dc, wxSCHEME_COLOUR(m_scheme, CONTROL), rectBtn); wxRect rectBmp(0, 0, bmp.GetWidth(), bmp.GetHeight()); dc.DrawBitmap(bmp, rectBmp.CentreIn(rectBtn).GetPosition(), true); }