ImageGear .NET
Palette Property
Example 




Gets or sets image palette, for images that have Indexed colorspace.
Syntax
'Declaration
 
Public Property Palette As ImGearRGBQuad()
'Usage
 
Dim instance As ImGearDIB
Dim value() As ImGearRGBQuad
 
instance.Palette = value
 
value = instance.Palette
public ImGearRGBQuad[] Palette {get; set;}
public: __property ImGearRGBQuad[]* get_Palette();
public: __property void set_Palette( 
   ImGearRGBQuad[]* value
);
public:
property array<ImGearRGBQuad>^ Palette {
   array<ImGearRGBQuad>^ get();
   void set (    array<ImGearRGBQuad>^ value);
}

Property Value

Array of ImGearRGBQuad structure objects or null.
Remarks
Provides full access to the DIB's palette represented as an array of ImGearRGBQuad structure objects.

Palette must be present in images that have ImGearColorSpaceIDs.I colorspace. Palette is ignored in images that have other colorspaces.

Example
ImGearPage igPage;
// Load an image into a ImGearPage object.
using (FileStream localFile = new FileStream(localFilePath, FileMode.Open))
    igPage = ImGearFileFormats.LoadPage(localFile, 0);
// Build and apply palette if image is indexed.
if (igPage.DIB.ColorSpace.Value == ImGearColorSpaceIDs.I)
{
    // Create a simple palette of red colors
    ImGearRGBQuad[] igRGBQuad = new ImGearRGBQuad[256];
    for (int i = 0; i < 256; ++i)
        igRGBQuad[i].Red = (byte)i;
    // Assign the new Palette
    igPage.DIB.Palette = igRGBQuad;
}
Dim igPage As ImGearPage
'Load an image into a ImGearPage object.
Dim localFile As FileStream = New FileStream(localFilePath, FileMode.Open)
Try
    igPage = ImGearFileFormats.LoadPage(localFile, 0)
Finally
    localFile.Close()
End Try
' Build and apply palette if image is indexed.
If (igPage.DIB.ColorSpace.Value = ImGearColorSpaceIDs.I) Then
    'Create a simple palette of red colors
    Dim igRGBQuad(256) As ImGearRGBQuad
    For i As Integer = 0 To 255
        igRGBQuad(i).Red = i
    Next
    'Assign the new Palette
    igPage.DIB.Palette = igRGBQuad
End If
See Also

Reference

ImGearDIB Class
ImGearDIB Members
ImGearRGBQuad Structure

 

 


©2016. Accusoft Corporation. All Rights Reserved.

Send Feedback