public RasterColor BackColor { get; set; }
@property (nonatomic, copy) LTRasterColor *backColor;
public RasterColor getBackColor()
public void setBackColor(RasterColor value)
public:
property RasterColor BackColor {
RasterColor get();
void set ( RasterColor );
}
BackColor # get and set (BarcodeWriteOptions)
A RasterColor that specifies the barcode background (spaces) color to use when writing barcodes. Default value is "White" (RGB of #FFFFFF). The default value is #FFFFFFFF
.
LEADTOOLS will use ForeColor and BackColor when drawing the new barcode to the image and no special processing is performed. Note that you can specify a transparent color for BackColor to "overlay" the barcode on top of the background of the image. This however is not recommended.
using Leadtools;
using Leadtools.Codecs;
using Leadtools.Barcode;
using Leadtools.ImageProcessing;
public void BarcodeWriteOptions_ColorsExample()
{
string imageFileName = Path.Combine(LEAD_VARS.ImagesDir, "MyBarcode.png");
BarcodeEngine engine = new BarcodeEngine();
BarcodeWriter writer = engine.Writer;
// We will create a Red over Yellow backround
RasterColor foreColor = RasterColor.FromKnownColor(RasterKnownColor.Red);
RasterColor backColor = RasterColor.FromKnownColor(RasterKnownColor.Yellow);
// Create a UPC-A barcode
BarcodeData barcode = BarcodeData.CreateDefaultBarcodeData(BarcodeSymbology.UPCA);
barcode.Bounds = new LeadRect(0, 0, 400, 200);
// Create a 24 BPP image the same size as the barcode
// The image will have red over yellow colors
int resolution = 300;
LeadRect pixels = barcode.Bounds;
using (RasterImage image = RasterImage.Create(pixels.Width, pixels.Height, 24, resolution, backColor))
{
// Change the barcode colors to be Red over Yellow
OneDBarcodeWriteOptions options = writer.GetDefaultOptions(BarcodeSymbology.UPCA) as OneDBarcodeWriteOptions;
options.ForeColor = foreColor;
options.BackColor = backColor;
// Write the barcode
writer.WriteBarcode(image, barcode, options);
// Save as PNG
using (RasterCodecs codecs = new RasterCodecs())
{
codecs.Save(image, imageFileName, RasterImageFormat.Png, 24);
}
}
}
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
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.