public RasterImage(
RasterImage srcImage
)
- (nullable instancetype)initWithImage:(LTRasterImage *)rasterImage error:(NSError **)error
public RasterImage(
RasterImage srcImage
);
public:
RasterImage(
RasterImage^ srcImage
)
__init__(self,srcImage) # Overloaded constructor
srcImage
The RasterImage from which to create the new RasterImage.
This constructor will "pull" all the internal data (image pages, metadata, etc) from srcImage and puts a copy of them into the newly created RasterImage.
After calling this constructor, srcImage remains valid and changes to its properties or data will not affect the newly created RasterImage object.
This constructor is useful when deriving your own classes from RasterImage as shown in the example below.
For more information, refer to Grayscale Images.
This example derives a new class from then use the RasterImage(RasterImage) constructor.
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;
// A class that derives from RasterImage
public class MyRasterImage : RasterImage
{
private int _myData;
public MyRasterImage(RasterImage src)
:
base(src)
{
_myData = 0;
}
public int MyData
{
get
{
return _myData;
}
set
{
_myData = value;
}
}
}
public void DerivedRasterImage()
{
RasterCodecs codecs = new RasterCodecs();
string srcFileName = Path.Combine(LEAD_VARS.ImagesDir, "Image1.cmp");
// Load the image
RasterImage img = codecs.Load(srcFileName);
// create a new MyRasterImage instance out of this image
MyRasterImage myImage = new MyRasterImage(img);
// img is inavlid now and shoule be disposed
img.Dispose();
// Now you can use myImage just like any other RasterImage but with your own data
myImage.PaintGamma = 50; // RasterImage property
myImage.MyData = 10; // MyRasterImage property
Assert.IsTrue(myImage.PaintGamma == 50);
Assert.IsTrue(myImage.MyData == 10);
// Clean up
myImage.Dispose();
codecs.Dispose();
}
static class LEAD_VARS
{
public const string ImagesDir = @"C:\LEADTOOLS22\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