Generalized core:image loader
```odin
import "core:image"
import "core:image/png"
...
img, err := image.load_from_file("path.png")
```
This commit is contained in:
1 parent
2ef6544ca2
commit
01e8e682c0
5 files changed
+63
No files matched your search
@@ -748,4 +748,16 @@ autoselect_pbm_format_from_image :: proc(img: ^Image, prefer_binary := true, for
|
||||
|
||||
// We couldn't find a suitable format
|
||||
return {}, false
|
||||
}
|
||||
|
||||
@(init, private)
|
||||
_register :: proc() {
|
||||
loader :: proc(data: []byte, options: Options, allocator: mem.Allocator) -> (img: ^Image, err: Error) {
|
||||
return load_from_buffer(data, allocator)
|
||||
}
|
||||
register_loader(.PBM, loader)
|
||||
register_loader(.PGM, loader)
|
||||
register_loader(.PPM, loader)
|
||||
register_loader(.PAM, loader)
|
||||
register_loader(.PFM, loader)
|
||||
}
|
||||
Reference in new issue
Block a user