←Select platform

Is this page helpful?

In this page

IsReservedColor Property

Summary

This property indicates whether RasterColor.Reserved is set to 1. Setting this property to true sets RasterColor.Reserved or RasterColor.ReservedColor to 1.

Syntax
C#
C++/CLI
Python
[XmlIgnoreAttribute()] 
public bool IsReservedColor { get; set; } 
public:  
   [XmlIgnoreAttribute] 
   property bool IsReservedColor 
   { 
      bool get() 
      void set(bool value) 
   } 
IsReservedColor # get and set (RasterColor) 

Property Value

true if RasterColor.Reserved is 1. false if RasterColor.Reserved is not 1.

Remarks

This is the same as checking whether RasterColor.Reserved == 2 (or RasterColor.Reserved == RasterColor.EmptyColor).

Example

C#
Copied to clipboard
// This C# example assumes 'image' is a 24/32/48/64-bit bitmap. It converts it to an optimized palette of 255 colors.  
// In this case, pick a color for 'palette[0]' and let the other 255 entries be filled by ColorResolutionCommand.  
 
private static void TestCustomOptimizedPalette(RasterImage image) 
{ 
   RasterColor[] palette = new RasterColor[256]; 
 
   // Pick a color for the first palette entry (for example, a bitmap with a transparent color). 
   // In this case, set this entry to a color that is not in the image and then fill the transparent area with this color.  
 
   palette[0] = new RasterColor(1, 1, 1); 
   palette[0].IsReservedColor = true;  // Mark this color as reserved 
 
   // Mark all the other palette entries as empty, so ColorResolutionCommand will fill them  
   for (int i = 1; i <= 255; i++) 
      palette[i].IsEmptyColor = true; // Mark all remaining palette entries as empty 
 
   ColorResolutionCommand cmd = 
   new ColorResolutionCommand(ColorResolutionCommandMode.InPlace, 
                              8, 
                              RasterByteOrder.Rgb, 
                              RasterDitheringMethod.FloydStein, 
                              ColorResolutionCommandPaletteFlags.Optimized, 
                              null); 
   cmd.SetPalette(palette); 
 
   cmd.Run(image); 
    
   // Now 'image' is an 8-bit image with a palette. If you do 'RasterColor[] imagePalette = image.GetPalette()': 
   //   - imagePalette[0] should be the selected color 
   //   - imagePalette[1], imagePalette[2], ... imagePalette[255] should be various colors chosen by the ColorResolution command 
    
}    
Requirements

Target Platforms

Help Version 23.0.2024.5.22
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2025 Apryse Sofware Corp. All Rights Reserved.

Leadtools Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2025 Apryse Sofware Corp. All Rights Reserved.