private static PageImage CreateFaxTiffSlowTrack(PageImage page, PaperSize paperSize, FaxQuality faxQuality, ImageOperationResult result) { PageInfo inf = null; PageImage ret = new PageImage(); Bitmap src = null; Bitmap destroy = null; Trace.WriteLine("SlowTrack: CreateCopyExact...", MODNAME); src = BitmapHelper.CreateCopyExact(page._sourceBmp); Trace.WriteLine("SlowTrack: CreateCopyExact done.", MODNAME); inf = new PageInfo(src); if (inf.GetBestFitRotation != 0) { Trace.WriteLine("SlowTrack: Rotating...", MODNAME); destroy = src; src = BitmapHelper.CreateCopyRotate(src, 90); if (destroy != null) { destroy.Dispose(); destroy = null; } inf = new PageInfo(src); Trace.WriteLine("SlowTrack: Rotating done.", MODNAME); } destroy = src; Trace.WriteLine("SlowTrack: CreateCopyFaxGeometry...", MODNAME); src = BitmapHelper.CreateCopyFaxGeometry(src, faxQuality, paperSize, ImageUtility.InterpolationMode); Trace.WriteLine("SlowTrack: CreateCopyFaxGeometry done.", MODNAME); if (destroy != null) { destroy.Dispose(); destroy = null; } inf = new PageInfo(src); destroy = src; Trace.WriteLine("SlowTrack: CreateCopy1BppIndexed: " + ImageUtility.ConvertTo1BppMethod.ToString() + "...", MODNAME); src = BitmapHelper.CreateCopy1BppIndexed(src); Trace.WriteLine("SlowTrack: CreateCopy1BppIndexed done.", MODNAME); if (destroy != null) { destroy.Dispose(); destroy = null; } inf = new PageInfo(src); ret._pageInfo = null; ret._sourceBmp = src; return(ret); }
private static PageImage CreateFaxTiffFastTrack(PageImage page, PaperSize paperSize, FaxQuality faxQuality, ImageOperationResult result) { PageInfo inf = null; PageImage ret = new PageImage(); Bitmap src = null; Bitmap destroy = null; src = BitmapHelper.CreateCopy1BppIndexed(page._sourceBmp); inf = new PageInfo(src); //If the size is not right copy to other size (padding or reducing) if (inf.GetStandardPaperSize != paperSize) { if (inf.GetStandardPaperSize == PaperSize.Legal && paperSize == PaperSize.Letter) { destroy = src; src = BitmapHelper.CreateCopyFaxGeometry(src, faxQuality, paperSize, ImageUtility.InterpolationMode); if (destroy != null) { destroy.Dispose(); destroy = null; } inf = new PageInfo(src); } if (inf.GetStandardPaperSize == PaperSize.Letter && paperSize == PaperSize.Legal) { destroy = src; src = BitmapHelper.CreateCopyFaxGeometryPadding(src, faxQuality, paperSize); if (destroy != null) { destroy.Dispose(); destroy = null; } inf = new PageInfo(src); } } //Make sure its 1bpp if (inf.PixelFormat != PixelFormat.Format1bppIndexed) { destroy = src; src = BitmapHelper.CreateCopy1BppIndexed(src); if (destroy != null) { destroy.Dispose(); destroy = null; } inf = new PageInfo(src); } //Reduce or increase quality as needed if (inf.GetStandardFaxQuality != faxQuality) { if (inf.GetStandardFaxQuality == FaxQuality.Fine && faxQuality == FaxQuality.Normal) { destroy = src; src = BitmapHelper.ConvertTiffHiToTiffLow(src, ImageUtility.HighToLowScaleMethod); if (destroy != null) { destroy.Dispose(); destroy = null; } inf = new PageInfo(src); } if (inf.GetStandardFaxQuality == FaxQuality.Normal && faxQuality == FaxQuality.Fine) { destroy = src; src = BitmapHelper.ConvertTiffLowToTiffHi(src); if (destroy != null) { destroy.Dispose(); destroy = null; } inf = new PageInfo(src); } } ret._pageInfo = null; ret._sourceBmp = src; return(ret); }