From f1987b64e18d475057210f540f3518834f4d28ba Mon Sep 17 00:00:00 2001 From: Oupson Date: Sun, 20 Sep 2020 10:22:41 +0200 Subject: [PATCH] Documentation --- .../apng/encoder/ExperimentalApngEncoder.kt | 34 ++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/apng_library/src/main/java/oupson/apng/encoder/ExperimentalApngEncoder.kt b/apng_library/src/main/java/oupson/apng/encoder/ExperimentalApngEncoder.kt index 2bd6764..35a8e8b 100644 --- a/apng_library/src/main/java/oupson/apng/encoder/ExperimentalApngEncoder.kt +++ b/apng_library/src/main/java/oupson/apng/encoder/ExperimentalApngEncoder.kt @@ -14,11 +14,22 @@ import java.util.zip.DeflaterOutputStream import kotlin.math.max import kotlin.math.min -// TODO DOCUMENTATION // TODO JAVA OVERLOADS // TODO ADD SUPPORT FOR FIRST FRAME NOT IN ANIM // TODO OPTIMISE APNG // TODO OPTIONS SUCH AS NUMBER OF REPETITIONS +/** + * A class to write APNG + * @param outputStream The ouput stream. + * @param width Width of the animation + * @param height Height of the animation + * @param numberOfFrames The number of frame the animation is composed. + * + * Usage : + * - Instantiate the class. + * - Call [writeFrame]. + * - Call [writeEnd] at the end of the animation. + */ class ExperimentalApngEncoder( private val outputStream: OutputStream, private val width: Int, @@ -140,6 +151,15 @@ class ExperimentalApngEncoder( return this } + /** + * Write a frame into the output stream. + * @param inputStream An input stream that will be decoded in order to be written in the animation. Not freed. + * @param delay A delay in ms. + * @param xOffsets The offset of the left bound of the frame in the animation. + * @param yOffsets The offset of the top bound of the frame in the animation. + * @param blendOp See [Utils.BlendOp]. + * @param disposeOp See [Utils.DisposeOp]. + */ @JvmOverloads fun writeFrame( inputStream: InputStream, @@ -155,6 +175,15 @@ class ExperimentalApngEncoder( btm.recycle() } + /** + * Write a frame into the output stream. + * @param btm An bitmap that will be written in the animation. + * @param delay A delay in ms. + * @param xOffsets The offset of the left bound of the frame in the animation. + * @param yOffsets The offset of the top bound of the frame in the animation. + * @param blendOp See [Utils.BlendOp]. + * @param disposeOp See [Utils.DisposeOp]. + */ @JvmOverloads fun writeFrame( btm: Bitmap, @@ -182,6 +211,9 @@ class ExperimentalApngEncoder( currentSeq++ } + /** + * Write the end of the animation. + */ fun writeEnd() { // Add IEND body length : 0 outputStream.write(Utils.to4BytesArray(0))