public static Dictionary<MagickColor, int> ToDictionary(IntPtr list, int length)
{
Dictionary<MagickColor, int> colors = new Dictionary<MagickColor, int>();
if (list == IntPtr.Zero)
return colors;
for (int i = 0; i < length; i++)
{
IntPtr instance = NativeMagickColorCollection.GetInstance(list, i);
MagickColor color = MagickColor.CreateInstance(instance);
if (color != null)
colors[color] = color.Count;
}
return colors;
}
}