views:

151

answers:

1

What is the best way to display IBitmapImage on a device context. I am using Windows CE 6.0.

void CImaginingTestView::OnDraw(CDC* pDC)
{
    CImaginingTestDoc* pDoc = GetDocument();
    ASSERT_VALID(pDoc);

    IBitmapImage* pBitmapImage = pDoc->GetBitmapImage();
    if (pBitmapImage)
    {
       // how to draw my bitmap on a pDC ??
    }
}
A: 

Assuming you're talking about the Imaging API, take a look at the IImage interface an in particular its Draw Method.

Christopher Fairbairn
I am talking about Imaging API. IImage has a draw method but IBitmapImage has no such a method so that's why I am asking. Should I convert IBitmapImage to IImage to display it on a device context ?
tommyk
Try calling QueryInterface on your IBitmapImage. You should be able to query your existing IBitmapImage object for the IID_IImage interface without needing to create an additional copy. i.e. pBitmapImage->QueryInterface(IID_IImage, (void**)
Christopher Fairbairn