Commit Graph

28 Commits

Author SHA1 Message Date
gingerBill
4035fec784 Add more uses of or_return 2021-08-15 18:13:56 +01:00
Jeroen van Rijn
d949d5a046 ZLIB: cleanup. 2021-06-27 16:48:12 +02:00
Jeroen van Rijn
064516bf0b PNG: Inform inflate about expected output size for extra speed. 2021-06-27 13:57:12 +02:00
Jeroen van Rijn
eaf88bcc4d PNG: Let PNG use the new compress I/O routines. 2021-06-27 13:51:52 +02:00
Jeroen van Rijn
342adb627d All reads now skip stream if in memory. 2021-06-23 16:32:48 +02:00
Jeroen van Rijn
8663c64e47 Refactor ZLIB structs. 2021-06-23 16:32:47 +02:00
Jeroen van Rijn
ae0b8fce44 Move bytes utils back to EXR code for the time being.
Also, allow PNG example to be run directly from `core:image/png` directory.
2021-06-22 16:39:00 +02:00
Jeroen van Rijn
d5e2b387fa PNG: Fix leak if you don't ask for metadata. 2021-06-21 22:47:54 +02:00
Jeroen van Rijn
1e8c12c2a3 Comment out tracy imports. 2021-06-21 21:41:56 +02:00
Jeroen van Rijn
352494cbb4 ZLIB: Start optimization. 2021-06-21 21:05:52 +02:00
Jeroen van Rijn
e036a321a0 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);
	...
}
```
2021-06-21 16:32:42 +02:00
Jeroen van Rijn
55d09251d8 Change PNG's img.sidecar to ^Info, make img.depth an int.
For compatibility with the upcoming OpenEXR code, img.depth is now an int.
Like OpenEXR's code, it will now also return metadata as ^Info instead of Info.

The example was updated to retrieve the metadata this way.

It regrettably does not fix: #1018. That seems to be a codegen issue in the test runner or elsewhere.
2021-06-20 18:27:23 +02:00
gingerBill
9f8a63cb43 More minor stylization changes (remove unneeded parentheses) 2021-06-14 11:34:31 +01:00
gingerBill
6f745677b4 Minor formatting changes 2021-06-14 11:30:00 +01:00
gingerBill
86649e6b44 Core library clean up: Make range expressions more consistent and replace uses of .. with ..= 2021-06-14 11:15:25 +01:00
Jeroen van Rijn
afb6ebd21e Fix gray+alpha alpha extract. 2021-05-04 17:48:43 +02:00
Jeroen van Rijn
9a39ce6b75 Change General_Error.OK to nil 2021-05-03 15:38:43 +02:00
Jeroen van Rijn
59b3c472ca Convert core:compress and core:image error checks to new union comparison.
No more need for `is_kind(err, Error_Value)`, just test err == Error_Value.
2021-05-03 15:08:34 +02:00
Jeroen van Rijn
448f834b28 Remove debug print in image helper. 2021-05-03 01:23:03 +02:00
Jeroen van Rijn
3160a6a12c Don't need other path for grayscale output. 2021-05-02 21:11:06 +02:00
Jeroen van Rijn
7d534769d6 Add new PNG post processing options. 2021-05-02 20:38:30 +02:00
Jeroen van Rijn
433d742183 Fix Paeth for bit depth < 8. 2021-05-01 20:39:00 +02:00
Jeroen van Rijn
0659a11a1a PNG: Fix tRNS handling. 2021-05-01 18:24:31 +02:00
Jeroen van Rijn
db1ef078ff Fix a few more cases in which bKGD wasn't properly applied. 2021-05-01 16:05:13 +02:00
Jeroen van Rijn
a02bcd3bfd PNG: Fix test for when premultiplication is needed. 2021-05-01 13:16:47 +02:00
gingerBill
5f617c56e1 Minor stylistic code changes to compress and image packages 2021-04-30 10:58:29 +01:00
Jeroen van Rijn
06f1eaa153 Use regular allocator from png+gzip's load_from_file.
I would've used `os.stream_from_handle`, but:
- Parts of it seem to be implemented for Windows only at the moment.
- PNG's `peek_data` using that stream didn't manage to rewind and thus tried to parse the data after the header as the header.

Two things must happen:
- The `os.stream_from_handle` implementation needs to be fixed.
- PNG and GZIP's parsers need to be able to handle streams that can't rewind or seek (backward).

Those fixes are on my TODO list but are exceed the scope of this patch.
2021-04-30 09:35:43 +02:00
Jeroen van Rijn
58e023e0cf Add compress and image to core. 2021-04-30 00:21:52 +02:00