←选择平台

CombineFastCommand类

总结
组合来自两个图像(源图像和目标图像)的图像数据,允许您指定要组合的区域以及在组合数据时要执行的操作。
语法
c#
VB
objective - c
c++
Java
公共CombineFastCommand:RasterCommand
公共CombineFastCommand继承了RasterCommand
@接口LTCombineFastCommand: LTRasterCommand
公共CombineFastCommand扩展RasterCommand
公共ref类CombineFastCommand:公共RasterCommand
讲话

作为一个例子,假设您使用SpatialFilterCommand类应用边缘检测过滤器。然后,您可以使用这个类将生成的图像与原始图像结合起来,以生成具有硬边的图像。

类中的图像进行组合DestinationImage属性使用传递给运行方法。的DestinationImage将保存合并操作的结果。

CombineFastCommand标志分为四组:源(SRC)标志、目标(DST)标志、操作(OP)标志和结果图像(RES)标志。标志只应用于已定义的矩形(不一定是整个图像)。这些标志的应用顺序如下:

  1. 应用源矩形和目标矩形上的操作。这些是同时实现的。
  2. 执行合并操作。
  3. 应用对结果矩形的操作。

您可以使用位OR (μ)来指定每个组中的一个标志。

集团 旗帜
定义源矩形处理的标志 无,SourceNot, Source0, Source1
定义目标矩形处理的标志 DestinationNot, Destination0, Destination1
定义组合数据时要使用的操作的标志 OperationOr, OperationXor, OperationAdd, OperationSubtractSource, OperationSubtractDestination, OperationMultiply, operationdivesource, OperationDivideDestination, OperationAverage, OperationMinimum, OperationMaximum
定义结果图像矩形的处理方法的标志 ResultNot, Result0, Result1, SourceCopy

某些标志在组合时没有任何意义:

  • 将标志(RES标志)设置为CB_RES_0或CB_RES_1将使其余的标志无效。
  • 将SRC和DST标志分别设置为CB_SRC_0和CB_DST_0,那么OP标志(操作标志)将毫无用处。
  • 将SRC和DST标志分别设置为CB_SRC_1和CB_DST_1,那么OP标志(操作标志)将毫无用处。
  • 将标志(OP Flags)设置为CB_OP_ADD或CB_OP_OR或CB_OP_MAX,而将(SRC标志)设置为CB_SRC_1将使(DST标志)无用。
  • 将标志(OP Flags)设置为CB_OP_ADD或CB_OP_OR或CB_OP_MAX,而将(DST标志)设置为CB_SRC_1将使(SRC标志)无用。
  • 将标志(OP Flags)设置为CB_OP_AND或CB_OP_SUBDST或CB_OP_MIN,而将(SRC标志)设置为CB_SRC_0将使(DST标志)无用。
  • 将标志(OP Flags)设置为CB_OP_AND或CB_OP_SUBSRC或CB_OP_MIN,而将(DST标志)设置为CB_SRC_0将使(SRC标志)无用。

如需更多选项,如指定颜色平面,请使用CombineCommand

有关更多信息,请参阅处理图像

例子

下面的示例加载两个图像,并使用“and”操作将它们组合在一起。

c#
VB
使用Leadtools;使用Leadtools.Codecs;使用Leadtools.ImageProcessing;公共无效CombineFastCommandExample ()RasterCodecs codecs =RasterCodecs ();字符串srcFileName1 = Path.Combine(LEAD_VARS.ImagesDir,“Image1.cmp”);字符串srcFileName2 = Path.Combine(LEAD_VARS.ImagesDir,“Image2.cmp”);字符串destFileName = Path.Combine(LEAD_VARS.ImagesDir,“CombineFastCommand.bmp”);//从磁盘加载源映像RasterImage srcImage = codecs.Load(srcFileName1);RasterImage destImage = codecs.Load(srcFileName2);//合并CombineFastCommand命令=CombineFastCommand ();//指定目标图像中的位置命令。DestinationRectangle =LeadRect (destImage。宽度/ 8,destImage。高度/ 8,destImage。宽度,destImage.Height);命令。SourcePoint = LeadPoint.Empty;命令。DestinationImage = destImage;命令。旗帜=CombineFastCommandFlags。OperationAdd|CombineFastCommandFlags。Destination0;command.Run (srcImage);//保存到磁盘编解码器。保存(destImage, destFileName, RasterImageFormat.Bmp, 24);//清理destImage.Dispose ();srcImage.Dispose ();codecs.Dispose ();静态LEAD_VARS公共常量字符串ImagesDir =@“C: \ LEADTOOLS21 \ Resources \图片”
进口Leadtools进口Leadtools。编解码器进口Leadtools。ImageProcessing公共CombineFastCommandExample ()昏暗的编解码器作为RasterCodecs =RasterCodecs ()昏暗的srcFileName1作为字符串= Path.Combine (LEAD_VARS.ImagesDir“Image1.cmp”昏暗的srcFileName2作为字符串= Path.Combine (LEAD_VARS.ImagesDir“Image2.cmp”昏暗的destFileName作为字符串= Path.Combine (LEAD_VARS.ImagesDir“CombineFastCommand.bmp”'从磁盘加载源图像昏暗的srcImage作为RasterImage = codecs.Load(srcFileName1)昏暗的destImage作为RasterImage = codecs.Load(srcFileName2)’把它们结合起来昏暗的命令作为CombineFastCommand =CombineFastCommand ()'指定目标图像中的位置命令。DestinationRectangle =LeadRect (destImage。宽度\ 8,destImage。高度\ 8,destImage。宽度,destImage。Height)命令。SourcePoint = LeadPoint。空命令。DestinationImage = destImage命令。旗帜=CombineFastCommandFlags。OperationAddCombineFastCommandFlags。Destination0command.Run (srcImage)将其保存到磁盘编解码器。保存(destImage, destFileName, RasterImageFormat.Bmp, 24)“清理干净”destImage.Dispose ()srcImage.Dispose ()结束公共NotInheritableLEAD_VARS公共常量ImagesDir作为字符串“C: \ LEADTOOLS21 \ Resources \图片”结束
需求

目标平台

Leadtools组装
188金宝搏的网址客服|支持|联系我们|知识产权公告
©1991 - 2021领德科技有限公司版权所有。