←选择平台

AnimationGlobalSize财产

总结
获取或设置一个值表示的全球规模的动画形象。
语法
c#
objective - c
c++ / CLI
Java
Python
公共LeadSizeAnimationGlobalSize {得到;;}
@ property(原子,分配)LeadSize animationGlobalSize
公共LeadSizegetAnimationGlobalSize ();公共无效setAnimationGlobalSize (LeadSizeleadSize);
公共:财产LeadSizeAnimationGlobalSize {LeadSizeget ();无效集(LeadSize);}
AnimationGlobalSize#获取和设置(RasterImage)

属性值

一个LeadSize结构,表明全球规模的动画形象。默认值是0,0意思相同大小的图像

讲话

使用这个属性的值RasterImageAnimator类正确更新正确的目标图像的一部分。

GIF文件可以包含多个不同大小的帧。的AnimationGlobalSize属性包含的“全球”大小动画GIF图像。单个帧应该呈现在这个全球大小值的偏移AnimationOffset财产。

这个属性的值改变时,改变了事件将火RasterImageChangedFlags设置为RasterImageChangedFlags.AnimationProperties。

有关更多信息,请参考实现动画

例子
c#
使用Leadtools;使用Leadtools.Codecs;使用Leadtools.ImageProcessing;使用Leadtools.Drawing;/ / WIN32 API常量intLOGPIXELSY = 90;[DllImport (“gdi32”)]走读生静态intGetDeviceCaps (IntPtr hdc,intnIndex);[DllImport (“kernel32”)]走读生静态intMulDiv (intnNumber,intnNumerator,intnDenominator);公共无效AnimatedGIFExample (){/ /将包含4帧的GIF文件常量intframeCount = 4;/ /每一帧是128×128像素(GIF文件会有两倍大小)常量intframeWidth = 128;常量intframeHeight = 128;/ /背景颜色RasterColor[]背景色={RasterColor (0 xff 0 x00 0 x00),RasterColor (0 x00 0 xff 0 x00),RasterColor (0 x00 0 x00 0 xff),RasterColor (0 xff 0 xff 0 x00)};/ /前景颜色RasterColor[]字体颜色={RasterColor (0 xff 0 xff 0 x00),RasterColor (0 xff 0 x00 0 x00),RasterColor (0 x00 0 xff 0 x00),RasterColor (0 xff 0 x00 0 x00)};/ /延迟毫秒int[]延迟={1000年,1000年,1000年,1000年};/ /左和顶部,我们希望帧转移到每一个角落LeadPoint[]抵消={LeadPoint (0, 0),LeadPoint (frameWidth, 0),LeadPoint (frameWidth frameHeight),frameHeight LeadPoint (0),};RasterImageAnimationDisposalMethod [] disposalMethod ={RasterImageAnimationDisposalMethod.RestoreBackground,RasterImageAnimationDisposalMethod.RestoreBackground,RasterImageAnimationDisposalMethod.RestoreBackground,RasterImageAnimationDisposalMethod.RestoreBackground};RasterColor写成backgroundColor = RasterColor.FromKnownColor (RasterKnownColor.Yellow);RasterImage图像=;字体字体=;StringFormat StringFormat =;/ /创建框架(int帧= 0;帧< frameCount;框架+ +){RasterImage frameImage =RasterImage (RasterMemoryFlags.Conventional,frameWidth,frameHeight,24日,RasterByteOrder.Bgr,RasterViewPerspective.BottomLeft,,IntPtr.Zero,0){/ /设置帧的属性AnimationDelay =延迟(帧),AnimationOffset =抵消(帧),AnimationDisposalMethod = disposalMethod(帧),/ /背景是白色的AnimationBackground =写成backgroundColor};/ /画框架在其表面的数量IntPtr hdc = RasterImagePainter.CreateLeadDC (frameImage);图g = Graphics.FromHdc (hdc);矩形rc =矩形(0,0,frameWidth frameHeight);刷子刷=SolidBrush (RasterColorConverter.ToColor(背景色(帧)));g。FillRectangle(刷,rc);brush.Dispose ();如果(字体= =){intfontHeight = MulDiv(72年,GetDeviceCaps (hdc LOGPIXELSY), 72);字体=字体(“Consolas”,fontHeight);stringFormat =StringFormat{对齐= StringAlignment.Center,LineAlignment = StringAlignment.Center};}字符串str =字符串.Format (“{0}”,框架+ 1);刷=SolidBrush (RasterColorConverter.ToColor(字体颜色(帧)));g。细绳(str,字体、画笔、rc stringFormat);brush.Dispose ();g.Dispose ();RasterImagePainter.DeleteLeadDC (hdc);如果(图片= =)形象= frameImage;其他的image.AddPage (frameImage);}font.Dispose ();stringFormat.Dispose ();/ /设置全球形象属性的形象。一个nimationGlobalSize =LeadSize (frameWidth * 2, frameHeight * 2);的形象。一个nimationGlobalLoop = 0;的形象。一个nimationGlobalBackground = backgroundColor;/ /图片转换为8位/像素ColorResolutionCommand cmd =ColorResolutionCommand (ColorResolutionCommandMode.AllPages,8日,RasterByteOrder.Rgb,RasterDitheringMethod.None,ColorResolutionCommandPaletteFlags.Optimized,);cmd.Run(图片);RasterCodecs编解码器=RasterCodecs ();/ /设置GIF保存选项RasterColor [] animationPalette = image.GetPalette ();codecs.Options.Gif.Save.SetAnimationPalette (animationPalette);codecs.Options.Gif.Save。UseAnimationPalette =真正的;/ / GIF动画宽度和高度,循环和背景/ /将自动从图像/ /保存文件字符串文件名= Path.Combine (LEAD_VARS.ImagesDir,“AnimatedGifFile.gif”);编解码器。保存(形象,文件名,RasterImageFormat。Gif 8 1,形象。PageCount 1 CodecsSavePageMode.Overwrite);image.Dispose ();codecs.Dispose ();}静态LEAD_VARS{公共常量字符串ImagesDir =@“C: \ LEADTOOLS22 \ Resources \图片”;}
需求

目标平台

Leadtools组装
188金宝搏的网址客服|支持|联系我们|知识产权的通知
©1991 - 2023领先的技术公司。保留所有权利。