void LoadDefaultImage() { Assembly asm = typeof(Crop).GetTypeInfo().Assembly; using (Stream stream = asm.GetManifestResourceStream("BitmapSamples.Assets.Sheep.jpg")) { _bitmap.Load(stream, new FormatConverter(PixelFormat.Format32bppPBGRA)); } ClearSavedCopy(); _savedCopy = _bitmap.Transform(); CreateImageSource(); }
void LoadDefaultImage() { Assembly asm = typeof(Crop).Assembly; using (Stream stream = asm.GetManifestResourceStream("BitmapSamples.Resources.Sheep.jpg")) { _bitmap.Load(stream, new FormatConverter(C1.WPF.Bitmap.PixelFormat.Format32bppPBGRA)); } ClearSavedCopy(); _savedCopy = _bitmap.Transform(); image.Source = _bitmap.ToWriteableBitmap(); }
async void Restart_Clicked(object sender, RoutedEventArgs e) { if (_savedCopy != null) { _bitmap.Dispose(); _bitmap = _savedCopy.Transform(); await UpdateImageSource(); } }
void btnRestart_Click(object sender, EventArgs e) { if (_savedCopy != null) { _bitmap.Dispose(); _bitmap = _savedCopy.Transform(); UpdateImage(); } }
void PrepareForNewImage() { if (_initialized) { DXUtil.Dispose(ref _imBmp); ClearSavedCopy(); _savedCopy = _bitmap.Transform(); UpdateTargetRect(); Invalidate(false); } }
void btnLoad_Click(object sender, EventArgs e) { var ofd = new OpenFileDialog(); ofd.Filter = "Image Files|*.ico;*.bmp;*.gif;*.png;*.jpg;*.jpeg;*.jxr;*.tif;*.tiff"; ofd.Title = "Select the Image"; if (ofd.ShowDialog() == DialogResult.OK) { try { _savedCopy.Dispose(); _bitmap.Load(ofd.FileName, new FormatConverter(PixelFormat.Format32bppPBGRA)); _savedCopy = _bitmap.Transform(); UpdateImage(); } catch (Exception ex) { LoadDefaultImage(); MessageBox.Show(ex.Message); } } }