Skip to content

Use panama-media for the macOS image and video backends - #27

Merged
ghosthack merged 1 commit into
mainfrom
use-panama-media-apple
Oct 19, 2026
Merged

ghosthack merged 1 commit into
mainfrom
use-panama-media-apple

Conversation

@ghosthack

Copy link
Copy Markdown
Owner

Replaces the macOS backends' own CoreFoundation, CoreGraphics, ImageIO and AVFoundation downcalls with the published panama-media 0.1.4 bindings (corefoundation, cgimage, avfoundation), the same way the Windows backends already use WIC and Media Foundation. About 900 lines of hand-written bindings go away. All backends move from panama-media 0.1.1 to 0.1.4.

Behaviour

  • Still images: decoded pixels are byte-identical to 2.0.0 (full decode, getSize, and ImageReadParam subsampling, across HEIC/AVIF/WebP/PNG/JPEG including real camera photos).
  • Video frames: byte-identical for full-size frames and for render sizes at the source aspect ratio. A frame requested at a different aspect ratio is now scaled down from a larger intermediate instead of up from a smaller one.
  • AppleCoreGraphicsHelper stays public and keeps its signature; it now calls panama-media internally.
  • imageio-native-video-apple no longer depends on imageio-native-apple; it only used it for that helper.

Native access (user-visible)

The native calls now happen in the panama-media modules, so native access moves there (README updated):

Backend --enable-native-access
Apple images io.github.ghosthack.panama.media.corefoundation,io.github.ghosthack.panama.media.cgimage
Apple video io.github.ghosthack.panama.media.corefoundation,io.github.ghosthack.panama.media.avfoundation

With the old flag, the JDK's default mode still works (with warnings). Under --illegal-native-access=deny the old flag fails, and the error now names the modules to grant instead of claiming the OS is not macOS. Windows flags are unchanged (verified under deny).

Verification

  • macOS: full verify, all Apple tests pass (59 image, 10 video); a pixel-hash comparison of 75 decode results against 2.0.0 (differences only in the mismatched-aspect video case above); modular app runs under --illegal-native-access=deny with the new flags.
  • Windows: full verify with test and skip counts identical to main; modular app runs under deny with the documented WIC and Media Foundation flags.

Suggested release: 2.1.0 (the native-access change only affects deny mode).

🤖 Generated with Claude Code

https://claude.ai/code/session_01JHHPeMi7jrfjcEgEXqm5gh

Replace the Apple backends' own CoreFoundation, CoreGraphics, ImageIO and
AVFoundation downcalls with the published panama-media 0.1.4 bindings
(corefoundation, cgimage, avfoundation), as the Windows backends already
do with WIC and Media Foundation. Decoded pixels are byte-identical for
still images and for video frames at the source aspect ratio; a frame
requested at a different aspect ratio is now scaled down from a larger
intermediate instead of up from a smaller one.

Native access moves from the imageio modules to the panama-media modules
that make the native calls (see the README table). On macOS, a missing
grant now reports which modules need native access instead of claiming
the platform is unsupported.

Bump panama-media from 0.1.1 to 0.1.4 for all backends.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JHHPeMi7jrfjcEgEXqm5gh
@ghosthack
ghosthack merged commit 409085e into main Oct 19, 2026
3 checks passed
@ghosthack
ghosthack deleted the use-panama-media-apple branch October 19, 2026 02:24
ghosthack added a commit that referenced this pull request Oct 19, 2026
Next release moves the macOS backends onto panama-media 0.1.4 (#27).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JHHPeMi7jrfjcEgEXqm5gh
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.

1 participant