Example #1
0
        public void EventLayoutChanged()
        {
            if (PageFileSelected == null)
            {
                return;
            }
            bitmapSource = new Bitmap(PageFileSelected);
            if (bitmapSource == null)
            {
                return;
            }

            if ((bitmapSource.PixelFormat == System.Drawing.Imaging.PixelFormat.Format8bppIndexed) ||
                (bitmapSource.PixelFormat == System.Drawing.Imaging.PixelFormat.Format32bppArgb))
            {
                bitmapSource = ToolsConvolution.ConvertTo24(bitmapSource);
            }
            PageLayout.Save();

            //Rotate
            var bitmapRot             = new RotateBilinear(PageLayout.Rotation.Value, true).Apply(bitmapSource);
            var linesH                = ToolsFindLine.FindLinesH(bitmapRot.Width, bitmapRot.Height, PageLayout.LineSize.Value, PageLayout.LineOffset.Value, PageLayout.LineCount.Value);
            var linesV                = ToolsFindLine.FindLinesV(bitmapRot.Width, bitmapRot.Height, PageLayout.ColSize.Value, PageLayout.ColOffset.Value, PageLayout.ColCount.Value);
            List <RenderLine> rl_list = new List <RenderLine>();

            rl_list.AddRange(linesH);
            rl_list.AddRange(linesV);


            //var linesV = ToolsFindLine.FindLinesV(bitmapRot.Width, bitmapRot.Height, PageLayout.LineSize.Value, PageLayout.LineOffset.Value);
            ImageLayout = RenderBitmap(bitmapRot, rl_list);
        }