All products / Saraff.Twain.NET / Contents
Color Information for an Image
This operations assume that the application has instructed the DS to use the TwPixelType.Palette type for its PixelType capability and that the DS has accepted this. The Palette operations allow the application to inquire about a Source’s support for palette color data and to set up a palette color transfer. The operations are specialized for 8-bit data, whether grayscale or color (8-bit or 24-bit). To operate with a palette provides the following methods:
ColorPalette Get()
- This operation causes the DS to report its current palette informationColorPalette GetDefault()
- This operation causes the DS to report its power-on default palettevoid Reset(ColorPalette palette)
- This operation causes the DS to dispose of any current palette it has and to use its default palette for the next palette transfervoid Set(ColorPalette palette)
- This operation requests that the DS adopt the specified palette for use with all subsequent palette transfers
Example usage is shown below:
this._palette=this._twain32.Palette.Get();
Color _color=this._palette.Colors[e.ImageMemXfer.ImageData[_rowOffset+_colOffset]];
this._stream.Write(new byte[] { _color.R,_color.G,_color.B },0,3);