公共boolAllPages {得到;集;}
公共财产AllPages作为布尔
BOOL allPages @ property(原子、分配)
公共最后布尔getAllPages ()
公共最后无效setAllPages (布尔值)
真正的克隆的所有页面如果源图像多页;假,否则。
如果源图像(图像传递到RasterCommand.Run方法)包含多个页面,那么您可以使用AllPages属性来控制的CloneCommand将创建一个复制当前活跃的页面或图像中所有的页面。
注意,当源图像有多个页面和的值AllPages被设置为真正的,那么RasterCommand.Progress事件将为每个页面处理火灾从0到100。如果需要整体进度百分比,那么你可以检查RasterImage.Page和RasterImage.PageCount的属性SourceImage属性来计算这个值,如以下示例所示。
此属性的默认值假克隆只是当前页面。
这个例子将克隆一个多页图像,显示了整体进步的价值。
使用Leadtools;
使用Leadtools.Codecs;
使用Leadtools.ImageProcessing;
私人无效CloneAllTest ()
{
RasterCodecs编解码器=新RasterCodecs ();
/ /创建一个多页图像用于测试目的
RasterImage图像=零;
为(inti = 1;我< = 4;我+ +)
{
RasterImage pageImage = codecs.Load (Path.Combine (LEAD_VARS.ImagesDir“OCR”+ + i.ToString ()“.tif”));
如果(图片= =零)
形象= pageImage;
其他的
{
image.AddPage (pageImage);
pageImage.Dispose ();
}
}
Console.WriteLine (“输入图像有{0}页面”,image.PageCount);
/ /克隆所有页面
CloneCommand cloneCmd =新CloneCommand ();
cloneCmd。AllPages=真正的;
cloneCmd。进步+ =新EventHandler < RasterCommandProgressEventArgs > (cloneCmd_Progress);
cloneCmd.Run(图片);
cloneCmd。进步- =新EventHandler < RasterCommandProgressEventArgs > (cloneCmd_Progress);
RasterImage destinationImage = cloneCmd.DestinationImage;
Console.WriteLine (“克隆的形象有{0}页”,destinationImage.PageCount);
destinationImage.Dispose ();
image.Dispose ();
codecs.Dispose ();
}
私人无效cloneCmd_Progress (对象发送方,RasterCommandProgressEventArgs e)
{
/ /使用的SourceImage属性CloneCommand我们可以发现
/ /当前页的进展以及整体
CloneCommand cmd =发送方作为CloneCommand;
intoverallPercent;
如果(cmd。AllPages & & cmd.SourceImage。PageCount > 1)
{
/ /多个页面,命令将火灾事件进展为每个页面从0到100
/ /使用源图像页面属性,找出我们在整体完成
overallPercent = ((cmd.SourceImage。页- 1)* 100 + e.Percent) / cmd.SourceImage.PageCount;
}
其他的
{
/ /否则,当前页面是一样的百分比
overallPercent = e.Percent;
}
Console.WriteLine (“当前页面完成:{0},{1}-{2}%整体形象完成{3}%”,cmd.SourceImage。页面,cmd.SourceImage。PageCount e。百分比,overallPercent);
}
静态类LEAD_VARS
{
公共常量字符串ImagesDir =@“C: \ LEADTOOLS21 \ Resources \图片”;
}
进口Leadtools
进口Leadtools.Codecs
进口Leadtools.ImageProcessing
私人子CloneAllTest ()
昏暗的编解码器作为新RasterCodecs ()
对测试的创建一个多页图像
昏暗的图像作为RasterImage =没有什么
为我作为整数= 1来4
昏暗的pageImage作为RasterImage = codecs.Load (Path.Combine (LEAD_VARS.ImagesDir“\ OCR”+ + i.ToString ()“.tif”))
如果没有(图片)然后
形象= pageImage
其他的
image.AddPage (pageImage)
pageImage.Dispose ()
结束如果
下一个
Console.WriteLine (“输入图像有{0}页面”image.PageCount)
“克隆所有页面
昏暗的cloneCmd作为新CloneCommand ()
cloneCmd。AllPages=真正的
AddHandlercloneCmd.Progress,AddressOfcloneCmd_Progress
cloneCmd.Run(图片)
RemoveHandlercloneCmd.Progress,AddressOfcloneCmd_Progress
昏暗的destinationImage作为RasterImage = cloneCmd.DestinationImage
Console.WriteLine (“克隆的形象有{0}页”destinationImage.PageCount)
destinationImage.Dispose ()
image.Dispose ()
codecs.Dispose ()
结束子
私人子cloneCmd_Progress (按值传递发送方作为对象,按值传递e作为RasterCommandProgressEventArgs)
的使用SourceImage财产CloneCommand我们可以发现
当前页面的进展以及整体
昏暗的cmd作为CloneCommand =DirectCast(发送者,CloneCommand)
昏暗的overallPercent作为整数
如果cmd.AllPages需要说明cmd.SourceImage。PageCount > 1然后
对于多个页面,命令将火灾事件进展为每个页面从0到100
使用源图像页面属性来找出我们在整体完成
overallPercent = ((cmd.SourceImage。- 1)* 100 + e.Percent页)\ cmd.SourceImage.PageCount
其他的
“否则,当前页面是一样的百分比
overallPercent = e.Percent
结束如果
Console.WriteLine (“当前页面完成:{0},{1}-{2}%整体形象完成{3}%”,
cmd.SourceImage。页面,cmd.SourceImage。PageCount e。百分比,overallPercent)
结束子
公共NotInheritable类LEAD_VARS
公共常量ImagesDir作为字符串=“C: \ LEADTOOLS21 \ Resources \图片”
结束类
帮助收藏
光栅net|C API|c++类库|HTML5 JavaScript
文档net|C API|c++类库|HTML5 JavaScript
医疗net|C API|c++类库|HTML5 JavaScript
医疗Web查看器net
188宝金博怎么下载
支持的平台上
net, Java, Android和iOS / macOS组件
C / c++类库的API
HTML5 JavaScript库
你的邮件已经发送到支持!有人应该联系!如果你的问题是紧急请回到聊天。
聊天时间:
周一——周五,上午6点等