LEADTOOLS (Leadtools assembly)
LEAD Technologies, Inc

Convert(IBuffer,Int32,Int32,Int32,Int32,RasterByteOrder,RasterByteOrder,RasterColor[],RasterColor[],Int32,Int32,Int32,RasterConvertBufferFlags) Method






The input buffer.
The zero-based offset into the buffer where conversion should start.
Width in pixels of the input image data.
BitsPerPixel of the input image data.
BitsPerPixel of the desired output image data.
The input color order.
The output color order.
The palette or 8-bit LUT for the existing data, before conversion. If the input data is not palettized and not grayscale, use NULL.
The palette for the converted data. If the data is converted to 16 or 24 bits per pixel color, use NULL for no palette.
Value indicating the low bit in the source buffer, if the source buffer contains grayscale data.
Value indicating the high bit in the source buffer, if the source buffer contains grayscale data.
The alpha value if the destination bits per pixel contains an alpha component
Flags indicating whether to treat 16 bit data as grayscale or color.
Converts data in the specified buffer to the specified bits per pixel and color order. .NET support WinRT support
Syntax
public static void Convert( 
   IBuffer buffer,
   int bufferOffset,
   int width,
   int inBitsPerPixel,
   int outBitsPerPixel,
   RasterByteOrder inOrder,
   RasterByteOrder outOrder,
   RasterColor[] inPalette,
   RasterColor[] outPalette,
   int lowBit,
   int highBit,
   int alpha,
   RasterConvertBufferFlags flags
)
'Declaration
 
Public Overloads Shared Sub Convert( _
   ByVal buffer As IBuffer, _
   ByVal bufferOffset As Integer, _
   ByVal width As Integer, _
   ByVal inBitsPerPixel As Integer, _
   ByVal outBitsPerPixel As Integer, _
   ByVal inOrder As RasterByteOrder, _
   ByVal outOrder As RasterByteOrder, _
   ByVal inPalette() As RasterColor, _
   ByVal outPalette() As RasterColor, _
   ByVal lowBit As Integer, _
   ByVal highBit As Integer, _
   ByVal alpha As Integer, _
   ByVal flags As RasterConvertBufferFlags _
) 
'Usage
 
Dim buffer As IBuffer
Dim bufferOffset As Integer
Dim width As Integer
Dim inBitsPerPixel As Integer
Dim outBitsPerPixel As Integer
Dim inOrder As RasterByteOrder
Dim outOrder As RasterByteOrder
Dim inPalette() As RasterColor
Dim outPalette() As RasterColor
Dim lowBit As Integer
Dim highBit As Integer
Dim alpha As Integer
Dim flags As RasterConvertBufferFlags
 
RasterBufferConverter.Convert(buffer, bufferOffset, width, inBitsPerPixel, outBitsPerPixel, inOrder, outOrder, inPalette, outPalette, lowBit, highBit, alpha, flags)
public static void Convert( 
   IBuffer buffer,
   int bufferOffset,
   int width,
   int inBitsPerPixel,
   int outBitsPerPixel,
   RasterByteOrder inOrder,
   RasterByteOrder outOrder,
   RasterColor[] inPalette,
   RasterColor[] outPalette,
   int lowBit,
   int highBit,
   int alpha,
   RasterConvertBufferFlags flags
)
 function Leadtools.RasterBufferConverter.Convert(IBuffer,Int32,Int32,Int32,Int32,RasterByteOrder,RasterByteOrder,RasterColor[],RasterColor[],Int32,Int32,Int32,RasterConvertBufferFlags)( 
   buffer ,
   bufferOffset ,
   width ,
   inBitsPerPixel ,
   outBitsPerPixel ,
   inOrder ,
   outOrder ,
   inPalette ,
   outPalette ,
   lowBit ,
   highBit ,
   alpha ,
   flags 
)
public:
static void Convert( 
   IBuffer^ buffer,
   int bufferOffset,
   int width,
   int inBitsPerPixel,
   int outBitsPerPixel,
   RasterByteOrder inOrder,
   RasterByteOrder outOrder,
   array<RasterColor>^ inPalette,
   array<RasterColor>^ outPalette,
   int lowBit,
   int highBit,
   int alpha,
   RasterConvertBufferFlags flags
) 

Parameters

buffer
The input buffer.
bufferOffset
The zero-based offset into the buffer where conversion should start.
width
Width in pixels of the input image data.
inBitsPerPixel
BitsPerPixel of the input image data.
outBitsPerPixel
BitsPerPixel of the desired output image data.
inOrder
The input color order.
outOrder
The output color order.
inPalette
The palette or 8-bit LUT for the existing data, before conversion. If the input data is not palettized and not grayscale, use NULL.
outPalette
The palette for the converted data. If the data is converted to 16 or 24 bits per pixel color, use NULL for no palette.
lowBit
Value indicating the low bit in the source buffer, if the source buffer contains grayscale data.
highBit
Value indicating the high bit in the source buffer, if the source buffer contains grayscale data.
alpha
The alpha value if the destination bits per pixel contains an alpha component
flags
Flags indicating whether to treat 16 bit data as grayscale or color.
Remarks

Note: This method will also work for 12 and 16-bit grayscale images, but only in the Document/Medical Imaging editions. If you attempt to use this method with a 12 or 16-bit grayscale image, but you do not have a Medical Imaging edition, it will throw an exception.

The conversion uses only one buffer, which must be large enough to hold the data before and after conversion.

Image data that is 8 bits per pixel or less must use a palette, and this method can use such data as input, output, or both. Therefore, you may need to specify the palette for the input, or for the output, or both.

If either inBitsPerPixel or outBitsPerPixel is 16, flags is used to determine whether the data should be treated as color or grayscale.

If nBitsPerPixelSrc is 12, it is assumed to be grayscale. However, the flags parameter should also reflect that it is grayscale for future compatibility. If the source is grayscale, inPalette can be set to a palette. The palette should contain N entries. If the source uses lowBit and highBit, then N equals 2 raised to the power of (highBit - lowBit + 1). Otherwise, N equals 2 raised to the power of inBitsPerPixel.

The flags parameter supersedes inOrder and outOrder. If you specify RasterByteOrder.Bgr for inOrder, but use RasterConvertBufferFlags.SourceGray in flags, it will be assumed that the source buffer contains grayscale data.

For more information, refer to Introduction to Image Processing With LEADTOOLS.

Example
Refer to RasterBufferConverter and CalculateConvertSize
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

RasterBufferConverter Class
RasterBufferConverter Members
Overload List
ColorResolutionCommand
Introduction: Color Resolution and Dithering
Dithering Methods
Introduction to Image Processing With LEADTOOLS

 

 


Products | Support | Contact Us | Copyright Notices

© 2006-2012 All Rights Reserved. LEAD Technologies, Inc.