TransparentColor Property (original) (raw)

Summary

Gets or sets the transparent color used when painting this image.

Syntax

C#

Objective-C

C++/CLI

Java

Python

@property (nonatomic, copy) LTRasterColor *transparentColor 

Property Value

The transparent color used when painting this image.

Example

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 TransparentColorExample() { RasterCodecs codecs = new RasterCodecs(); string srcFileName = Path.Combine(LEAD_VARS.ImagesDir, "Ocr1.tif"); string destFileName = Path.Combine(LEAD_VARS.ImagesDir, "Ocr1_Transparent.gif"); // Load the image RasterImage image = codecs.Load(srcFileName); // Change the image's palette to be Red and Blue RasterColor[] redBluePalette = new RasterColor[2]; redBluePalette[0] = RasterColor.FromKnownColor(RasterKnownColor.Red); redBluePalette[1] = RasterColor.FromKnownColor(RasterKnownColor.Blue); image.SetPalette(redBluePalette, 0, 2); // make red the transparent color image.Transparent = true; image.TransparentColor = redBluePalette[0]; // Save the image codecs.Save(image, destFileName, RasterImageFormat.Gif, 8); // Now load Ocr1_Transparent.gif in Internet Explorer. // Notice how red is treated as a transparent color. // You should get Blue text on a white background // (if IE's background color is white). image.Dispose(); codecs.Dispose(); } static class LEAD_VARS { public const string ImagesDir = @"C:\LEADTOOLS22\Resources\Images"; }

Leadtools Assembly

Convert(byte[],int,int,int,int,RasterByteOrder,RasterByteOrder,RasterColor[],RasterColor[],int,int,int,RasterConvertBufferFlags) Method

Convert(byte[],int,int,int,int,RasterByteOrder,RasterByteOrder,RasterColor[],RasterColor[],RasterColor16[],RasterColor16[],int,int,int,RasterConvertBufferFlags) Method

Convert(IntPtr,int,int,int,RasterByteOrder,RasterByteOrder,RasterColor[],RasterColor[],int,int,int,RasterConvertBufferFlags) Method

Convert(IntPtr,int,int,int,RasterByteOrder,RasterByteOrder,RasterColor[],RasterColor[],RasterColor16[],RasterColor16[],int,int,int,RasterConvertBufferFlags) Method