コード例 #1
0
        // Construct from image
        public ImageHandlerForm(Bitmap image, IDocumentsHost host)
            : this(host)
        {
            this.image = image;
            AForge.Imaging.Image.FormatImage(ref this.image);

            Init();
        }
コード例 #2
0
        // Construct from file
        public ImageHandlerForm(string fileName, IDocumentsHost host)
            : this(host)
        {
            try
            {
                // load image
                image = (Bitmap)System.Drawing.Bitmap.FromFile(fileName);

                // format image
                AForge.Imaging.Image.FormatImage(ref image);

                this.fileName = fileName;
            }
            catch (Exception) { ((MainForm)host).ReadyToolStripStatusLabel.Text = "Failed loading image"; }
            Init();
        }
コード例 #3
0
ファイル: FourierDoc.cs プロジェクト: jdilt/iplab
        // Constructors
        public FourierDoc( ComplexImage image, IDocumentsHost host )
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent( );

            //
            this.host = host;
            this.image = image;

            width = image.Width;
            height = image.Height;

            UpdateNewImage( );

            // form style
            SetStyle( ControlStyles.AllPaintingInWmPaint | ControlStyles.DoubleBuffer | ControlStyles.ResizeRedraw, true );

            // init scroll bars
            this.AutoScroll = true;
            // scroll bar size
            this.AutoScrollMinSize = new Size( width, height );
        }
コード例 #4
0
ファイル: FourierDoc.cs プロジェクト: MervenurAksan/project2
        // Constructors
        public FourierDoc(ComplexImage image, IDocumentsHost host)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent( );

            //
            this.host  = host;
            this.image = image;

            width  = image.Width;
            height = image.Height;

            UpdateNewImage( );

            // form style
            SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.DoubleBuffer | ControlStyles.ResizeRedraw, true);

            // init scroll bars
            this.AutoScroll = true;
            // scroll bar size
            this.AutoScrollMinSize = new Size(width, height);
        }
コード例 #5
0
 // Constructors
 private ImageHandlerForm(IDocumentsHost host)
 {
     this.host = host;
     ((MainForm)host).IHFList.Add(this);
 }
コード例 #6
0
ファイル: ImageDoc.cs プロジェクト: hksonngan/mytesgnikrow
        // Construct from file
        public ImageDoc( string fileName, IDocumentsHost host )
            : this(host)
        {
            try
            {
                // load image
                image = (Bitmap) Bitmap.FromFile( fileName );

                // format image
                AForge.Imaging.Image.FormatImage( ref image );

                this.fileName = fileName;
            }
            catch ( Exception )
            {
                throw new ApplicationException( "Failed loading image" );
            }

            Init( );
        }
コード例 #7
0
ファイル: ImageDoc.cs プロジェクト: hksonngan/mytesgnikrow
 // Constructors
 private ImageDoc( IDocumentsHost host )
 {
     this.host = host;
 }
コード例 #8
0
ファイル: ImageDoc.cs プロジェクト: kapt-sino/fingergraph
        // Construct from image
        public ImageDoc( Bitmap image, IDocumentsHost host ) : this( host )
        {
            this.image = image;

            if ( !AForge.Imaging.Image.IsGrayscale( this.image ) )
            {
                this.image = AForge.Imaging.Image.Clone( image, PixelFormat.Format24bppRgb );
            }

            Init( );
        }
コード例 #9
0
ファイル: ImageDoc.cs プロジェクト: kapt-sino/fingergraph
        // Construct from file
        public ImageDoc( string fileName, IDocumentsHost host ) : this( host )
        {
            FileStream stream = null;
            try
            {
                // read image to temporary memory stream
                // (.NET locks any stream until bitmap is disposed,
                // so that is why this work around is required)
                stream = File.OpenRead( fileName );
                MemoryStream memoryStream = new MemoryStream( );

                byte[] buffer = new byte[10000];
                while ( true )
                {
                    int read = stream.Read( buffer, 0, 10000 );

                    if ( read == 0 )
                        break;

                    memoryStream.Write( buffer, 0, read );
                }

                image = (Bitmap) Bitmap.FromStream( memoryStream );

                // format image
                if ( !AForge.Imaging.Image.IsGrayscale( image ) && ( image.PixelFormat != PixelFormat.Format24bppRgb ) )
                {
                    Bitmap temp = AForge.Imaging.Image.Clone( image, PixelFormat.Format24bppRgb );
                    image.Dispose( );
                    image = temp;
                }


                this.fileName = fileName;
            }
            catch ( Exception )
            {
                throw new ApplicationException( "Failed loading image" );
            }
            finally
            {
                if ( stream != null )
                {
                    stream.Close( );
                    stream.Dispose( );
                }
            }

            Init( );
        }
コード例 #10
0
ファイル: ImageDoc.cs プロジェクト: eersonmez/iplab
        // Construct from file
        public ImageDoc( string fileName, IDocumentsHost host ) : this( host )
        {
            try
            {
                image = LoadImageFromFile( fileName );

                // format image
                if ( !AForge.Imaging.Image.IsGrayscale( image ) && ( image.PixelFormat != PixelFormat.Format24bppRgb ) )
                {
                    Bitmap temp = AForge.Imaging.Image.Clone( image, PixelFormat.Format24bppRgb );
                    image.Dispose( );
                    image = temp;
                }

                this.fileName = fileName;
            }
            catch ( Exception )
            {
                throw new ApplicationException( "Failed loading image" );
            }

            Init( );
        }
コード例 #11
0
 private void ImageDoc(IDocumentsHost host)
 {
     this.host = host;
 }
コード例 #12
0
ファイル: ImageDoc.cs プロジェクト: LynxAS/iplab_d
        // Constructors
        private ImageDoc( IDocumentsHost host )
        {
            this.host = host;

            //SS: экземпляр класса для ведения логов
            logger = new Logger(this);
        }