Skip to content

Add sk_codec_is_animated C API#263

Open
mattleibow wants to merge 2 commits into
skiasharpfrom
dev/issue-3939-codec-isanimated
Open

Add sk_codec_is_animated C API#263
mattleibow wants to merge 2 commits into
skiasharpfrom
dev/issue-3939-codec-isanimated

Conversation

@mattleibow

@mattleibow mattleibow commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator

Add C API for isAnimated() to disambiguate RepetitionCount == 0.

C API changes

  • Added sk_codec_animation_status_t enum (YES=0, NO=1, UNKNOWN=2)
  • Added sk_codec_is_animated() function

Implementation notes

Uses explicit static_cast<int>() to convert C++ enum class to C enum. C-style cast does not work correctly for enum class types - it was causing all values to be returned incorrectly, making the API non-functional.

Per Skia's own tests (tests/CodecAnimTest.cpp): animated images with FrameCount > 1 return IsAnimated::kYes, static images return IsAnimated::kNo.

Fixes mono/SkiaSharp#3939

mattleibow and others added 2 commits June 27, 2026 01:02
Wraps SkCodec::isAnimated() to disambiguate RepetitionCount == 0.
Returns enum indicating if codec is animated (Yes/No/Unknown).

Issue: mono/SkiaSharp#3939

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Use explicit static_cast through int to properly convert
C++ enum class to C enum. C-style cast may not work correctly
for enum class types.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@mattleibow mattleibow force-pushed the dev/issue-3939-codec-isanimated branch from 28722b5 to 97f5f22 Compare June 26, 2026 23:05
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.

[api] Add SKCodec.IsAnimated property

1 participant