Skip to content

Instantly share code, notes, and snippets.

@Ybalrid
Created April 8, 2020 19:40
Show Gist options
  • Save Ybalrid/479b7cbe78edf2894e9672abc869f799 to your computer and use it in GitHub Desktop.
Save Ybalrid/479b7cbe78edf2894e9672abc869f799 to your computer and use it in GitHub Desktop.
<?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="polu::image::bitmap">
<UIVisualizer ServiceId="{A452AFEA-3DF6-46BB-9177-C0B08F318025}" Id="1" />
</Type>
<Type Name="polu::image::bitmap">
<Expand>
<Synthetic Name="[type]">
<DisplayString>UINT8</DisplayString>
</Synthetic>
<Synthetic Name="[channels]">
<DisplayString>RGBA</DisplayString>
</Synthetic>
<Item Name="[width]">w</Item>
<Item Name="[height]">h</Item>
<Item Name="[data]">&amp;data[0]</Item>
<Item Name="[stride]">4*w</Item>
</Expand>
</Type>
</AutoVisualizer>
@Ybalrid
Copy link
Author

Ybalrid commented Apr 8, 2020

The type that it describe boils down to this

namespace polu::image
{
    struct bitmap
    {
        std::vector<std::byte> data; //Array of RGBA 8bit pixels
        size_t w, h, c; //C is the number of channel *in the original file, but data is always as RGBA pixels
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment