Class Animation

java.lang.Object
org.opencv.imgcodecs.Animation

public class Animation extends Object
Represents an animation with multiple frames. The Animation struct is designed to store and manage data for animated sequences such as those from animated formats (e.g., GIF, AVIF, APNG, WebP). It provides support for looping, background color settings, frame timing, and frame storage.
  • Constructor Details

    • Animation

      public Animation(int loopCount, Scalar bgColor)
      Constructs an Animation object with optional loop count and background color.
      Parameters:
      loopCount - An integer representing the number of times the animation should loop:
      • 0 (default) indicates infinite looping, meaning the animation will replay continuously.
      • Positive values denote finite repeat counts, allowing the animation to play a limited number of times.
      • If a negative value or a value beyond the maximum of 0xffff (65535) is provided, it is reset to 0 (infinite looping) to maintain valid bounds.
      bgColor - A Scalar object representing the background color in BGR format:
      • Defaults to Scalar(), indicating an empty color (usually transparent if supported).
      • This background color provides a solid fill behind frames that have transparency, ensuring a consistent display appearance.
    • Animation

      public Animation(int loopCount)
      Constructs an Animation object with optional loop count and background color.
      Parameters:
      loopCount - An integer representing the number of times the animation should loop:
      • 0 (default) indicates infinite looping, meaning the animation will replay continuously.
      • Positive values denote finite repeat counts, allowing the animation to play a limited number of times.
      • If a negative value or a value beyond the maximum of 0xffff (65535) is provided, it is reset to 0 (infinite looping) to maintain valid bounds.
      • Defaults to Scalar(), indicating an empty color (usually transparent if supported).
      • This background color provides a solid fill behind frames that have transparency, ensuring a consistent display appearance.
    • Animation

      public Animation()
      Constructs an Animation object with optional loop count and background color.
      • 0 (default) indicates infinite looping, meaning the animation will replay continuously.
      • Positive values denote finite repeat counts, allowing the animation to play a limited number of times.
      • If a negative value or a value beyond the maximum of 0xffff (65535) is provided, it is reset to 0 (infinite looping) to maintain valid bounds.
      • Defaults to Scalar(), indicating an empty color (usually transparent if supported).
      • This background color provides a solid fill behind frames that have transparency, ensuring a consistent display appearance.
  • Method Details

    • getNativeObjAddr

      public long getNativeObjAddr()
    • __fromPtr__

      public static Animation __fromPtr__(long addr)
    • get_loop_count

      public int get_loop_count()
    • set_loop_count

      public void set_loop_count(int loop_count)
    • get_bgcolor

      public Scalar get_bgcolor()
    • set_bgcolor

      public void set_bgcolor(Scalar bgcolor)
    • get_durations

      public MatOfInt get_durations()
    • set_durations

      public void set_durations(MatOfInt durations)
    • get_frames

      public List<Mat> get_frames()
    • set_frames

      public void set_frames(List<Mat> frames)
    • get_still_image

      public Mat get_still_image()
    • set_still_image

      public void set_still_image(Mat still_image)