Updates the data of this
RasterImage.
Supported in Silverlight, Windows Phone 7
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()
Dim codecs As RasterCodecs = New RasterCodecs()
Dim image As RasterImage = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "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, Path.Combine(LEAD_VARS.ImagesDir, "CopyData.bmp"), RasterImageFormat.Bmp, 0)
image.Dispose()
codecs.Dispose()
End Sub
Public NotInheritable Class LEAD_VARS
Public Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"
End Class |
C# | Copy Code |
---|
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:\Users\Public\Documents\LEADTOOLS Images";
} |
SilverlightCSharp | Copy Code |
---|
public void CopyDataExample(RasterImage image, Stream destStream)
{
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);
RasterCodecs codecs = new RasterCodecs();
codecs.Save(image, destStream, RasterImageFormat.Png, 0);
image.Dispose();
} |
SilverlightVB | Copy Code |
---|
Public Sub CopyDataExample(ByVal image As RasterImage, ByVal destStream As Stream)
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)
Dim codecs As RasterCodecs = New RasterCodecs()
codecs.Save(image, destStream, RasterImageFormat.Png, 0)
image.Dispose()
End Sub |
Remarks
Requirements
Target Platforms: Silverlight, Windows XP, Windows Server 2003 family, Windows Server 2008 family, Windows Vista, Windows 7, MAC OS/X (Intel Only), Windows Phone 7
See Also