Skip to content

Add OSUI renderer support for Image#873

Merged
Kyle-Ye merged 5 commits into
mainfrom
feature/image_layer
May 24, 2026
Merged

Add OSUI renderer support for Image#873
Kyle-Ye merged 5 commits into
mainfrom
feature/image_layer

Conversation

@Kyle-Ye
Copy link
Copy Markdown
Member

@Kyle-Ye Kyle-Ye commented May 24, 2026

Summary

  • Implement async image layer updates for compatible image changes and related layer properties.
  • Add GraphicsImage render support for CG images, vector glyphs, and vector layers.
  • Add Example/setup.sh and README guidance so Example setup uses the Tuist version pinned by Example/mise.toml.

@Kyle-Ye Kyle-Ye marked this pull request as ready for review May 24, 2026 10:41
@augmentcode
Copy link
Copy Markdown

augmentcode Bot commented May 24, 2026

🤖 Augment PR Summary

Summary: This PR adds renderer support for Image in OpenSwiftUI by enabling Core Animation layer updates and adding concrete rendering for GraphicsImage content types.

Changes:

  • Added async-layer property support for contentsCenter and contentsScale so image layer geometry/scale can be updated incrementally.
  • Refactored DisplayListViewPlatform state update entry points by adding small inherited-view helper wrappers and making the underlying updateState/updateStateAsync private.
  • Implemented GraphicsImage.render(at:prefersMask:) to return CG images for CGImage, vector glyph, and vector layer-backed images (when supported).
  • Implemented ImageLayer.updateAsync to allow compatible async updates for CGImage/IOSurface/vector-glyph cases and to update relevant layer properties (center/scale/multiply color/background).
  • Added a CoreUI-only helper on CUINamedVectorGlyph to rasterize glyphs while temporarily setting variable-value bounds under a lock.
  • Updated the Example app to show image conversion behavior and added Example/setup.sh plus README instructions to use the pinned Tuist via mise.

Technical Notes: The async update path relies on property-diffing and key-path updates on the backing CALayer, and conditionally compiles vector glyph rendering behind OPENSWIFTUI_LINK_COREUI.

🤖 Was this summary useful? React with 👍 or 👎

Copy link
Copy Markdown

@augmentcode augmentcode Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review completed. 1 suggestion posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

newImage: newImage,
newSize: newSize
)
case let (.vectorGlyph(oldContents), .vectorGlyph(newContents)) where oldContents == newContents:
Copy link
Copy Markdown

@augmentcode augmentcode Bot May 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ImageLayer.updateAsync treats .vectorGlyph as compatible even when GraphicsImage.scale changes, but the underlying layer.contents may have been rasterized at the old scale (via GraphicsImage.render/CUINamedVectorGlyph.rasterizeImage). Consider making scale changes force a full update here (return false) unless the contents is guaranteed to be scale-independent.

Severity: medium

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 24, 2026

Codecov Report

❌ Patch coverage is 0% with 156 lines in your changes missing coverage. Please review.
✅ Project coverage is 26.98%. Comparing base (899460f) to head (3099bfd).

Files with missing lines Patch % Lines
...ources/OpenSwiftUICore/View/Image/ImageLayer.swift 0.00% 63 Missing ⚠️
...ces/OpenSwiftUICore/View/Image/GraphicsImage.swift 0.00% 42 Missing ⚠️
...e/Render/DisplayList/DisplayListViewPlatform.swift 0.00% 29 Missing ⚠️
.../OpenSwiftUICore/View/Image/VectorImageLayer.swift 0.00% 14 Missing ⚠️
...ore/Render/DisplayList/DisplayListAsyncLayer.swift 0.00% 5 Missing ⚠️
...re/Render/DisplayList/DisplayListViewUpdater.swift 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #873      +/-   ##
==========================================
- Coverage   27.07%   26.98%   -0.09%     
==========================================
  Files         678      678              
  Lines       47004    47149     +145     
==========================================
- Hits        12725    12723       -2     
- Misses      34279    34426     +147     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

@github-actions github-actions Bot added area: example Example apps, previews, sample projects, screenshots, or demo assets. area: graphics Color, shape, gradient, image, symbols, and graphics primitives. area: rendering DisplayList, render backends, renderer hosts, drawing, and effects. type: feature New API, behavior, platform support, or user-facing capability. area: tooling Developer tooling, package manifests, Tuist, scripts, formatting, or release tooling. labels May 24, 2026
@Kyle-Ye Kyle-Ye merged commit 90b3f69 into main May 24, 2026
8 of 11 checks passed
@Kyle-Ye Kyle-Ye deleted the feature/image_layer branch May 24, 2026 11:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: example Example apps, previews, sample projects, screenshots, or demo assets. area: graphics Color, shape, gradient, image, symbols, and graphics primitives. area: rendering DisplayList, render backends, renderer hosts, drawing, and effects. area: tooling Developer tooling, package manifests, Tuist, scripts, formatting, or release tooling. type: feature New API, behavior, platform support, or user-facing capability.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant