boostorg / boostorg/gil

Unify channel index type in nth_channel_view and image_view::num_channels

Open
#373 6 comments 0 reactions 0 assignees View on GitHub
cat/annoyance core
Dominant language
C++
Stars
199
Forks
171
Avg merge
1d 14h
Merged PRs (30d)
10

Description

### Actual behavior

- `image_view::num_channels()` returns `size_t`
- `nth_channel_view(View, int n)` expects `int` for index

Apart from signed and unsigned mix-up causing the annoying compilation warnings,
if no rationale of the mix is provided, it's a sloppy design of the interface.

### Expected behavior

Use of common type for indexing of `image_view` channels.

### C++ Minimal Working Example

```cpp
#include
namespace gil = boost::gil;
int main
{
gil::rgb8_image_t img;
auto v = gil::view(img);
for (std::size_t i = 0; i < v.num_channels(); i++)
auto _ = nth_channel_view(v, i);
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.