public void Test(List <WriteableBitmap> b) { if (b.Count == 0 || b == null) { return; } bl = b; try { HB.Photo = (b[1]); VB.Photo = (b[2]); xt = new XMarkChart(); decimal d = xt.getBrightChanges(b[0]);//原始 textBoxBrightChanges.Text = d.ToString(); textBoxBB.Text = xt.ProcessInfor["BrightChanges_BorderBright"].ToString(); textBoxCB.Text = xt.ProcessInfor["BrightChanges_CBright"].ToString(); LT.Text = xt.ProcessInfor["BrightChanges_LT"].ToString(); LB.Text = xt.ProcessInfor["BrightChanges_LB"].ToString(); RT.Text = xt.ProcessInfor["BrightChanges_RT"].ToString(); RB.Text = xt.ProcessInfor["BrightChanges_RB"].ToString(); List <int> hl, vl; DCTestLibrary.PhotoTest pt = new DCTestLibrary.PhotoTest(); hl = pt.getImageGrayHLine(b[1], b[1].PixelHeight / 2); vl = pt.getImageGrayVLine(b[2], b[2].PixelWidth / 2); dg.ForeColor = Colors.Blue; dg.DrawBrightLines(hl); dg.ForeColor = Colors.Red; dg.DrawBrightLines(vl); } catch (Exception xe) //未知的异常 { if (xe is LFCException) //已经是系统约定的错误类型,直接往上抛 { SilverlightLFC.common.Environment.ShowMessage(xe.Message); } else { SilverlightLFC.common.Environment.ShowMessage("测试错误,请检查照片"); } } }
private void VB_MouseLeftButtonDown(object sender, PointerRoutedEventArgs e) { var im = sender as LynxPhotoViewControl; selectedImage = im; //VB.Active(); //HB.DeActive(); WriteableBitmap b = im.Photo; if (b != null) { DCTestLibrary.PhotoTest pt = new DCTestLibrary.PhotoTest(); Point?p = xt.PointToPix(b, im, e.GetCurrentPoint(im).Position, false); if (p == null) { return; } dg.DrawBrightLines(pt.getImageGrayVLine(b, Convert.ToInt32(p.Value.X))); } }
private void VB_PointerPressed(object sender, PointerRoutedEventArgs e) { LChartPhoto im = sender as LChartPhoto; selectedImage = im; VB.Active(); HB.DeActive(); photoTestToolbar1.setTarget(VB); WriteableBitmap b = im.getPhoto(); if (b != null) { DCTestLibrary.PhotoTest pt = new DCTestLibrary.PhotoTest(); Point?p = xt.PointToPix(b, im, e.GetCurrentPoint(im).Position, false); if (p == null) { return; } dg.DrawBrightLines(pt.getImageGrayVLine(b, Convert.ToInt32(p.Value.X))); } }