c#
VB
objective - c
c++
Java
公共类PremultiplyAlphaValuesCommand:RasterCommand
公共类PremultiplyAlphaValuesCommand
继承了RasterCommand
@接口LTPremultiplyAlphaValuesCommand: LTRasterCommand
公共类PremultiplyAlphaValuesCommand扩展RasterCommand
公共ref类PremultiplyAlphaValuesCommand:公共RasterCommand
此命令仅适用于图像32或64位比特每像素。
这个例子将加载一个32位PNG图像,然后将数据转换为自左乘α值。
使用Leadtools;
使用Leadtools.Codecs;
使用Leadtools.ImageProcessing;
公共无效PremultiplyAlphaValuesCommandExample ()
{
RasterCodecs编解码器=新RasterCodecs ();
字符串srcFileName = Path.Combine (LEAD_VARS.ImagesDir,“LittleGFlyingAlpha.png”);
字符串destFileName = Path.Combine (LEAD_VARS.ImagesDir,“PremultiplyAlphaValuesCommand.bmp”);
/ /加载从磁盘源图像
RasterImage图像= codecs.Load (srcFileName);
Debug.Assert(图片。BitsPerPixel = = 32);
/ /图像数据转换为自左乘α值
PremultiplyAlphaValuesCommand cmd =新PremultiplyAlphaValuesCommand ();
cmd。ConvertToPremultipliedValues =真正的;
cmd.Run(图片);
/ /保存图片回磁盘
编解码器。保存(图像、destFileName RasterImageFormat。Bmp、32);
/ /清理
image.Dispose ();
codecs.Dispose ();
}
静态类LEAD_VARS
{
公共常量字符串ImagesDir =@“C: \ LEADTOOLS21 \ Resources \图片”;
}
进口Leadtools
进口Leadtools.Codecs
进口Leadtools.ImageProcessing
公共子PremultiplyAlphaValuesCommandExample ()
昏暗的编解码器作为RasterCodecs =新RasterCodecs ()
昏暗的srcFileName作为字符串= Path.Combine (LEAD_VARS.ImagesDir“LittleGFlyingAlpha.png”)
昏暗的destFileName作为字符串= Path.Combine (LEAD_VARS.ImagesDir“PremultiplyAlphaValuesCommand.bmp”)
“从磁盘加载源图像
昏暗的图像作为RasterImage = codecs.Load (srcFileName)
Debug.Assert(图片。BitsPerPixel = 32)
的图像数据转换为自左乘α值
昏暗的cmd作为PremultiplyAlphaValuesCommand =新PremultiplyAlphaValuesCommand ()
cmd。ConvertToPremultipliedValues =真正的
cmd.Run(图片)
“回磁盘保存图像
编解码器。保存(图像、destFileName RasterImageFormat。Bmp、32)
的清理
image.Dispose ()
codecs.Dispose ()
结束子
公共NotInheritable类LEAD_VARS
公共常量ImagesDir作为字符串=“C: \ LEADTOOLS21 \ Resources \图片”
结束类