Skip to content

Color fixes for from_abgr_in and to_abgr_integer - #2070

Open
camkerr wants to merge 3 commits into
AcademySoftwareFoundation:mainfrom
camkerr:color-abgr-fixes
Open

camkerr wants to merge 3 commits into
AcademySoftwareFoundation:mainfrom
camkerr:color-abgr-fixes

Conversation

@camkerr

@camkerr camkerr commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #2069

Summarize your change.

I renamed two Color functions to match the more common ABGR pattern:

  • from_agbr_int > from_abgr_int
  • to_agbr_integer > to_abgr_int

Not sure if this was a typo with the original implementation, or if this was intentional. Happy to discuss.

I also corrected the newly renamed from_abgr_int so that the order of the channels is correct. It was swapping the blue and green channels.

Reference associated tests.

I updated a few tests in test_color.py:

  1. I added otio.core.Color.ORANGE to test_convert_to. Orange is the only colour in our predefined list where the red, green and blue channel values are unique, so good to have in there.
  2. I updated test_from_abgr_int to use the "abgr" naming but also correctly convert 4281740498 to #d22c36ff.
  3. I added test_to_abgr_int which was only tested previously using Black & White up in test_convert_to
  4. I added test_abgr_round_trip which tests an int > hex > int round trip. Previously this would've failed due to the blue and green channel swapping.

LLM Use: Claude identified this problem. Code written by me.

Signed-off-by: Cameron Kerr <camkerr@gmail.com>
Signed-off-by: Cameron Kerr <camkerr@gmail.com>
@codecov-commenter

codecov-commenter commented Oct 3, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.58%. Comparing base (fc5c58e) to head (aaf56aa).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2070      +/-   ##
==========================================
+ Coverage   83.56%   83.58%   +0.01%     
==========================================
  Files         182      182              
  Lines       13554    13570      +16     
  Branches     1260     1260              
==========================================
+ Hits        11326    11342      +16     
  Misses       2055     2055              
  Partials      173      173              
Flag Coverage Δ
py-unittests 83.58% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/opentimelineio/color.cpp 96.73% <100.00%> (ø)
src/opentimelineio/color.h 66.66% <100.00%> (ø)
...entimelineio-bindings/otio_serializableObjects.cpp 84.46% <100.00%> (ø)
tests/test_color.py 94.73% <100.00%> (+1.40%) ⬆️

Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fc5c58e...aaf56aa. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

…int"

Signed-off-by: Cameron Kerr <camkerr@gmail.com>
@camkerr

camkerr commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

I also went ahead and renamed the to_abgr_integer to to_abgr_int.

If we're renaming functions, might as well tidy this up. Doesn't make sense to have one be "int" and the other "integer".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Color's from_agbr_int and to_agbr_integer don't use the same channel order

2 participants