Working on ExperimentalApngEncoder
This commit is contained in:
parent
0698836c7a
commit
6321ebe5be
|
@ -46,12 +46,16 @@ class ExperimentalApngEncoder(
|
|||
disposeOp: Utils.Companion.DisposeOp = Utils.Companion.DisposeOp.APNG_DISPOSE_OP_NONE,
|
||||
usePngEncoder: Boolean = false
|
||||
) {
|
||||
val btm = BitmapFactory.decodeStream(inputStream).let {
|
||||
val btm = BitmapFactory.decodeStream(inputStream, null, BitmapFactory.Options().also { conf -> if (Build.VERSION.SDK_INT >=
|
||||
Build.VERSION_CODES.O) {
|
||||
conf.outConfig = config
|
||||
}
|
||||
})?.let {
|
||||
if (it.config != config)
|
||||
it.copy(config, it.isMutable)
|
||||
else
|
||||
it
|
||||
}
|
||||
}!!
|
||||
inputStream.close()
|
||||
|
||||
writeFrame(btm, delay, xOffsets, yOffsets, blendOp, disposeOp, usePngEncoder)
|
||||
|
@ -210,11 +214,11 @@ class ExperimentalApngEncoder(
|
|||
)
|
||||
|
||||
// COMPRESSION
|
||||
ihdrBody.add(0.toByte())
|
||||
ihdrBody.add(0)
|
||||
// FILTER
|
||||
ihdrBody.add(0.toByte())
|
||||
ihdrBody.add(0)
|
||||
// INTERLACE
|
||||
ihdrBody.add(0.toByte())
|
||||
ihdrBody.add(0)
|
||||
|
||||
// Generate CRC
|
||||
val crC32 = CRC32()
|
||||
|
|
|
@ -143,13 +143,15 @@ class CreatorActivity : AppCompatActivity() {
|
|||
)
|
||||
else
|
||||
btm,
|
||||
delay = uri.second.toFloat()
|
||||
delay = uri.second.toFloat(),
|
||||
usePngEncoder = true
|
||||
)
|
||||
//input.close()
|
||||
} else {
|
||||
encoder.writeFrame(
|
||||
str,
|
||||
delay = uri.second.toFloat()
|
||||
delay = uri.second.toFloat(),
|
||||
usePngEncoder = true
|
||||
)
|
||||
}
|
||||
str.close()
|
||||
|
|
Loading…
Reference in New Issue