示例#1
0
        public Size ToScreenCoords(Size imageRect)
        {
            var scalef = ImageConverter.ScaleFactor(RealImageSize, ImageRectangle.Size);
            var result = ImageConverter.ScaleRectangle(new Rectangle(0, 0, imageRect.Width, imageRect.Height), scalef);

            return(result.Size);
        }
示例#2
0
        public Rectangle ToScreenCoords(Rectangle imageRect)
        {
            var scalef = ImageConverter.ScaleFactor(RealImageSize, ImageRectangle.Size);
            var result = ImageConverter.ScaleRectangle(imageRect, scalef);

            result.Offset(ImageRectangle.Location);
            return(result);
        }
示例#3
0
        public Rectangle ToImageCoords(Rectangle screenRect)
        {
            var scalef = ImageConverter.ScaleFactor(RealImageSize, ImageRectangle.Size);
            var result = new Rectangle(
                screenRect.X - ImageRectangle.X, screenRect.Y - ImageRectangle.Y, screenRect.Width, screenRect.Height);

            result = ImageConverter.ScaleRectangle(result, 1.0 / scalef);
            return(result);
        }
示例#4
0
 /// <summary>
 /// Paints an overview image with detail rectangle areas painted onto it (same size as current display).
 /// </summary>
 /// <returns></returns>
 public Image PaintOverviewImage()
 {
     using (var pen = new Pen(Color.Orange, 3))
     {
         Bitmap b = new Bitmap(_pbt.ImageRectangle.Width, _pbt.ImageRectangle.Height);
         using (Graphics g = Graphics.FromImage((Image)b))
         {
             // scale the image to picturebox size
             var f           = ImageConverter.ScaleFactor(pictureBox1.Image.Size, _pbt.ImageRectangle.Size);
             var scaledImage = ImageConverter.ResizeImage(pictureBox1.Image, _pbt.ImageRectangle.Size);
             g.DrawImage(scaledImage, 0, 0);
             scaledImage.Dispose();
             foreach (var detail in Photo.Project.DetailAreas)
             {
                 g.DrawRectangle(pen, ImageConverter.ScaleRectangle(detail.Crop, f));
             }
             return(b);
         }
     }
 }