mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 23:28:48 +00:00
Replace core:image's sidecar with explicit metadata_ptr and metadata_type.
To unpack, use:
```odin
v: ^png.Info;
if img.metadata_ptr != nil && img.metadata_type == png.Info {
v = (^png.Info)(img.metadata_ptr);
...
}
```
This commit is contained in:
@@ -14,7 +14,7 @@ import "core:os"
|
||||
main :: proc() {
|
||||
file: string;
|
||||
|
||||
options := image.Options{};
|
||||
options := image.Options{.return_metadata};
|
||||
err: compress.Error;
|
||||
img: ^image.Image;
|
||||
|
||||
@@ -27,11 +27,11 @@ main :: proc() {
|
||||
fmt.printf("Trying to read PNG file %v returned %v\n", file, err);
|
||||
} else {
|
||||
v: ^png.Info;
|
||||
ok: bool;
|
||||
|
||||
fmt.printf("Image: %vx%vx%v, %v-bit.\n", img.width, img.height, img.channels, img.depth);
|
||||
|
||||
if v, ok = img.sidecar.(^png.Info); ok {
|
||||
if img.metadata_ptr != nil && img.metadata_type == png.Info {
|
||||
v = (^png.Info)(img.metadata_ptr);
|
||||
// Handle ancillary chunks as you wish.
|
||||
// We provide helper functions for a few types.
|
||||
for c in v.chunks {
|
||||
|
||||
Reference in New Issue
Block a user