Commit Graph
25 Commits
Author SHA1 Message Date
Farkal ba1daa18b2 Allow custom encoding process (#84)
Simplify encoding of tags
2020-07-27 11:29:09 +02:00
Andrew Champion ec0477125f Tags: restore primitive conversions as inherent methods 2020-02-01 18:25:05 +00:00
Andrew Champion 1c8e98bca5 Squash to cast checking 2020-01-02 12:47:39 +00:00
Andrew Champion eadec8f0b9 Remove most unchecked size/index casts
Convert most unchecked size/index `as` casts to checked casts with
`TryFrom`, included another top-level error variant.

This has several motivations:
- Making the library as robust as possible, including to platform
differences.
- Unchecked casts are susceptible to breakage during refactorings.
- Preparing for BigTIFF support, which will require the introduction of
generics and associated types for some parts of the de/encoders.
Unchecked primitive casts cannot be bound, while TryFrom can, and
overflowing conversions become more likely.
- Remaining u16 casts may be prone in failure in existing practice and
not just in theory during future changes.
2019-12-21 15:57:24 +00:00
Andrew Champion 298dc8841d Remove unchecked casts and magic values for some tags 2019-12-21 15:57:24 +00:00
Andrew Champion f92be13f6c Factor tags into own module
Tag representations are not decoder- or encoder-specific, so should live
in their own module accessible to both for reuse. The decoder::ifd
module remains since this module is mainly dedicated to decoding the
IFD.
2019-12-21 15:57:24 +00:00
Andrew Champion f9cace84da Deduplicate primitive conversions for tag enum 2019-12-21 15:57:24 +00:00
Andrew Champion 959254aee9 Deduplicate encoding tests
Also removes dev dependency on tempfile.
2019-12-21 15:12:25 +00:00
Andrew Champion 8c4cea5d97 Support 64-bit encoding
Note that this adds the LONG8 data type from BigTIFF because of bounds
requiring TiffValue. However, this datatype should not actually be
written to tags.
2019-12-10 20:18:53 +00:00
HeroicKatora 8e1c67ee53 Merge pull request #63 from image-rs/tagged
Replace FromPrimitive with our own tag macro
2019-11-12 20:14:25 +01:00
Andreas Molzer 517638a38f Prefer explicit conversion over as
The discriminant of some enum types can be retrieved with the `as`
operator and in C style enums it is also possible to set a specific
discriminant. However, that may silently change—breaking the value
written to the file. It is better to use that technique mostly for ffi
purposes.
2019-11-10 23:20:19 +01:00
Onno Kammeraad cbae42ea94 fixed support for multipage images, the IDF offset is added during the new and also at the end of the internal_finish. This should only be done once 2019-11-06 14:04:18 +01:00
Dustin Thomson 30eb8487a6 Signed value support
Add support for SBYTE, SSHORT, SLONG, SRATIONAL as per the Tiff 6.0 spec
Add support for multiple BYTE
2019-08-14 21:22:56 -06:00
Birk Tjelmeland 514b7cddaa Change minimal rustc version to 1.24.1 2019-05-03 23:12:29 +02:00
Andrew Champion 496a2f31cf Convert panic to error for writing wrong size strip 2019-04-25 20:03:30 +02:00
Andrew Champion 334759b08d Remove several panics in write_image
Closes #35.
2019-04-25 20:03:29 +02:00
Atul Bhosale 522fbd1a69 Format code using 'cargo fmt' 2019-04-18 00:04:43 +05:30
Birk Tjelmeland 098b799a62 Fix string encoding and clean up 2019-02-26 11:09:54 +01:00
Birk Tjelmeland addfaa5692 Fix some small problems 2019-02-20 23:08:40 +01:00
Birk Tjelmeland b0d7ac9cbf Add documentation and reorganize 2019-02-09 21:53:11 +01:00
Birk Tjelmeland fa540dbad6 Add more colortypes 2019-02-09 20:53:11 +01:00
Birk Tjelmeland 503c4d29ed Add function to write entire image 2019-02-09 20:40:25 +01:00
Birk Tjelmeland fb233771b5 Fix small errors and clean up 2019-02-09 20:36:40 +01:00
Birk Tjelmeland f38c3f9c4a Clean up api 2019-02-09 02:11:01 +01:00
Birk Tjelmeland fb30648c12 Implemented basic tiff encoding 2019-01-31 21:20:49 +01:00