コード例 #1
0
        public GBitmap GetBitmapList(GRect rect, int subsample, int align, List <int> components)
        {
            if (rect.Empty)
            {
                return(new Graphics.Bitmap());
            }

            if (Info != null)
            {
                int width  = Info.Width;
                int height = Info.Height;

                JB2Image fgJb2 = ForegroundJB2Image;

                if (
                    (width != 0) &&
                    (height != 0) &&
                    (fgJb2 != null) &&
                    (fgJb2.Width == width) &&
                    (fgJb2.Height == height))
                {
                    return(fgJb2.GetBitmap(rect, subsample, align, 0, components));
                }
            }

            return(null);
        }
コード例 #2
0
        internal DjvuNet.Graphics.Map GetForegroundMap()
        {
            lock (LoadingLock)
            {
                DjvuNet.Graphics.Map result     = null;
                JB2Image             jb2image   = null;
                IInterWavePixelMap   iwPixelMap = _Page.ForegroundIWPixelMap;

                if (iwPixelMap != null)
                {
                    result = _Page.ForegroundIWPixelMap.GetPixelMap();
                }
                else if ((jb2image = _Page.ForegroundJB2Image) != null)
                {
                    if (_Page.ForegroundPalette == null)
                    {
                        result = jb2image.GetBitmap(1, GBitmap.BorderSize);
                    }
                    else
                    {
                        result = jb2image.GetPixelMap(_Page.ForegroundPalette, 1, 16);
                    }
                }
                else if (iwPixelMap == null && jb2image == null)
                {
                    result = new GBitmap(_Page.Height, _Page.Width, GBitmap.BorderSize);
                }

                return(result);
            }
        }
コード例 #3
0
        /// <summary>
        /// Gets the foreground image for the page
        /// </summary>
        /// <param name="resizeToPage"></param>
        /// <returns></returns>
        internal System.Drawing.Bitmap GetForegroundImage(int subsample, bool resizeImage = false)
        {
            Verify.SubsampleRange(subsample);

            lock (LoadingLock)
            {
                Bitmap result = null;

                JB2Image           jb2image   = null;
                IInterWavePixelMap iwPixelMap = _Page.ForegroundIWPixelMap;

                if (iwPixelMap != null)
                {
                    result = _Page.ForegroundIWPixelMap.GetPixelMap().ToImage();
                }
                else if ((jb2image = _Page.ForegroundJB2Image) != null)
                {
                    if (_Page.ForegroundPalette == null)
                    {
                        result = jb2image.GetBitmap(1, GBitmap.BorderSize).ToImage();
                    }
                    else
                    {
                        result = jb2image.GetPixelMap(_Page.ForegroundPalette, 1, 16).ToImage();
                    }
                }
                else if (iwPixelMap == null && jb2image == null)
                {
                    result = CreateBlankImage(Brushes.Black, _Page.Width / subsample, _Page.Height / subsample);
                }

                return(resizeImage ? ResizeImage(result, _Page.Width / subsample, _Page.Height / subsample) : result);
            }
        }
コード例 #4
0
ファイル: DjvuGraphics.cs プロジェクト: rodrigoieh/DjvuNet
        /// <summary>
        /// Gets the foreground image for the page.
        /// </summary>
        /// <param name="resizeToPage"></param>
        /// <returns></returns>
        public static Bitmap GetForegroundImage(this DjvuImage image, int subsample, bool resizeImage = false)
        {
            Verify.SubsampleRange(subsample);

            lock (image.LoadingLock)
            {
                Bitmap result = null;

                JB2Image           jb2image   = null;
                IInterWavePixelMap iwPixelMap = image.Page.ForegroundIWPixelMap;

                if (iwPixelMap != null)
                {
                    result = image.Page.ForegroundIWPixelMap.GetPixelMap().ToImage();
                }
                else if ((jb2image = image.Page.ForegroundJB2Image) != null)
                {
                    if (image.Page.ForegroundPalette == null)
                    {
                        result = jb2image.GetBitmap(1, GBitmap.BorderSize).ToImage();
                    }
                    else
                    {
                        result = jb2image.GetPixelMap(image.Page.ForegroundPalette, 1, 16).ToImage();
                    }
                }
                else if (iwPixelMap == null && jb2image == null)
                {
                    result = CreateBlankImage(Brushes.Black, image.Page.Width / subsample, image.Page.Height / subsample);
                }

                return(resizeImage ? ResizeImage(result, image.Page.Width / subsample, image.Page.Height / subsample) : result);
            }
        }
コード例 #5
0
        /// <summary>
        /// Gets the foreground image for the page
        /// </summary>
        /// <param name="resizeToPage"></param>
        /// <returns></returns>
        internal System.Drawing.Bitmap GetForegroundImage(int subsample, bool resizeImage = false)
        {
            Verify.SubsampleRange(subsample);

            lock (_LoadingLock)
            {
                Bitmap result = null;

                JB2Image jb2image   = null;
                var      iwPixelMap = _Page.ForegroundIWPixelMap;
                if (iwPixelMap != null)
                {
                    result = _Page.ForegroundIWPixelMap.GetPixelMap().ToImage();
                }
                else if ((jb2image = _Page.ForegroundJB2Image) != null)
                {
                    result = jb2image.GetBitmap().ToImage();
                }
                else if (iwPixelMap == null && jb2image == null)
                {
                    result = DjvuImage.CreateBlankImage(Brushes.Black, _Page.Width / subsample, _Page.Height / subsample);
                }

                return(resizeImage == true?DjvuImage.ResizeImage(result, _Page.Width / subsample, _Page.Height / subsample) : result);
            }
        }
コード例 #6
0
ファイル: DjvuPage.cs プロジェクト: sahwar/DjvuNet
        public GBitmap GetBitmapList(GRect rect, int subsample, int align, List<int> components)
        {
            Verify.SubsampleRange(subsample);

            if (rect.Empty)
                return new Graphics.Bitmap();

            int width = Width;
            int height = Height;

            JB2Image fgJb2 = ForegroundJB2Image;

            if (width != 0 && height != 0 && fgJb2 != null && fgJb2.Width == width && fgJb2.Height == height)
                return fgJb2.GetBitmap(rect, subsample, align, 0, components);

            return null;
        }