AcademySoftwareFoundation / AcademySoftwareFoundation/OpenImageIO

[API CHANGE SUGGESION] Make `TextureOpt::missingcolor` a `cspan`

Open
#4,483 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
2.4k
Forks
698
Avg merge
3d 4h
Merged PRs (30d)
47

Description

I heard most pointers + length would be replaced with `span`s of some sort going forward.

In that spirit I would like to suggest a (breaking) change to `TextureOpt`. The title kinda sums it up already. :grin:

The change would be that *the length of the `missingcolor` does not have to match `nchannels`* any more.
It would simply be using the last channel value as fill if the `cspan` is shorter than `nchannels` or ignore channels at the end, if it is longer.

On that note: the OIIO API has quite afew naming inconistencies with its use of underscores. For example, the `set` prefix in some some methods is sometimes postfixed with an underscore and sometimes not.

In `TextureOpt` itself the obvious example is `conservative_filter` (uses an underscore) vs `missingcolor`, `firstchannel`, `subimage`, `subimagename`, etc. (don't).
It should be `conservative_filter`, `missing_color`, `first_channel`, `sub_image`, `sub_image_name`, etc.
Or *neither* should have an underscore.

While this is more changes than just removing the underscore from `conservative_filter`: as a non-native speaker I very much prefer the underscore version.
One of the reasons people struggle with German is that we string arbitray number of nouns together to create new ones. :grin:
When you read these it is very difficult for non-native speakers to understand where one noun ends and the next one starts. So if you think this is a silly request, ask someone in your circle of friends who know German as a second language how they feel about that. They can probably reason about it better than I. :wink:

TLDR; if the `missingcolor` as `cspan` change happens that may be an opportunity to clean up naming in this struct too.

In the Rust version I btw. also postfixed any `s` & `t` settings, i.e. `s_blur` etc.

Contributor guide

Open the contributing guide

Research direction

Start at the TextureOpt declaration and its missingcolor, conservative_filter, firstchannel, subimage, and subimagename API entry points. Review existing callers and tests before defining the breaking cspan behavior and naming scope; done requires an agreed API design and corresponding coverage.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.