public void UpdateOverlayAttributes(
int index,
RasterOverlayAttributes attributes,
RasterGetSetOverlayAttributesFlags flags
)
- (BOOL)updateOverlayAttributes:(LTRasterOverlayAttributes *)attributes
atIndex:(NSInteger)index
flags:(LTRasterGetSetOverlayAttributesFlags)flags
error:(NSError **)error
public void updateOverlayAttributes(
int index,
RasterOverlayAttributes attributes,
int flags
);
public:
void UpdateOverlayAttributes(
int index,
RasterOverlayAttributes^ attributes,
RasterGetSetOverlayAttributesFlags flags
)
def UpdateOverlayAttributes(self,index,attributes,flags):
index
The zero-based index of the overlay for which the attributes are being set.
attributes
An RasterOverlayAttributes object containing the overlay attributes to set.
flags
Flags that determine which attributes to set.
This method can be used to set some or all the overlay attributes. Before calling this method, initialize the attributes object members with all the attributes to be set or changed.
You do not need to initialize the object variables that you are not setting or changing. For example, if RasterGetSetOverlayAttributesFlags.Origin is not set in flags, you do not need to initialize RasterOverlayAttributes.Origin member of attributes.
There are several attributes in flags and you cannot change only one flag. If you want to change only one flag, you will first have to get all the flags and change only the flag you want. See the example for more information.
For more information, refer to Overlay Overview.
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 GetOverlayImageExample()
{
RasterCodecs codecs = new RasterCodecs();
// load an image and set an overlay
RasterImage image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "DICOM", "image2.dcm"), 0, CodecsLoadByteOrder.BgrOrGray, 1, 1);
RasterImage imageOverlay1 = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "ulay1.bmp"), 1, CodecsLoadByteOrder.Rgb, 1, 1);
RasterImage imageOverlay2 = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "ulay1.bmp"), 1, CodecsLoadByteOrder.Rgb, 1, 1);
image.SetOverlayImage(0, imageOverlay1, RasterGetSetOverlayImageMode.Copy);
image.SetOverlayImage(1, imageOverlay2, RasterGetSetOverlayImageMode.Copy);
// update the attributes of one of the overlays
RasterOverlayAttributes attributes = image.GetOverlayAttributes(0,
RasterGetSetOverlayAttributesFlags.Color |
RasterGetSetOverlayAttributesFlags.Flags |
RasterGetSetOverlayAttributesFlags.Origin |
RasterGetSetOverlayAttributesFlags.BitIndex);
attributes.Color = new RasterColor(255, 255, 255);
attributes.AutoPaint = true;
attributes.AutoProcess = true;
attributes.Origin = new LeadPoint(5, 5);
attributes.BitPosition = image.BitsPerPixel - 1;
image.UpdateOverlayAttributes(
0,
attributes,
RasterGetSetOverlayAttributesFlags.Color |
RasterGetSetOverlayAttributesFlags.Flags |
RasterGetSetOverlayAttributesFlags.Origin |
RasterGetSetOverlayAttributesFlags.BitIndex);
int count = image.OverlayCount;
for (int i = 0; i < count; i++)
{
using (RasterImage overlayTest = image.GetOverlayImage(i, RasterGetSetOverlayImageMode.NoCopy))
{
string fileName = string.Format(Path.Combine(LEAD_VARS.ImagesDir, "overlay{0}_copy.bmp"), i);
codecs.Save(overlayTest, fileName, RasterImageFormat.Bmp, 1);
}
}
image.Dispose();
imageOverlay1.Dispose();
imageOverlay2.Dispose();
codecs.Dispose();
}
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