←Select platform

CopyData(Byte[],Int32) Method

Summary
Updates the data of this RasterImage.
Syntax
C#
C++/CLI
Java
Python
public void CopyData(  
   byte[] data, 
   int dataOffset 
) 
public void copyData( 
   byte[] byte[Value,  
   int intValue,  
   long longValue 
); 
public: 
void CopyData(  
   array<byte>^ data, 
   int dataOffset 
)  
def CopyData(self,data,dataOffset): 

Parameters

data
Buffer containing the image new data.

dataOffset
Offset into  data where the copy operation should begin.

Remarks

The byte array that you specify will be copied.

The data is copied as is into the internal memory of this RasterImage.

Example
C#
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.ImageProcessing; 
using Leadtools.ImageProcessing.Core; 
using Leadtools.ImageProcessing.Color; 
using Leadtools.Dicom; 
using Leadtools.Drawing; 
using Leadtools.Controls; 
using Leadtools.Svg; 
 
 
public void CopyDataExample() 
{ 
   RasterCodecs codecs = new RasterCodecs(); 
   RasterImage image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "IMAGE1.CMP")); 
 
   byte[] data = new byte[image.BytesPerLine * image.Height]; 
   int val = 0; 
   for (int x = 0; x < data.Length; x++) 
   { 
      data[x] = (byte)val; 
      val++; 
      if (val > 255) 
         val = 0; 
   } 
   image.CopyData(data, 0); 
 
   codecs.Save(image, Path.Combine(LEAD_VARS.ImagesDir, "CopyData.bmp"), RasterImageFormat.Bmp, 0); 
 
   image.Dispose(); 
   codecs.Dispose(); 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS23\Resources\Images"; 
} 
Requirements

Target Platforms

Help Version 23.0.2024.5.22
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

Leadtools Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.