/// <summary> /// Progressively decodes the background image /// </summary> /// <param name="backgroundMap"></param> public IWPixelMap ProgressiveDecodeBackground(IWPixelMap backgroundMap) { using (DjvuReader reader = Reader.CloneReader(_dataLocation, Length)) { backgroundMap.Decode(reader); } return backgroundMap; }
/// <summary> /// Gets the background image for the page /// </summary> /// <returns></returns> private System.Drawing.Bitmap GetBackgroundImage(int subsample, bool resizeImage = false) { BG44Chunk[] backgrounds = PageForm.GetChildrenItems <BG44Chunk>(); if (backgrounds == null || backgrounds.Count() == 0) { return(CreateBlankImage(Brushes.White, Info.Width, Info.Height)); } // Get the composite background image Wavelet.IWPixelMap backgroundMap = null; lock (_loadingLock) { foreach (var background in backgrounds) { if (backgroundMap == null) { // Get the initial image backgroundMap = background.BackgroundImage; } else { if (_isBackgroundDecoded == false) { background.ProgressiveDecodeBackground(backgroundMap); } } } _isBackgroundDecoded = true; } Bitmap result = backgroundMap.GetPixmap().ToImage(); return(resizeImage == true?ResizeImage(result, Info.Width / subsample, Info.Height / subsample) : result); }
/// <summary> /// Decodes the background image for this chunk /// </summary> /// <returns></returns> private IWPixelMap DecodeBackgroundImage() { using (DjvuReader reader = Reader.CloneReader(_dataLocation, Length)) { IWPixelMap background = new IWPixelMap(); background.Decode(reader); return background; } }
/// <summary> /// Decodes the thumbnail image for this chunk /// </summary> /// <returns></returns> private IWPixelMap DecodeThumbnailImage() { using (DjvuReader reader = Reader.CloneReader(_dataLocation, Length)) { IWPixelMap thumbnail = new IWPixelMap(); thumbnail.Decode(reader); return thumbnail; } }