Esempio n. 1
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);
            }
        }
Esempio n. 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);
            }
        }
Esempio n. 3
0
        /// <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);
            }
        }