赢得CE 6.0绘制/显示透明图像/ PNG

时间:2014-05-27 08:08:06

标签: visual-c++ embedded png windows-ce transparent

这个问题经常被问到,我尝试了许多答案,但没有让它起作用..

再次在这里:

我只想在Windows CE 6.0设备(ARM4,PicoCOM)上显示透明的PNG

Alphablend不支持操作系统。

使用IImagingFactory绘制PNG会将透明度设为黑色..

我使用了以下代码段:

void DrawPng (CWnd *window)
{
    CoInitializeEx(NULL, 0);

    IImagingFactory* pImageFactory;
    IImage *pImage = NULL;
    CDC *dc = window->GetDC();

    HRESULT hr = CoCreateInstance(CLSID_ImagingFactory, NULL,
                                  CLSCTX_INPROC_SERVER,
                                  __uuidof(IImagingFactory),
                                  (LPVOID *)&pImageFactory);

    // Load image from file
    pImageFactory->CreateImageFromFile(_T("\\FFSDisk\\test.png"), &pImage);

    // Get image information
    ImageInfo info;
    pImage->GetImageInfo(&info);

    RECT rc={0,0,info.Width, info.Height};

    // draw jpg/gif etc onto temp dc
    pImage->Draw(dc->GetSafeHdc(), &rc, NULL);

    // Clean up
    pImage->Release();
    pImageFactory->Release();

    CoUninitialize();
}

我可以使用TransparentImage函数(http://msdn.microsoft.com/en-us/library/aa453779.aspx)但是我只能使用1种颜色作为"透明" ..

一定是可能的,因为当我将桌面图标移到不同的颜色上时,它总是透明的!

任何人都知道该怎么做?

谢谢。

0 个答案:

没有答案
相关问题