public class PresentationAnimationsGenerator
extends java.lang.Object
implements com.aspose.ms.System.IDisposable
Represents a generator of the animations in the Presentation.
Presentation pres = new Presentation("animated.pptx"); try { PresentationAnimationsGenerator animationsGenerator = new PresentationAnimationsGenerator(pres); try { PresentationPlayer player = new PresentationPlayer(animationsGenerator, 33); try { player.setFrameTick(new PresentationPlayer.FrameTick() { public void invoke(PresentationPlayer sender, FrameTickEventArgs args) { FileOutputStream fos = null; try { fos = new FileOutputStream("frame_" + sender.getFrameIndex() + ".png"); args.getFrame().compress(android.graphics.Bitmap.CompressFormat.PNG, 100, fos); } catch (IOException e) { throw new RuntimeException(e); } finally { if (fos != null) { try { fos.close(); } catch (IOException e) { } } } } }); animationsGenerator.run(pres.getSlides()); } finally { if (player != null) player.dispose(); } } finally { if (animationsGenerator != null) animationsGenerator.dispose(); } } finally { if (pres != null) pres.dispose(); }
| Modifier and Type | Class and Description |
|---|---|
static interface |
PresentationAnimationsGenerator.NewAnimation
An event represents that a new animation was generated.
|
| Constructor and Description |
|---|
PresentationAnimationsGenerator(Presentation presentation)
Creates a new instance of the
PresentationAnimationsGenerator. |
PresentationAnimationsGenerator(Size frameSize)
Creates a new instance of the
PresentationAnimationsGenerator. |
PresentationAnimationsGenerator(SizeF frameSize)
Creates a new instance of the
PresentationAnimationsGenerator. |
| Modifier and Type | Method and Description |
|---|---|
void |
dispose()
Disposes the instance of the
PresentationAnimationsGenerator. |
int |
getDefaultDelay()
Gets or sets default delay time [ms].
|
int |
getExportedSlides()
Get the number of the exported slides count.
|
Size |
getFrameSize()
Gets the frame size.
|
boolean |
getIncludeHiddenSlides()
Get or sets if hidden slides should be included.
|
void |
run(com.aspose.ms.System.Collections.Generic.IGenericEnumerable<ISlide> slides)
Run the animation events generation for each slide.
|
void |
run(com.aspose.ms.System.Collections.Generic.IGenericEnumerable<ISlide> slides,
int fps,
PresentationPlayer.FrameTick onFrame)
Run the animation events generation for each slide.
|
void |
setDefaultDelay(int value)
Gets or sets default delay time [ms].
|
void |
setIncludeHiddenSlides(boolean value)
Get or sets if hidden slides should be included.
|
void |
setNewAnimation(PresentationAnimationsGenerator.NewAnimation anim)
Set a new animation event.
|
public PresentationAnimationsGenerator(Presentation presentation)
Creates a new instance of the PresentationAnimationsGenerator.
presentation - The frame size will be set with accordance to the Presentation.getSlideSize()public PresentationAnimationsGenerator(Size frameSize)
Creates a new instance of the PresentationAnimationsGenerator.
frameSize - The frame size.public PresentationAnimationsGenerator(SizeF frameSize)
Creates a new instance of the PresentationAnimationsGenerator.
frameSize - The frame size.public final void dispose()
Disposes the instance of the PresentationAnimationsGenerator.
dispose in interface com.aspose.ms.System.IDisposablepublic Size getFrameSize()
Gets the frame size.
public final int getDefaultDelay()
Gets or sets default delay time [ms].
Presentation presentation = new Presentation("animated.pptx"); try { PresentationAnimationsGenerator animationsGenerator = new PresentationAnimationsGenerator(presentation.getSlideSize().getSize()); try { animationsGenerator.setDefaultDelay(1000); // 1s // ... animationsGenerator.run(presentation.getSlides()); } finally { if (animationsGenerator != null) animationsGenerator.dispose(); } } finally { if (presentation != null) presentation.dispose(); }
public final void setDefaultDelay(int value)
Gets or sets default delay time [ms].
Presentation presentation = new Presentation("animated.pptx"); try { PresentationAnimationsGenerator animationsGenerator = new PresentationAnimationsGenerator(presentation.getSlideSize().getSize()); try { animationsGenerator.setDefaultDelay(1000); // 1s // ... animationsGenerator.run(presentation.getSlides()); } finally { if (animationsGenerator != null) animationsGenerator.dispose(); } } finally { if (presentation != null) presentation.dispose(); }
public final boolean getIncludeHiddenSlides()
Get or sets if hidden slides should be included.
Presentation presentation = new Presentation("animated.pptx"); try { PresentationAnimationsGenerator animationsGenerator = new PresentationAnimationsGenerator(presentation.getSlideSize().getSize()); try { animationsGenerator.setIncludeHiddenSlides(false); // ... animationsGenerator.run(presentation.getSlides()); } finally { if (animationsGenerator != null) animationsGenerator.dispose(); } } finally { if (presentation != null) presentation.dispose(); }
public final void setIncludeHiddenSlides(boolean value)
Get or sets if hidden slides should be included.
Presentation presentation = new Presentation("animated.pptx"); try { PresentationAnimationsGenerator animationsGenerator = new PresentationAnimationsGenerator(presentation.getSlideSize().getSize()); try { animationsGenerator.setIncludeHiddenSlides(false); // ... animationsGenerator.run(presentation.getSlides()); } finally { if (animationsGenerator != null) animationsGenerator.dispose(); } } finally { if (presentation != null) presentation.dispose(); }
public final int getExportedSlides()
Get the number of the exported slides count.
public void setNewAnimation(PresentationAnimationsGenerator.NewAnimation anim)
Set a new animation event.
Presentation presentation = new Presentation("SimpleAnimations.pptx"); try { PresentationAnimationsGenerator animationsGenerator = new PresentationAnimationsGenerator(presentation.getSlideSize().getSize()); try { animationsGenerator.setNewAnimation(new PresentationAnimationsGenerator.NewAnimation() { public void invoke(IPresentationAnimationPlayer animationPlayer) { System.out.println(String.format("Animation total duration: %f", animationPlayer.getDuration())); } }); animationsGenerator.run(presentation.getSlides()); } finally { if (animationsGenerator != null) animationsGenerator.dispose(); } } finally { if (presentation != null) presentation.dispose(); }
anim - Animation event.public final void run(com.aspose.ms.System.Collections.Generic.IGenericEnumerable<ISlide> slides)
Run the animation events generation for each slide.
Presentation presentation = new Presentation("animated.pptx"); try { PresentationAnimationsGenerator animationsGenerator = new PresentationAnimationsGenerator(presentation.getSlideSize().getSize()); try { PresentationPlayer player = new PresentationPlayer(animationsGenerator, 33); try { animationsGenerator.setNewAnimation(new PresentationAnimationsGenerator.NewAnimation() { public void invoke(IPresentationAnimationPlayer animationPlayer) { // handle new animation } }); player.setFrameTick(new PresentationPlayer.FrameTick() { public void invoke(PresentationPlayer sender, FrameTickEventArgs args) { // handle frame tick within the new animation } }); animationsGenerator.run(presentation.getSlides()); } finally { if (player != null) player.dispose(); } } finally { if (animationsGenerator != null) animationsGenerator.dispose(); } } finally { if (presentation != null) presentation.dispose(); }
public final void run(com.aspose.ms.System.Collections.Generic.IGenericEnumerable<ISlide> slides, int fps, PresentationPlayer.FrameTick onFrame)
Run the animation events generation for each slide.
Presentation presentation = new Presentation("animated.pptx"); try { PresentationAnimationsGenerator animationsGenerator = new PresentationAnimationsGenerator(presentation.getSlideSize().getSize()); try { animationsGenerator.run(presentation.getSlides(), 33, new PresentationPlayer.FrameTick() { public void invoke(PresentationPlayer player, FrameTickEventArgs playerArgs) { player.setFrameTick(new PresentationPlayer.FrameTick() { public void invoke(PresentationPlayer sender, FrameTickEventArgs args) { FileOutputStream fos = null; try { fos = new FileOutputStream("frame_" + sender.getFrameIndex() + ".png"); args.getFrame().compress(android.graphics.Bitmap.CompressFormat.PNG, 100, fos); } catch (IOException e) { throw new RuntimeException(e); } finally { if (fos != null) { try { fos.close(); } catch (IOException e) { e.printStackTrace(); } } } } }); } }); } finally { if (animationsGenerator != null) animationsGenerator.dispose(); } } finally { if (presentation != null) presentation.dispose(); }
Copyright © 2004-2025 Aspose Pty Ltd. All Rights Reserved.