public int CopyRepetitions { get; } public:property int CopyRepetitions {int get();}
CopyRepetitions # get (RasterBufferResize)
The number of times needed to copy the new resized line buffer to the new image.
When an image is being enlarged, some lines must be copied more than once. When an image is being reduced, some lines must be eliminated (not copied at all).
For example:
using Leadtools;using Leadtools.Codecs;public void RasterBufferResizeExample(){string srcFileName = Path.Combine(LEAD_VARS.ImagesDir, "Image1.cmp");string destFileName = Path.Combine(LEAD_VARS.ImagesDir, "Image1_resized.bmp");using (RasterCodecs codecs = new RasterCodecs()){codecs.ThrowExceptionsOnInvalidImages = true;// Load the source imageusing (RasterImage srcImage = codecs.Load(srcFileName)){int destWidth = srcImage.Width / 2;int destHeight = srcImage.Height / 2;// Create the destination imageusing (RasterImage destImage = new RasterImage(RasterMemoryFlags.Conventional,destWidth,destHeight,srcImage.BitsPerPixel,srcImage.Order,srcImage.ViewPerspective,srcImage.GetPalette(),IntPtr.Zero,0)){// allocate buffer for one scanline from source imagebyte[] scanLine = new byte[srcImage.BytesPerLine];// resize itRasterBufferResize bufferResize = new RasterBufferResize();// Initialize the resize process.bufferResize.Start(srcImage.Width, srcImage.Height, destImage.Width, destImage.Height);srcImage.Access();destImage.Access();// Current destination row numberint destRow = 0;for (int i = 0; i < srcImage.Height; i++){// Get a scanline from the source image and resize itsrcImage.GetRow(i, scanLine, 0, srcImage.BytesPerLine);bufferResize.ResizeBuffer(scanLine, 0, i, srcImage.BitsPerPixel);// Output as many or as few rows as ResizeBuffer suppliesfor (int j = 0; j < bufferResize.CopyRepetitions; j++){destImage.SetRow(destRow, scanLine, 0, bufferResize.LineWidth * 3);destRow++;}}destImage.Release();srcImage.Release();bufferResize.Stop();// Save the destination imagecodecs.Save(destImage, destFileName, RasterImageFormat.Bmp, 24);}}}}static class LEAD_VARS{public const string ImagesDir = @"C:\LEADTOOLS23\Resources\Images";}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document
