RectF CRender::DrawBitmap( CDCHandle& dc, const RectF& rText, IPicture* image, const HTMLElement* element, const PLACEMENT& placement) { if (image == NULL && (element == NULL || element->GetHtmlElement() == NULL)) return rText; LONG width, height; RectF rImg; if (image != NULL) { image->get_Width( &width ); image->get_Height( &height ); CSize szPic(width, height); // convert OLE size into pixels dc.HIMETRICtoDP( &szPic ); rImg.Width = static_cast<float>(szPic.cx); rImg.Height = static_cast<float>(szPic.cy); } else if (element != NULL) { rImg = element->GetSize(); } HRESULT hr = S_OK; //COLORREF transparent = RGB(253,0,200); COLORREF transparent = RGB(0,0,211); // C# transparent gif background color CMemBm bmp(dc, 0, 0, 0, (int)rImg.Width, (int)rImg.Height); CDCHandle hdcMem = bmp; hdcMem.FillSolidRect(0, 0, (int)rImg.Width, (int)rImg.Height, transparent); if (image != NULL) { hr = image->Render( hdcMem, 0, long(rImg.Height), long(rImg.Width), long(-rImg.Height), 0, 0, width, height, NULL ); } else if (element != NULL && element->GetHtmlElement() != NULL) { hr = element->GetHtmlElement()->DrawToDC(hdcMem); } //TODO over support if (/*m_overNode != v ||*/ GetScale() > 1.0f) { ScaleTransform(rImg); } AdjustOffsets(rImg, rText, placement); bmp.DrawTrans( dc, int(rImg.x), int(rImg.y), int(rImg.Width), int(rImg.Height), transparent); return rImg; }