Updates the data of this
RasterImage.
Syntax
Visual Basic (Usage) | Copy Code |
---|
Dim instance As RasterImage
Dim data() As Byte
Dim dataOffset As Integer
instance.CopyData(data, dataOffset)
|
Parameters
- data
- Buffer containing the image new data.
- dataOffset
- Offset into data where the copy operation should begin.
Example
Visual Basic | Copy Code |
---|
Public Sub CopyDataExample()
RasterCodecs.Startup()
Dim codecs As RasterCodecs = New RasterCodecs()
Dim image As RasterImage = codecs.Load(LeadtoolsExamples.Common.ImagesPath.Path + "IMAGE1.CMP")
Dim data As Byte() = New Byte(image.BytesPerLine * image.Height - 1) {}
Dim val As Integer = 0
Dim x As Integer = 0
Do While x < data.Length
data(x) = CByte(val)
val += 1
If val > 255 Then
val = 0
End If
x += 1
Loop
image.CopyData(data, 0)
codecs.Save(image, LeadtoolsExamples.Common.ImagesPath.Path + "CopyData.bmp", RasterImageFormat.Bmp, 0)
image.Dispose()
codecs.Dispose()
RasterCodecs.Shutdown()
End Sub |
C# | Copy Code |
---|
public void CopyDataExample() { RasterCodecs.Startup(); RasterCodecs codecs = new RasterCodecs(); RasterImage image = codecs.Load(LeadtoolsExamples.Common.ImagesPath.Path + "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, LeadtoolsExamples.Common.ImagesPath.Path + "CopyData.bmp", RasterImageFormat.Bmp, 0); image.Dispose(); codecs.Dispose(); RasterCodecs.Shutdown(); } |
Remarks
Requirements
Target Platforms: Microsoft .NET Framework 3.0, Windows XP, Windows Server 2003 family, Windows Server 2008 family
See Also