api: ImageSpec::scanline_bytes, tile_bytes, image_bytes #4631
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Existing versions could return the expected bytes for a scanline, tile, or image for either the native per-channel types, or the single composite channel type.
The new flavor lets you pass in any data type and it tells you how many bytes you'd need for a scanline, tile, or image if all channels were the passed type. (As a special case, the answer for TypeUnknown is the "native" size, same as
thing_bytes(true)
).This is handy for computing how big your buffer needs to be to hold a type-converted scanline or tile.