func parseChunks() {
var offset = 8
var stop = false
var firstHalfEnd = false
while !stop {
let chunkDataLength = UInt32.from(of: data, from: offset, to: offset + 4).bigToHost()
let chunkLength = 4 + 4 + chunkDataLength + 4
let chunkType = String.from(source: data, from: offset + 4, to: offset + 8)
let chunk = BerryAPNGChunk(start: offset, end: offset + numericCast(chunkLength), length: chunkLength, type: chunkType)
if chunk.type == "" {
break
}
self.chunks.append(chunk)
if chunk.type == "IEND" {
stop = true
}
offset += numericCast(chunkLength)
if !firstHalfEnd && chunk.type == "fcTL" {
firstHalfEnd = true
}
if chunk.type != "fcTL" && chunk.type != "fdAT" && chunk.type != "IDAT", chunk.type != "acTL" {
if !firstHalfEnd { common.appendFirstHalf(chunk) }
else { common.appendSecondHalf(chunk) }
}
if chunk.type == "acTL" {
self.actl = BerryAPNGACTL(with: data.subdata(in: (chunk.start + 8)..
<chunk end="" nbsp="" -="" 4="" if="" chunk="" type="" self="" ihdr="">
<chunk end="" nbsp="" -="" 4="" for="" var="" i="" in="" 0="">
<chunks count="" nbsp="" if="" chunks="" i="" type="" frames="" append="" berryapngframe="" idat:="" 1="" fctldata:="" self="" data="" subdata="" in:="" start="" 8="">
<chunks i="" end="" nbsp=""></chunks>
</chunks>
</chunk>
</chunk>
本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/shumachanpin/article-89756-2.html
伊拉克能打赢
跟谁打也不要跟英美打
最低应该鸣炮警告