public bool[,] RenderImage(Bitmap img, IViewBoxModel view, IPannable offset, bool invert, double zoom, bool autoThreshold)
        {
            // FIXME: check this (invalidoperationexception nach schwellwert mehrmals absenken)
            var    vr   = view.ContentBox;
            Bitmap img2 = img.Clone() as Bitmap;

            if (img2 != null)
            {
                return(RenderImage(img2, view, offset, invert, zoom, GraphicUtils.GetAverageGrayscale(vr.Width, vr.Height, new Bitmap(img2, new Size((int)Math.Round(img2.Width * zoom), (int)Math.Round(img2.Height * zoom))))));
            }
            return(null);
        }
        /// <summary>
        /// Renders the image.
        /// </summary>
        /// <param name="img">The image.</param>
        /// <param name="view">The view.</param>
        /// <param name="offset">The offset for translation.</param>
        /// <param name="invert">if set to <c>true</c>  the result will be inverted.</param>
        /// <param name="zoom">The zoom factor.</param>
        /// <param name="autoThreshold">if set to <c>true</c> [automatic threshold] is applied.</param>
        /// <param name="callHooks">if set to <c>true</c> per- and post renderer hooks  are called.</param>
        /// <returns>
        /// a bool matrix
        /// </returns>
        public bool[,] RenderImage(Bitmap img, IViewBoxModel view, IPannable offset, bool invert, double zoom, bool autoThreshold, bool callHooks = true)
        {
            var    vr   = view.ContentBox;
            Bitmap img2 = img.Clone() as Bitmap;

            if (img2 != null)
            {
                return(RenderImage(img2, view, offset, invert, zoom,
                                   GraphicUtils.GetAverageGrayscale(vr.Width, vr.Height, new Bitmap(img2, new Size((int)Math.Round(img2.Width * zoom), (int)Math.Round(img2.Height * zoom))))
                                   , callHooks
                                   ));
            }
            return(null);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Renders the image.
        /// </summary>
        /// <param name="img">The image.</param>
        /// <param name="view">The view.</param>
        /// <param name="offset">The offset for translation.</param>
        /// <param name="zoom">The zoom factor.</param>
        /// <param name="autoThreshold">if set to <c>true</c> [automatic threshold] is applied.</param>
        /// <returns>
        /// a bool matrix
        /// </returns>
        public bool[,] RenderImage(Bitmap img, IViewBoxModel view, IPannable offset, double zoom, bool autoThreshold)
        {
            var vr = view.ContentBox;

            return(RenderImage(img, view, offset, zoom, GraphicUtils.GetAverageGrayscale(vr.Width, vr.Height, new Bitmap(img, new Size((int)Math.Round(img.Width * zoom), (int)Math.Round(img.Height * zoom))))));
        }