Documentation
This commit is contained in:
parent
d8d58259e1
commit
f1987b64e1
|
@ -14,11 +14,22 @@ import java.util.zip.DeflaterOutputStream
|
||||||
import kotlin.math.max
|
import kotlin.math.max
|
||||||
import kotlin.math.min
|
import kotlin.math.min
|
||||||
|
|
||||||
// TODO DOCUMENTATION
|
|
||||||
// TODO JAVA OVERLOADS
|
// TODO JAVA OVERLOADS
|
||||||
// TODO ADD SUPPORT FOR FIRST FRAME NOT IN ANIM
|
// TODO ADD SUPPORT FOR FIRST FRAME NOT IN ANIM
|
||||||
// TODO OPTIMISE APNG
|
// TODO OPTIMISE APNG
|
||||||
// TODO OPTIONS SUCH AS NUMBER OF REPETITIONS
|
// 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(
|
class ExperimentalApngEncoder(
|
||||||
private val outputStream: OutputStream,
|
private val outputStream: OutputStream,
|
||||||
private val width: Int,
|
private val width: Int,
|
||||||
|
@ -140,6 +151,15 @@ class ExperimentalApngEncoder(
|
||||||
return this
|
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
|
@JvmOverloads
|
||||||
fun writeFrame(
|
fun writeFrame(
|
||||||
inputStream: InputStream,
|
inputStream: InputStream,
|
||||||
|
@ -155,6 +175,15 @@ class ExperimentalApngEncoder(
|
||||||
btm.recycle()
|
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
|
@JvmOverloads
|
||||||
fun writeFrame(
|
fun writeFrame(
|
||||||
btm: Bitmap,
|
btm: Bitmap,
|
||||||
|
@ -182,6 +211,9 @@ class ExperimentalApngEncoder(
|
||||||
currentSeq++
|
currentSeq++
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Write the end of the animation.
|
||||||
|
*/
|
||||||
fun writeEnd() {
|
fun writeEnd() {
|
||||||
// Add IEND body length : 0
|
// Add IEND body length : 0
|
||||||
outputStream.write(Utils.to4BytesArray(0))
|
outputStream.write(Utils.to4BytesArray(0))
|
||||||
|
|
Loading…
Reference in New Issue