void c_PointerPressed(object sender, Windows.UI.Xaml.Input.PointerRoutedEventArgs e) { Canvas c = sender as Canvas; if (c.Children.Contains(hl)) { c.Children.Remove(hl); } if (c.Children.Contains(vl)) { c.Children.Remove(vl); } CustomButtonBrush = DeactiveBrush; c.PointerMoved -= c_PointerMoved; c.PointerPressed -= c_PointerPressed; if (CurrentPhoto == null) { return; } DrawGraphic dg = new DrawGraphic(); Point tp = e.GetCurrentPoint(c).Position; Point ip = DrawGraphic.getImagePosition(tp, currentPhotoControl.getImage()); Color cc = TestChart.GetPixel(currentPhotoControl.getPhoto(), (int)ip.X, (int)ip.Y); //TempPhoto =new WriteableBitmap( ChartPhoto.getPhoto());//复制一份保留 try { WriteableBitmap oi; CustomSelectPointSimularPixelNum = TestChart.getFloodBrightEdge(currentPhotoControl.getPhoto(), out oi, ip, BrightGradeDistance); //IsNeedSave = false; currentPhotoControl.setPhoto(oi); } catch (Exception xe) //未知的异常 { if (xe is LFCException) //已经是系统约定的错误类型,直接往上抛 { SilverlightLFC.common.Environment.ShowMessage(xe.Message); } else { SilverlightLFC.common.Environment.ShowMessage("Calculate error:" + xe.Message); //MessageBox.Show("计算亮度变化错误"); } } }
private void currentBright_MouseMove(object sender, PointerRoutedEventArgs e) { LynxPhotoViewControl im = sender as LynxPhotoViewControl; WriteableBitmap b = im.getPhoto(); if (b != null) { Point?p = xt.PointToPix(b, im, e.GetCurrentPoint(im.getImage()).Position, false); if (p == null) { return; } DCTestLibrary.PhotoTest pt = new DCTestLibrary.PhotoTest(); Color c = pt.GetPixel(b, Convert.ToInt32(p.Value.X), Convert.ToInt32(p.Value.Y)); float ph, ps, pb; pt.RGB2HSB(Convert.ToInt32(c.R), Convert.ToInt32(c.G), Convert.ToInt32(c.B), out ph, out ps, out pb); textBoxCurrentBright.Text = pb.ToString(); } }