Skip to content

[api] Add SKCodec.IsAnimated property #3939

Description

@mattleibow

Part of #3680

Review for v4 inclusion — evaluate against time constraints and value. This wraps an existing Skia C++ method that disambiguates a currently confusing API.

Summary

Expose SkCodec::isAnimated() (added in Skia m135) which returns a tri-state result: Yes, No, or Unknown. Currently SKCodec.RepetitionCount == 0 is ambiguous — it could mean "not animated" or "unknown" (e.g. partial GIF data).

What exists today

Layer Status
C++ SkCodec::isAnimated() returns enum {kYes, kNo, kUnknown}
C API ❌ No sk_codec_is_animated
C# ❌ Not exposed. Users rely on RepetitionCount which is ambiguous.

Proposed changes

  • Add SKCodecAnimationStatus enum (Yes, No, Unknown)
  • Add sk_codec_is_animated() to C API shim (~3 lines)
  • Regenerate bindings
  • Add SKCodec.IsAnimated property returning the enum (~5 lines)
  • Tests with animated GIF/WebP and static images (~30 lines)

Estimated effort

~2 hours, ~45 lines total.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/SkiaSharpIssues that relate to the C# binding of SkiaSharp.cost/xs~1 Isolated, well-understood, minimal context neededpriority/2Nice to have: land if possible, can slip to next milestone.triage/triagedtype/feature-requestupgrading/4.xIssues and discussions relating to the upgrade from 3.x to 4.x

    Type

    No type

    Projects

    Status
    New

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions