缺少 GDI+ 方法

GDI+ methods are missing

所以我尝试使用 GDI+ 中的 Bitmap::GetHistogram 方法,但显然它不存在。我已经确保用

初始化所有内容
    Gdiplus::GdiplusStartupInput gdiplusStartupInput;
    ULONG_PTR gdiplusToken;
    GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);

在 WinMain 开始时,这里是有问题的片段:

    UINT numEntries;
    Gdiplus::Bitmap myBitmap(pszFilePath);
    Gdiplus::Image myImage(pszFilePath);

    UINT iHeight = myImage.GetHeight(); // works
    UINT iWidth = myImage.GetWidth(); // works
    myBitmap.GetHistogramSize(HistogramFormatRGB, &numEntries); // not defined

这些是包含的所有头文件:

#include <Unknwn.h>
#include <windows.h>
#include <Gdiplus.h>
#include <stdio.h>
#include <iostream>
#include <commdlg.h>
#include <commctrl.h>
#include <winioctl.h>
#include <Objbase.h>
#include <shobjidl.h>
#include <objidl.h>
#include <strsafe.h>

方法根本不存在:

可能是什么原因造成的,我该如何解决?

I'm curious as to why this happened

因为该方法需要 gdiplusbitmap.h 中的 GDIPVER >= 0x0110:

#if (GDIPVER >= 0x0110)
...
inline Status
Bitmap::GetHistogram(
    IN HistogramFormat format,
    IN UINT NumberOfEntries,
    _Out_writes_bytes_(sizeof(UINT)*256) UINT *channel0,
    _Out_writes_bytes_(sizeof(UINT)*256) UINT *channel1,
    _Out_writes_bytes_(sizeof(UINT)*256) UINT *channel2,
    _Out_writes_bytes_(sizeof(UINT)*256) UINT *channel3
)
{
    return DllExports::GdipBitmapGetHistogram(
        static_cast<GpBitmap *>(nativeImage),
        format,
        NumberOfEntries,
        channel0,
        channel1,
        channel2,
        channel3
        );
}

inline Status 
Bitmap::GetHistogramSize(
    IN HistogramFormat format,
    OUT UINT *NumberOfEntries
)
{
    return DllExports::GdipBitmapGetHistogramSize(
        format,
        NumberOfEntries
        );
}

#endif // (GDIPVER >= 0x0110)

所有最近的 OS (>= Vista) 都有 GDIPlus 1.1。但是如果不指定GDIPVER到0x0110启用1.1版本的功能,默认版本会在gdiplus.h:

中指定为1.0
// Define the Current GDIPlus Version
#ifndef GDIPVER
#define GDIPVER 0x0100
#endif