因此,我尝试使用来自GDI+的方法GDI+,但显然它并不存在。我已经确保初始化了所有的
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>这个方法根本不存在:

是什么导致了这一切,我该如何解决呢?
发布于 2020-10-05 09:09:23
我很好奇为什么会发生这种事
因为该方法需要gdiplousbitmap.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)最近所有操作系统(>= Vista)都有GDIPlus 1.1。但是,如果不将GDIPVER指定为0x0110以启用Version1.1的功能,则在gtwus.h中,默认版本将指定为1.0:
// Define the Current GDIPlus Version
#ifndef GDIPVER
#define GDIPVER 0x0100
#endifhttps://stackoverflow.com/questions/64194224
复制相似问题