mirror of
https://github.com/odin-lang/Odin.git
synced 2026-05-29 07:05:10 +00:00
29 lines
472 B
Odin
29 lines
472 B
Odin
package netpbm
|
|
|
|
import "core:bytes"
|
|
import "core:image"
|
|
|
|
destroy :: proc(img: ^image.Image) -> bool {
|
|
if img == nil {
|
|
return false
|
|
}
|
|
|
|
defer free(img)
|
|
bytes.buffer_destroy(&img.pixels)
|
|
|
|
info := img.metadata.(^image.Netpbm_Info) or_return
|
|
|
|
header_destroy(&info.header)
|
|
free(info)
|
|
img.metadata = nil
|
|
|
|
return true
|
|
}
|
|
|
|
header_destroy :: proc(header: ^Header) {
|
|
if header.format == .P7 && header.tupltype != "" {
|
|
delete(header.tupltype)
|
|
header.tupltype = ""
|
|
}
|
|
}
|