LEADTOOLS(Leadtoolsアセンブリ)

フレームを表示

RasterCurveクラス








メンバ 
曲線を定義します。
オブジェクトモデル
構文
public class RasterCurve 
'Declaration
 
Public Class RasterCurve 
'Usage
 
Dim instance As RasterCurve
public sealed class RasterCurve 
function Leadtools.RasterCurve()
public ref class RasterCurve 
解説

RasterCurveクラスは、LeadPointオブジェクトの配列を用いて曲線を描画するためにAddCurveToRegionメソッドで使われる曲線を定義します。ToBezierPointsメソッドは、ベジェに曲線を変換するのに用いられます。RasterCurveクラスは、2種類の曲線、RasterCurveType.StandardRasterCurveType.Bezierを定義することができます。

サンプル

このサンプルは、5つのポイントを通り抜ける滑らかなリージョンを作成して、リージョンを反転します。

Copy Code  
Imports Leadtools
Imports Leadtools.Codecs
Imports Leadtools.ImageProcessing.Color

      
  Public Sub RasterCurveExample()
   Dim codecs As RasterCodecs = New RasterCodecs()
   ' load an image
   Dim srcFileName As String = Path.Combine(LEAD_VARS.ImagesDir, "Image1.cmp")
   Dim destFileName As String = Path.Combine(LEAD_VARS.ImagesDir, "Image1_curveinverted.bmp")
   Dim image As RasterImage = codecs.Load(srcFileName)

   ' create a new curve object
   Dim curve As RasterCurve = New RasterCurve()

   ' define the the curve
   curve.Points.Add(New LeadPoint(30, 30))
   curve.Points.Add(New LeadPoint(30, 200))
   curve.Points.Add(New LeadPoint(130, 130))
   curve.Points.Add(New LeadPoint(75, 75))
   curve.Points.Add(New LeadPoint(130, 30))

   curve.Type = RasterCurveType.Standard
   curve.FillMode = LeadFillMode.Winding
   curve.Tension = 0.5
   curve.Close = RasterCurveClose.Close

   image.AddCurveToRegion(Nothing, curve, RasterRegionCombineMode.Set)

   ' do something with the region
   Dim cmd As InvertCommand = New InvertCommand()
   cmd.Run(image)

   ' save the image back to disk
   codecs.Save(image, destFileName, RasterImageFormat.Bmp, 24)

   ' 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;
using Leadtools.ImageProcessing;
using Leadtools.ImageProcessing.Color;

      
public void RasterCurveExample()
{
   string destFileName = Path.Combine(ImagesPath.Path, "Image1_curveinverted.bmp");
   // create a new curve object
   RasterCurve curve = new RasterCurve();

   // define the the curve
   curve.Points.Add(new LeadPoint(30, 30));
   curve.Points.Add(new LeadPoint(30, 200));
   curve.Points.Add(new LeadPoint(130, 130));
   curve.Points.Add(new LeadPoint(75, 75));
   curve.Points.Add(new LeadPoint(130, 30));

   curve.Type = RasterCurveType.Standard;
   curve.FillMode = LeadFillMode.Winding;
   curve.Tension = 0.5;
   curve.Close = RasterCurveClose.Close;

   // create an image

   using (RasterImage image = new RasterImage(
      RasterMemoryFlags.Conventional,
      250,
      250,
      24,
      RasterByteOrder.Bgr,
      RasterViewPerspective.BottomLeft,
      null,
      IntPtr.Zero,
      0))
   {
      Assert.IsNotNull(image);

      // fill the image
      new FillCommand(RasterColor.FromKnownColor(RasterKnownColor.Magenta)).Run(image);
      image.AddCurveToRegion(null, curve, RasterRegionCombineMode.Set);

      // do something with the region
      new InvertCommand().Run(image);

      // save the image
      using (RasterCodecs codecs = new RasterCodecs())
      {
         // save the image back to disk
         codecs.Save(image, destFileName, RasterImageFormat.Bmp, 24);
      }
   }
}
必要条件

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

参照

参照

RasterCurveメンバ
Leadtools名前空間