Converts image data in a managed buffer from one color conversion model directly to another, using built-in algorithms.
public static void ConvertDirect(
ConversionColorFormat srcFormat,
ConversionColorFormat destFormat,
byte[] srcBuffer,
int srcBufferOffset,
byte[] destBuffer,
int destBufferOffset,
int width,
int height,
int inAlign,
int outAlign
)
Public Shared Sub ConvertDirect(
ByVal srcFormat As ConversionColorFormat,
ByVal destFormat As ConversionColorFormat,
ByVal srcBuffer() As Byte,
ByVal srcBufferOffset As Integer,
ByVal destBuffer() As Byte,
ByVal destBufferOffset As Integer,
ByVal width As Integer,
ByVal height As Integer,
ByVal inAlign As Integer,
ByVal outAlign As Integer
)
public:
static void ConvertDirect(
ConversionColorFormat^ srcFormat,
ConversionColorFormat^ destFormat,
array<Byte>^ srcBuffer,
int srcBufferOffset,
array<Byte>^ destBuffer,
int destBufferOffset,
int width,
int height,
int inAlign,
int outAlign
)
srcFormat
Format of the input data.
destFormat
Format of the output data.
srcBuffer
A pointer to the buffer containing the input data.
srcBufferOffset
Offset to the first byte of the srcBuffer data buffer.
destBuffer
A pointer to the buffer containing the output data.
destBufferOffset
Offset to the first byte of the destBuffer data buffer.
width
Width of pixels to be processed.
height
Height of pixels to be processed.
inAlign
Each scanline in the input buffer is a multiple of inAlign bytes.
outAlign
Each scanline in the output buffer is a multiple of outAlign bytes.
There is no need to call the Start and Stop methods to initialize or stop the conversion engine.
Converting from any color space to YCCK color space is currently not supported.
For more information about Alignment Parameters, refer to Alignment Parameters.
To convert to the Yp41 type the input buffer length must be a multiple of 8.
This example will convert a CMYK color to an RGB color, using the ConvertDirect static method.
using Leadtools;
using Leadtools.Codecs;
using Leadtools.ColorConversion;
public void ConvertDirectExample()
{
// StartUp the ColorConversion.
RasterColorConverterEngine.Startup();
// Rgb and Cmyk color buffer arrays
byte[] rgbColor = new byte[3];
byte[] cmykColor = { 100, 100, 100, 100 };
try
{
// direct conversion using built in options
// The srcBufferOffset parameter is an offset to the start byte of the data in the source buffer.
// For example, if the image data started at byte 5, then this variable should = 5.
// in our case here, the image data starts at byte 0.
// The same thing applies to destBufferOffset.
// The cmykColor is a bytes array, you can pass it directly like this example,
// or you can pass an IntPtr pointer to the buffer.
// The same thing applies for rgbColor.
RasterColorConverterEngine.ConvertDirect(
ConversionColorFormat.Cmyk,
ConversionColorFormat.Rgb,
cmykColor,
0,
rgbColor,
0,
1,
1,
0,
0);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
//.
//.
//.
// use rgbColor as you need.
// Shutdown the ColorConversion.
RasterColorConverterEngine.Shutdown();
}
Imports Leadtools
Imports Leadtools.Codecs
Imports Leadtools.ColorConversion
Public Sub ConvertDirectExample()
' StartUp the ColorConversion.
RasterColorConverterEngine.Startup()
' Rgb and Cmyk color buffer arrays
Dim rgbColor(3) As Byte
Dim cmykColor() As Byte = {100, 100, 100, 100}
Try
' direct conversion using built in options
' The srcBufferOffset is an offset that indicates the beginning of the data in the sourec buffer.
' for example, if the data in the source buffer starts at byte 5, then this parameter = 5.
' in our case here, the image data starts at byte 0.
' The same thing applies to destBufferOffset.
' The cmykColor is a bytes array, you can pass it directly like this example,
' or you can pass an IntPtr pointer to the buffer.
' The same thing applies for rgbColor.
RasterColorConverterEngine.ConvertDirect(
ConversionColorFormat.Cmyk,
ConversionColorFormat.Rgb,
cmykColor,
0,
rgbColor,
0,
1,
1,
0,
0)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
'.
'.
'.
' use rgbColor as you need.
' Shutdown the ColorConversion.
RasterColorConverterEngine.Shutdown()
End Sub
using Leadtools;
using Leadtools.Codecs;
using Leadtools.ColorConversion;
public void ConvertDirectExample()
{
// StartUp the ColorConversion.
RasterColorConverterEngine.Startup();
// Rgb and Cmyk color buffer arrays
byte[] rgbColor = new byte[3];
byte[] cmykColor = { 100, 100, 100, 100 };
try
{
// direct conversion using built in options
// The srcBufferOffset parameter is an offset to the start byte of the data in the source buffer.
// For example, if the image data started at byte 5, then this variable should = 5.
// in our case here, the image data starts at byte 0.
// The same thing applies to destBufferOffset.
// The cmykColor is a bytes array, you can pass it directly like this example,
// or you can pass an IntPtr pointer to the buffer.
// The same thing applies for rgbColor.
RasterColorConverterEngine.ConvertDirect(
ConversionColorFormat.Cmyk,
ConversionColorFormat.Rgb,
cmykColor,
0,
rgbColor,
0,
1,
1,
0,
0);
}
catch (Exception)
{
}
//.
//.
//.
// use rgbColor as you need.
// Shutdown the ColorConversion.
RasterColorConverterEngine.Shutdown();
}
Imports Leadtools
Imports Leadtools.Codecs
Imports Leadtools.ColorConversion
Public Sub ConvertDirectExample()
' StartUp the ColorConversion.
RasterColorConverterEngine.Startup()
' Rgb and Cmyk color buffer arrays
Dim rgbColor As Byte() = New Byte(2) {}
Dim cmykColor As Byte() = {100, 100, 100, 100}
Try
' direct conversion using built in options
' The srcBufferOffset parameter is an offset to the start byte of the data in the source buffer.
' For example, if the image data started at byte 5, then this variable should = 5.
' in our case here, the image data starts at byte 0.
' The same thing applies to destBufferOffset.
' The cmykColor is a bytes array, you can pass it directly like this example,
' or you can pass an IntPtr pointer to the buffer.
' The same thing applies for rgbColor.
RasterColorConverterEngine.ConvertDirect(ConversionColorFormat.Cmyk, ConversionColorFormat.Rgb, cmykColor, 0, rgbColor, 0, 1, 1, 0, 0)
Catch e1 As Exception
End Try
'.
'.
'.
' use rgbColor as you need.
' Shutdown the ColorConversion.
RasterColorConverterEngine.Shutdown()
End Sub
Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.