private void ReadFrom(BinaryReader br) { var result = new BitmapDataInfo(); // 1. Bitmap result.BackingImage = (Bitmap)SerializationHelper.ReadImage(br); // 2. Data result.BitmapData = new BitmapData { Width = br.ReadInt32(), Height = br.ReadInt32(), Stride = br.ReadInt32(), PixelFormat = (PixelFormat)br.ReadInt32() }; BitmapDataInfo = result; }
internal BitmapDataSerializationInfo(BitmapData bitmapData) { BitmapDataInfo = new BitmapDataInfo(bitmapData); }
internal static void DebugBitmapData(BitmapDataInfo bitmapDataInfo) { using (IViewModel vm = ViewModelFactory.FromBitmapData(bitmapDataInfo)) ViewFactory.ShowDialog(vm); }
/// <summary> /// Creates a view model for a <see cref="BitmapData"/> from arbitrary debug information. /// </summary> /// <param name="bitmapDataInfo">The debug information for a <see cref="BitmapData"/>.</param> /// <returns>An <see cref="IViewModel"/> instance that represents a view model for a <see cref="BitmapData"/>.</returns> public static IViewModel FromBitmapData(BitmapDataInfo bitmapDataInfo) => new BitmapDataVisualizerViewModel { BitmapDataInfo = bitmapDataInfo };
/// <summary> /// Shows the specified window service. /// </summary> /// <param name="windowService">The window service.</param> /// <param name="objectProvider">The object provider.</param> protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider) { using (BitmapDataInfo bitmapDataInfo = SerializationHelper.DeserializeBitmapDataInfo(objectProvider.GetData())) DebuggerHelper.DebugBitmapData(bitmapDataInfo); }