gpt4 book ai didi

c++ - Image Watch 显示无效图像

转载 作者:塔克拉玛干 更新时间:2023-11-03 07:44:47 24 4
gpt4 key购买 nike

我在此处的可扩展性部分尝试了第一个示例: http://research.microsoft.com/en-us/um/redmond/groups/ivm/imagewatchhelp/imagewatchhelp.htm#_Toc351981452

这是我的代码:

#include <memory>
struct My8BitRGBImage
{
unsigned int ncols;
unsigned int nrows;
unsigned char* data;
};

void main()
{
unsigned int ncols = 100;
unsigned int nrows = 100;
unsigned int bufferSize = ncols * nrows * 3;
unsigned char * data = new unsigned char[bufferSize];
memset(data, 0, bufferSize);
My8BitRGBImage image = { ncols, nrows, data };
}

当我在最后一行中断并尝试观看我变得无效的图像时: Image

在 ImageWatch.log 中,My8BitRGBImage 似乎已正确注册:

+ Parsing ImageWatchFrameBuffer.natvis ...
+ Found type My8BitRGBImage ...
+ -> Registering My8BitRGBImage

ImageWatchFrameBuffer.nativs 看起来像这样:

<?xml version="1.0" encoding="utf-8"?>
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">

<UIVisualizer ServiceId="{A452AFEA-3DF6-46BB-9177-C0B08F318025}" Id="1"
MenuName="Add to Image Watch"/>

<Type Name="My8BitRGBImage">
<UIVisualizer ServiceId="{A452AFEA-3DF6-46BB-9177-C0B08F318025}" Id="1" />
</Type>

<Type Name="My8BitRGBImage">
<Expand>
<Synthetic Name="[type]">
<DisplayString>UINT8</DisplayString>
</Synthetic>
<Synthetic Name="[channels]">
<DisplayString>RGB</DisplayString>
</Synthetic>
<Item Name="[width]">ncols</Item>
<Item Name="[height]">nrows</Item>
<Item Name="[data]">data</Item>
<Item Name="[stride]">ncols*3</Item>
</Expand>
</Type>

</AutoVisualizer>

从示例中复制粘贴。我正在使用 VS2015 更新 1。可能是什么问题?

最佳答案

使用

<Item Name="[channels]">3</Item>

代替

<Synthetic Name="[channels]">
<DisplayString>RGB</DisplayString>
</Synthetic>

关于c++ - Image Watch 显示无效图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41088475/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com