LEADTOOLS(Leadtoolsアセンブリ)

フレームを表示

RasterColorSpaceクラス








メンバ 
サポートを1つのカラースペースからもう一つにバッファーに入れられた画像データを変換するために提供します。
オブジェクトモデル
構文
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 
サンプル

このサンプルはimageをロードして、各々の行の大きさを変更して、そして、ディスクへ大きさを変更されたimageを保存します。

Copy Code  
Imports Leadtools
Imports Leadtools.Codecs

      
  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
using Leadtools;
using Leadtools.Codecs;

      
public void RasterColorSpaceExample()
{
   string fileName = Path.Combine(ImagesPath.Path, "Image1.cmp");
   using (RasterCodecs codecs = new RasterCodecs())
   {
      // load an image
      using (RasterImage image = codecs.Load(fileName))
      {
         // Allocate the input buffer for 24-bit RGB data 
         byte[] inBuffer = new byte[image.Width * 3];
         Assert.IsTrue(inBuffer.Length == image.BytesPerLine);
         // 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);
      }
   }
}
using Leadtools;
using Leadtools.Codecs;

      
public async Task RasterColorSpaceExample()
{
   RasterCodecs codecs = new RasterCodecs();
   // Load the source image
   string srcFileName = @"Assets\Image1.cmp";
   StorageFile loadFile = await Tools.AppInstallFolder.GetFileAsync(srcFileName);
   ILeadStream loadStream = LeadStreamFactory.Create(loadFile);
   RasterImage image = await codecs.LoadAsync(loadStream, 24, CodecsLoadByteOrder.Bgr, 1, 1);
   Assert.IsTrue(image.BitsPerPixel == 24);

   // Allocate the input buffer for 24-bit RGB data 
   Windows.Storage.Streams.Buffer inBuffer = new Windows.Storage.Streams.Buffer((uint)image.Width * 3);

   // Allocate the output buffer for 32-bit CMYK data
   Windows.Storage.Streams.Buffer outBuffer = new Windows.Storage.Streams.Buffer((uint)image.Width * 4);

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

   // 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();
}
using Leadtools;
using Leadtools.Codecs;
using Leadtools.Examples;

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();
}
Imports Leadtools
Imports Leadtools.Codecs

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
必要条件

ターゲットプラットホーム

参照

参照

RasterColorSpaceメンバ
Leadtools名前空間