我要把bmp黑白二值位图转成emf、wmf,现在转成emf没有问题。但转wmf有问题(本来是黑实心的图形,但转完后,是条图了,图形变大了)。用msdn上的ConvertEMFtoWMF,也是不行(在黑实心的图形中有白条)。
那位有解决的办法,或有成功的例子或源码。

解决方案 »

  1.   

    use gdiplus.sample:
    HRESULT AnsiToUnicode(LPCSTR pszA, LPOLESTR* ppszW)
    {
        ULONG cCharacters;
        DWORD dwError;
        if (NULL == pszA)
        {
            *ppszW = NULL;
            return NOERROR;
        }
        cCharacters =  strlen(pszA)+1;
        *ppszW = (LPOLESTR) CoTaskMemAlloc(cCharacters*2);
        if (NULL == *ppszW)
            return E_OUTOFMEMORY;
        if (0 == MultiByteToWideChar(CP_ACP, 0, pszA, cCharacters,*ppszW, cCharacters))
        {
            dwError = GetLastError();
            CoTaskMemFree(*ppszW);
            *ppszW = NULL;
            return HRESULT_FROM_WIN32(dwError);
        }
        return NOERROR;
    }bool TransBMPToGIF89(LPSTR lpSrcFileName,LPSTR lpDstFileName)//if pass a name fifa.bmp then save as fifa.gif
    {
    if(lpSrcFileName == NULL || lpDstFileName == NULL)
    return false;
    using namespace Gdiplus;
    CLSID   encoderClsid;
    Status  stat;
    LPOLESTR  lpwStr;
    if(AnsiToUnicode(lpSrcFileName,&lpwStr)!=NOERROR)
    return false;
    Image*   image = Image::FromFile(lpwStr,FALSE);
    CoTaskMemFree(&lpwStr);
    GetEncoderClsid(L"image/gif", &encoderClsid);
    if(AnsiToUnicode(lpDstFileName,&lpwStr)!=NOERROR)
    return false;
    stat = image->Save(lpwStr, &encoderClsid, NULL);
    CoTaskMemFree(&lpwStr);
    bool bRet = false;
    if(stat == Ok)
    bRet = true;
    else
    bRet = false;
    delete image;
    return bRet;
    }
      

  2.   

    to fingerfox(foxfinger):
      没有哇!?
      

  3.   

    没有?gdiplus? down new SDK or copy from anywhere
    if have not success change from bmp->wmf
    maybe you should set
    GetEncoderClsid(L"image/wmf", &encoderClsid);
      

  4.   

    我必须在win32 application ,不能用mfc(人家规定).
      

  5.   

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdicpp/gdi+/gdi+.asp
      

  6.   

    fingerfox(foxfinger) :
    那里有下载,我用google没搜到。
      

  7.   

    http://www.microsoft.com/msdownload/platformsdk/sdkupdate/