Пример #1
0
 private void PaintDetailAreas(Graphics g)
 {
     if (Photo != null)
     {
         foreach (var detail in Photo.Project.DetailAreas)
         {
             var pen = new Pen(Color.Orange, 3);
             g.DrawRectangle(pen, ImageConverter.ScaleRectangle(detail.Crop, _scaleFactor));
         }
     }
 }
Пример #2
0
        private void StoreRect(Point p1, Point p2)
        {
            if (Image == null)
            {
                return;
            }
            var p0 = new Point(Math.Min(p1.X, p2.X), Math.Min(p1.Y, p2.Y));
            var sz = new Size(Math.Abs(p2.X - p1.X), Math.Abs(p2.Y - p1.Y));

            Crop = new Rectangle(p0, sz);
            Crop = Rectangle.Intersect(Crop, new Rectangle(new Point(0, 0), Image.Size));

            // transform to image coordinates
            Crop = ImageConverter.ScaleRectangle(Crop, 1.0 / _scaleFactor);
            if (OnDetailSelected != null)
            {
                OnDetailSelected(this, new EventArgs());
            }

            // delete the reversible rectangle
            MyDrawReversibleRectangle(p1, p2);
        }