B4A Library AnimateGIFEncoder V1.0.0

This is a wrapper for this github project

GIFEncoder
Author:
DonManfred (wrapper)
Version: 1
  • AnimatedGifEncoder
    Methods:
    • Initialize (EventName As String)
    • IsInitialized As Boolean
    • addFrame (im As Bitmap) As Boolean
      Adds next GIF frame. The frame is not written immediately, but is actually
      deferred until the next frame is received so that timing data can be
      inserted. Invoking <code>finish()</code> flushes all frames. If
      <code>setSize</code> was not invoked, the size of the first image is used
      for all subsequent frames.
      im: BufferedImage containing frame to write.
      Return type: @return:true if successful.
    • finish As Boolean
      Flushes any pending data and closes output file. If writing to an
      OutputStream, the stream is not closed.
    • setPosition (x As Int, y As Int)
      Sets the GIF frame position. The position is 0,0 by default. Useful for
      only updating a section of the image
      w: int frame width.
      h: int frame width.
    • setSize (w As Int, h As Int)
      Sets the GIF frame size. The default size is the size of the first frame
      added if this method is not invoked.
      w: int frame width.
      h: int frame width.
    • start (os As OutputStream) As Boolean
      Initiates GIF file creation on the given stream. The stream is not closed
      automatically.
      os: OutputStream on which GIF images are written.
      Return type: @return:false if initial write failed.
    Properties:
    • Delay As Int [write only]
      Sets the delay time between each frame, or changes it for subsequent frames
      (applies to last frame added).
    • Dispose As Int [write only]
      Sets the GIF frame disposal code for the last added frame and any
      subsequent frames. Default is 0 if no transparent color has been set,
      otherwise 2.
    • FrameRate As Float [write only]
      Sets frame rate in frames per second. Equivalent to
      <code>setDelay(1000/fps)</code>.
    • Quality As Int [write only]
      Sets quality of color quantization (conversion of images to the maximum 256
      colors allowed by the GIF specification). Lower values (minimum = 1)
      produce better colors, but slow processing significantly. 10 is the
      default, and produces good color mapping at reasonable speeds. Values
      greater than 20 do not yield significant improvements in speed.
    • Repeat As Int [write only]
      Sets the number of times the set of GIF frames should be played. Default is
      1; 0 means play indefinitely. Must be invoked before the first image is
      added.
    • Transparent As Int [write only]
      Sets the transparent color for the last added frame and any subsequent
      frames. Since all colors are subject to modification in the quantization
      process, the color in the final palette for each frame closest to the given
      color becomes the transparent color for that frame. May be set to null to
      indicate no transparent color.

Sample GIF: test.gif

If you want to donate for my work building the wrapper you can do it here:
 

Attachments

  • AnimatedGifncoderLibfiles.zip
    11.7 KB · Views: 500
  • GifEncoderEx.zip
    11.5 KB · Views: 490
Top