Adding todo
This commit is contained in:
parent
7b6fbfdf57
commit
e3719dcfe0
|
@ -221,8 +221,8 @@ class ApngEncoder(
|
|||
fcTL.addAll(Utils.to4Bytes(yOffsets).asList())
|
||||
|
||||
// Set frame delay
|
||||
fcTL.addAll(Utils.to2Bytes(delay.toInt()).asList())
|
||||
fcTL.addAll(Utils.to2Bytes(1000).asList())
|
||||
fcTL.addAll(Utils.to2Bytes(delay.toInt().toShort()).asList())
|
||||
fcTL.addAll(Utils.to2Bytes(1000.toShort()).asList())
|
||||
|
||||
// Add DisposeOp and BlendOp
|
||||
fcTL.add(Utils.getDisposeOp(disposeOp).toByte())
|
||||
|
|
|
@ -351,8 +351,8 @@ class ExperimentalApngEncoder(
|
|||
|
||||
// Set frame delay
|
||||
// TODO BETTER FRACTION
|
||||
.plus(Utils.to2Bytes(delay.toInt()))
|
||||
.plus(Utils.to2Bytes(1000))
|
||||
.plus(Utils.to2Bytes(delay.toInt().toShort()))
|
||||
.plus(Utils.to2Bytes(1000.toShort()))
|
||||
|
||||
// Add DisposeOp and BlendOp
|
||||
.plus(Utils.getDisposeOp(disposeOp))
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
package oupson.apng.utils
|
||||
|
||||
import oupson.apng.utils.Utils.Companion.BlendOp.APNG_BLEND_OP_OVER
|
||||
import oupson.apng.utils.Utils.Companion.BlendOp.APNG_BLEND_OP_SOURCE
|
||||
import oupson.apng.utils.Utils.Companion.DisposeOp.*
|
||||
import kotlin.experimental.and
|
||||
|
||||
|
||||
class Utils {
|
||||
companion object {
|
||||
/**
|
||||
|
@ -136,6 +142,7 @@ class Utils {
|
|||
* @param i The int
|
||||
* @return [Array] 4 Bytes
|
||||
*/
|
||||
// TODO RENAME
|
||||
fun to4Bytes(i: Int): Array<Byte> {
|
||||
return arrayOf((i shr 24).toByte(), (i shr 16).toByte(), (i shr 8).toByte(), i.toByte())
|
||||
}
|
||||
|
@ -145,6 +152,7 @@ class Utils {
|
|||
* @param i The int
|
||||
* @return [ByteArray] 4 Bytes
|
||||
*/
|
||||
// TODO RENAME
|
||||
fun to4BytesArray(i: Int): ByteArray {
|
||||
return byteArrayOf(
|
||||
(i shr 24).toByte(),
|
||||
|
@ -159,15 +167,22 @@ class Utils {
|
|||
* @param i The int
|
||||
* @return [ByteArray] 2 Bytes
|
||||
*/
|
||||
// TODO RENAME
|
||||
fun to2Bytes(i: Int): ByteArray {
|
||||
return byteArrayOf((i shr 8).toByte(), i /*>> 0*/.toByte())
|
||||
}
|
||||
|
||||
// TODO RENAME
|
||||
fun to2Bytes(s: Short): ByteArray {
|
||||
return byteArrayOf((s.toInt() shr 8 and 0x00FF).toByte(), (s and 0xFF).toByte())
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the length of chunks
|
||||
* [byteArray] The beginning of the chunk, containing the length
|
||||
* [Int] The length of the chunk
|
||||
*/
|
||||
// TODO REWRITE THIS ... THING
|
||||
fun parseLength(byteArray: ByteArray): Int {
|
||||
var lengthString = ""
|
||||
byteArray.forEach {
|
||||
|
|
Loading…
Reference in New Issue