Ejemplo n.º 1
0
        private void OnTileCorrelationBegin(CorrelationTile tile, FreeImageAlgorithmsBitmap fib)
        {
            this.useCorrelationCheckBox.Checked = false;
            this.currentTile = tile;

            #if DEBUG

            FreeImageAlgorithmsBitmap fg = new FreeImageAlgorithmsBitmap(fib);

            fg.ConvertToStandardType(true);
            fg.ConvertTo24Bits();

            this.debugForm.TileImageView.Image = fg.ToBitmap();

            this.debugForm.BackgroundImageView.Refresh();
            this.debugForm.TileImageView.Refresh();

            fg.Dispose();

            #endif
        }
Ejemplo n.º 2
0
        private void DrawThumbnailImage(Graphics graphics, Tile tile)
        {
            if (tile.Thumbnail != null)
            {
                lock (tile.ThumbnailLock)
                {
                    //tile.Thumbnail.ConvertToStandardType();
                    FreeImageAlgorithmsBitmap thumb = new FreeImageAlgorithmsBitmap(tile.Thumbnail);

                    if (thumb.IsGreyScale)
                    {
                        thumb.LinearScaleToStandardType(
                            mosaicInfo.ThumbnailScaleMinIntensity, mosaicInfo.ThumbnailScaleMaxIntensity);
                        thumb.SetGreyLevelPalette();
                    }

                    if (thumb.ImageType != FREE_IMAGE_TYPE.FIT_BITMAP)
                    {
                        MessageBox.Show("Failed to convert tile thumbnail to a standard type ?");
                    }

                    graphics.DrawImage(thumb.ToBitmap(), tile.Bounds);

                    thumb.Dispose();
                }
            }

            /*
            if (this.ShowFileNames)
            {
                // Create font and brush.
                Font drawFont = new Font("Arial", 16);
                SolidBrush drawBrush = new SolidBrush(Color.Black);

                Point location = new Point(tile.Bounds.Location.X + 100, tile.Bounds.Location.Y + 100);

                SizeF size = graphics.MeasureString(tile.FileName, drawFont);

                Brush brush = new SolidBrush(Color.FromArgb(50, Color.Gray));

                graphics.FillRectangle(brush, location.X - 2, location.Y - 2,
                    size.Width + 4, size.Height + 4);

                graphics.DrawString(tile.FileName, drawFont, drawBrush,
                    new PointF(location.X, location.Y));
            }
            */

            if (this.ShowJoins)
            {
                Pen pen = new Pen(Color.Red, 2.0f);
                graphics.DrawRectangle(pen, tile.Bounds);
            }
        }
Ejemplo n.º 3
0
        private void OnTileCorrelated(CorrelationTile tile, Rectangle bounds, FreeImageAlgorithmsBitmap fib, bool success)
        {
            this.tiledImageViewer.AddTile(bounds, fib);

            this.tiledImageViewer.Refresh();

            #if DEBUG
            if (success == false)
            {
                FreeImageAlgorithmsBitmap bg = new FreeImageAlgorithmsBitmap(this.correlator.BackgroundImage);
                bg.ConvertTo24Bits();
                bg.DrawColourRect(tile.OriginalBoundsRelativeToOrigin, Color.Red, 2);
                this.debugForm.BackgroundImageView.Image = bg.ToBitmap();
                bg.Dispose();
            }

            this.debugForm.Refresh();
            #endif
        }
Ejemplo n.º 4
0
        private void SaveScreenShot()
        {
            string filePath = Utilities.SaveDialog(true);

            if (filePath == null)
                return;

            Bitmap bitmap = this.imageView.ScreenBitmap;
            Graphics g = Graphics.FromImage(bitmap);

            g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBilinear;

            OnSavingScreenShot(g, new MosaicWindowEventArgs(MosaicWindow.MosaicInfo));

            FreeImageAlgorithmsBitmap fib = new FreeImageAlgorithmsBitmap(bitmap);

            fib.ConvertTo24Bits();

            g.Dispose();

            bitmap.Dispose();

            string extension = Path.GetExtension(filePath);

            if (extension != ".ics")
            {
                fib.SaveToFile(filePath);
            }
            else {
                IcsFile.SaveToFile(fib, filePath, true);
            }

            fib.Dispose();
        }