Appends an image to the animated multi-frame image during an animation playback.
public void Append(Leadtools.RasterImage image)
Public Sub Append( _ByVal image As Leadtools.RasterImage _)
public void Append(Leadtools.RasterImage image)
function Leadtools.RasterImageAnimator.Append(image)
public:void Append(Leadtools.RasterImage^ image)
image
A RasterImage that contains 1 or more frames to be added to the animation.
If you pass null (Nothing in VisualBasic) in the animatedImage parameter for the RasterImageAnimator constructor, you can use the Append method to add frames to the multi-frame image during the animation. This is useful if you want to play an animated file as it is being loaded using the LoadImage event. If you need to reference the multi-frame image after the animation, you can call the Destroy method before you dispose this RasterImageAnimator object.
After you call Destroy, this RasterImageAnimator object is invalid and you should only call the Dispose method afterwards.
The ValidateLines method lets you validate the lines that the animation playback engine will render to the target image
This example plays an animated GIF file as it loads the file
using Leadtools;using Leadtools.Codecs;using Leadtools.ImageProcessing;using Leadtools.Drawing;using LeadtoolsExamples.Common;RasterImageAnimator _animator;RasterImage _targetImage;Graphics _graphics;LeadRect _destRect;RasterPaintProperties _paintProperties;[Ignore()]public void RasterImageAppendExample(Panel panel){// Initialize the RasterCodecs objectRasterCodecs codecs = new RasterCodecs();// An animated GIF filestring fileName = Path.Combine(ImagesPath.Path, "Eye.gif");// load the first frame, so we have the palette and a target image for playback_targetImage = codecs.Load(fileName, 0, CodecsLoadByteOrder.BgrOrGray, 1, 1);// Create the animator_animator = new RasterImageAnimator(_targetImage, null);// Setup our class members used in the event handler_graphics = panel.CreateGraphics();_destRect = LeadRect.FromLTRB(panel.ClientRectangle.Left, panel.ClientRectangle.Top, panel.ClientRectangle.Right, panel.ClientRectangle.Bottom);_paintProperties = RasterPaintProperties.Default;_paintProperties.PaintEngine = RasterPaintEngine.GdiPlus;// Hook to the LoadImage event and load the filecodecs.LoadImage += new EventHandler<CodecsLoadImageEventArgs>(codecs_LoadImage);codecs.Load(fileName);codecs.LoadImage -= new EventHandler<CodecsLoadImageEventArgs>(codecs_LoadImage);_graphics.Dispose();_animator.Dispose();_animator = null;_targetImage.Dispose();codecs.Dispose();}void codecs_LoadImage(object sender, CodecsLoadImageEventArgs e){if ((e.Flags & CodecsLoadImageFlags.FirstRow) == CodecsLoadImageFlags.FirstRow)_animator.Append(e.Image);_animator.ValidateLines(e.Row, e.Lines);RasterImageAnimatorState state = _animator.State;while (state != RasterImageAnimatorState.End){state = _animator.Process();LeadRect updateRect;switch (state){case RasterImageAnimatorState.WaitInput:_animator.CancelWait();break;case RasterImageAnimatorState.PostClear:case RasterImageAnimatorState.PostRender:updateRect = _animator.GetUpdateRectangle(true);RasterImagePainter.Paint(_targetImage, _graphics, LeadRect.Empty, updateRect, _destRect, LeadRect.Empty, _paintProperties);break;}break;}}
Imports LeadtoolsImports Leadtools.CodecsImports Leadtools.ImageProcessingImports Leadtools.DrawingPrivate _animator As RasterImageAnimatorPrivate _targetImage As RasterImagePrivate _graphics As GraphicsPrivate _destRect As LeadRectPrivate _paintProperties As RasterPaintPropertiesSub RasterImageAppendExample(ByVal panel As Panel)' Initialize the RasterCodecs objectDim codecs As New RasterCodecs()' An animated GIF fileDim fileName As String = Path.Combine(LEAD_VARS.ImagesDir, "Eye.gif")' load the first frame, so we have the palette and a target image for playback_targetImage = codecs.Load(fileName, 0, CodecsLoadByteOrder.BgrOrGray, 1, 1)' Create the animator_animator = New RasterImageAnimator(_targetImage, Nothing)' Setup our class members used in the event handler_graphics = panel.CreateGraphics()_destRect = LeadRect.FromLTRB(panel.ClientRectangle.Left, panel.ClientRectangle.Top, panel.ClientRectangle.Right, panel.ClientRectangle.Bottom)_paintProperties = RasterPaintProperties.Default_paintProperties.PaintEngine = RasterPaintEngine.GdiPlus' Hook to the LoadImage event and load the fileAddHandler codecs.LoadImage, AddressOf codecs_LoadImagecodecs.Load(fileName)RemoveHandler codecs.LoadImage, AddressOf codecs_LoadImage_graphics.Dispose()_animator.Dispose()_animator = Nothing_targetImage.Dispose()codecs.Dispose()End SubSub codecs_LoadImage(ByVal sender As Object, ByVal e As CodecsLoadImageEventArgs)If ((e.Flags And CodecsLoadImageFlags.FirstRow) = CodecsLoadImageFlags.FirstRow) Then_animator.Append(e.Image)End If_animator.ValidateLines(e.Row, e.Lines)Dim state As RasterImageAnimatorState = _animator.StateDo While (state <> RasterImageAnimatorState.End)state = _animator.Process()Dim updateRect As LeadRectSelect Case (state)Case RasterImageAnimatorState.WaitInput_animator.CancelWait()Case RasterImageAnimatorState.PostClear,RasterImageAnimatorState.PostRenderupdateRect = _animator.GetUpdateRectangle(True)RasterImagePainter.Paint(_targetImage, _graphics, LeadRect.Empty, updateRect, _destRect, LeadRect.Empty, _paintProperties)End SelectExit DoLoopEnd SubPublic NotInheritable Class LEAD_VARSPublic Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"End Class
|
Products |
Support |
Feedback: Append Method (RasterImageAnimator) - Leadtools |
Introduction |
Help Version 19.0.2017.6.19
|

Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.