public ReduceColors ( |
||
image | Source image to process. | |
palette | Color | Target color palette. Must contatin 2-256 colors. |
return |
public Bitmap ReduceColors( Bitmap image, Color[] palette )
{
BitmapData data = image.LockBits( new Rectangle( 0, 0, image.Width, image.Height ),
ImageLockMode.ReadOnly, image.PixelFormat );
try
{
Bitmap result = ReduceColors( new UnmanagedImage( data ), palette );
if ( ( image.HorizontalResolution > 0 ) && ( image.VerticalResolution > 0 ) )
{
result.SetResolution( image.HorizontalResolution, image.VerticalResolution );
}
return result;
}
finally
{
image.UnlockBits( data );
}
}
ColorImageQuantizer::ReduceColors ( |
|
ColorImageQuantizer::ReduceColors ( UnmanagedImage image, Color palette ) : |
|
ColorImageQuantizer::ReduceColors ( UnmanagedImage image, int paletteSize ) : |