LEADTOOLS (Leadtools assembly)
LEAD Technologies, Inc

RasterColorSpace Class

Example 





Members 
Provides support for converting buffered image data from one color space to another. .NET support Silverlight support
Object Model
RasterColorSpace Class
Syntax
public static class RasterColorSpace 
'Declaration
 
Public MustInherit NotInheritable Class RasterColorSpace 
'Usage
 
Dim instance As RasterColorSpace
public sealed static class RasterColorSpace 
function Leadtools.RasterColorSpace()
public ref class RasterColorSpace abstract sealed 
Example
 
Public Sub RasterColorSpaceExample()
      Dim codecs As RasterCodecs = New RasterCodecs()

      ' load an image
      Dim fileName As String = Path.Combine(LEAD_VARS.ImagesDir, "Image1.cmp")
      Dim image As RasterImage = codecs.Load(fileName)

      ' Allocate the input buffer for 24-bit RGB data 
      Dim inBuffer As Byte() = New Byte(image.Width * 3 - 1) {}

      ' Allocate the output buffer for 32-bit CMYK data
      Dim outBuffer As Byte() = New Byte(image.Width * 4 - 1) {}

      ' Get one row of data from the bitmap
      image.Access()
      image.GetRow(0, inBuffer, 0, image.BytesPerLine)
      image.Release()

      ' Convert the data from RGB in inBuffer to CMYK in outBuffer
      RasterColorSpace.Convert8(inBuffer, 0, outBuffer, 0, image.Width, RasterColorSpaceFormat8.Rgb, RasterColorSpaceFormat8.Cmyk)

      ' Cleanup
      image.Dispose()
   End Sub

Public NotInheritable Class LEAD_VARS
   Public Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"
End Class
public void RasterColorSpaceExample()
   {
      RasterCodecs codecs = new RasterCodecs();

      // load an image
      string fileName = Path.Combine(LEAD_VARS.ImagesDir, "Image1.cmp");
      RasterImage image = codecs.Load(fileName);

      // Allocate the input buffer for 24-bit RGB data 
      byte[] inBuffer = new byte[image.Width * 3];

      // Allocate the output buffer for 32-bit CMYK data
      byte[] outBuffer = new byte[image.Width * 4];

      // Get one row of data from the bitmap
      image.Access();
      image.GetRow(0, inBuffer, 0, image.BytesPerLine);
      image.Release();

      // Convert the data from RGB in inBuffer to CMYK in outBuffer
      RasterColorSpace.Convert8(inBuffer, 0, outBuffer, 0, image.Width, RasterColorSpaceFormat8.Rgb, RasterColorSpaceFormat8.Cmyk);

      // Cleanup
      image.Dispose();
   }

static class LEAD_VARS
{
   public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images";
}
public void RasterColorSpaceExample(RasterImage image)
{
   // Allocate the input buffer for 24-bit RGB data 
   byte[] inBuffer = new byte[image.Width * 3];
   // Allocate the output buffer for 32-bit CMYK data
   byte[] outBuffer = new byte[image.Width * 4];

   // Get one row of data from the bitmap
   image.Access();
   image.GetRow(0, inBuffer, 0, image.BytesPerLine);
   image.Release();

   // Convert the data from RGB in inBuffer to CMYK in outBuffer
   RasterColorSpace.Convert8(inBuffer, 0, outBuffer, 0, image.Width, RasterColorSpaceFormat8.Rgb, RasterColorSpaceFormat8.Cmyk);

   // Cleanup
   image.Dispose();
}
Public Sub RasterColorSpaceExample(ByVal image As RasterImage)
   ' Allocate the input buffer for 24-bit RGB data 
   Dim inBuffer As Byte() = New Byte(image.Width * 3 - 1){}
   ' Allocate the output buffer for 32-bit CMYK data
   Dim outBuffer As Byte() = New Byte(image.Width * 4 - 1){}

   ' Get one row of data from the bitmap
   image.Access()
   image.GetRow(0, inBuffer, 0, image.BytesPerLine)
   image.Release()

   ' Convert the data from RGB in inBuffer to CMYK in outBuffer
   RasterColorSpace.Convert8(inBuffer, 0, outBuffer, 0, image.Width, RasterColorSpaceFormat8.Rgb, RasterColorSpaceFormat8.Cmyk)

   ' Cleanup
   image.Dispose()
End Sub
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

RasterColorSpace Members
Leadtools Namespace

 

 


Products | Support | Contact Us | Copyright Notices

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