The Image Watch extension for Visual Studio (http://goo.gl/TWre0X) allows you to see a bitmap in memory while debugging. Extremely useful, however I am stuck trying to define a natvis file to allow for viewing DIBs or BITMAPINFOHEADER or even just BITMAPINFO objects.
Here is what I currently have:
<?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="BITMAPINFOHEADER">
<UIVisualizer ServiceId="{A452AFEA-3DF6-46BB-9177-C0B08F318025}" Id="1" />
</Type>
<Type Name="BITMAPINFOHEADER">
<Expand>
<Synthetic Name="[type]">
<DisplayString>UINT8</DisplayString>
</Synthetic>
<Synthetic Name="[channels]">
<DisplayString>RGB</DisplayString>
</Synthetic>
<Item Name="[width]">biWidth</Item>
<Item Name="[height]">biHeight</Item>
<Item Name="[data]">(BYTE *)$ + sizeof(BITMAPINFOHEADER) + biClrUsed * 4</Item>
<Item Name="[stride]">biBitCount*3</Item>
</Expand>
</Type>
</AutoVisualizer>
The problem is clearly the "[data]" portion, trying to calculate the offset for the pixel data. The $ is a weak attempt at trying to understand what the natvis file is truly doing.
Docs for Image Watch and some example natvis files for user defined types (how BITMAPINFOHEADER falls under user defined, no idea why): http://goo.gl/zt2uCh
Does anyone already have a natvis file that handles and displays the BITMAPINFOHEADER type for Image Watch? Or have a suggestion as to how to get this one to work. Thanks.