Skip to content

Expose ImmediateDrawingContext.DrawGeometry#20841

Open
rabbitism wants to merge 1 commit intoAvaloniaUI:masterfrom
irihitech:immediate_geometry
Open

Expose ImmediateDrawingContext.DrawGeometry#20841
rabbitism wants to merge 1 commit intoAvaloniaUI:masterfrom
irihitech:immediate_geometry

Conversation

@rabbitism
Copy link
Contributor

@rabbitism rabbitism commented Mar 8, 2026

What does the pull request do?

We have all infras to draw geometry in ImmediateDrawingContext. we should expose this to user.

What is the current behavior?

There is no way to draw geometry

What is the updated/expected behavior with this PR?

How was the solution implemented (if it's not obvious)?

Checklist

Breaking changes

Obsoletions / Deprecations

Fixed issues

@kekekeks
Copy link
Member

kekekeks commented Mar 8, 2026

Technically, Geometry is an AvaloniaObject and is dispatcher-bound. We need a separate IImmutableGeometry interface and a way to snapshot Geometry while on UI thread (note that snapshots are cheap, SKPath is copy-on-write)

@rabbitism
Copy link
Contributor Author

Technically, Geometry is an AvaloniaObject and is dispatcher-bound. We need a separate IImmutableGeometry interface and a way to snapshot Geometry while on UI thread (note that snapshots are cheap, SKPath is copy-on-write)

maybe I can follow the pattern of GlyphRun.TryCreateImmutableGlyphRunReference ?

@avaloniaui-bot
Copy link

You can test this PR using the following package version. 12.0.999-cibuild0063098-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@Gillibald
Copy link
Contributor

IRef is already enough. So IRef should also work. Maybe all platform implementations should be immutable?

@MrJul MrJul added the feature label Mar 9, 2026
@rabbitism
Copy link
Contributor Author

rabbitism commented Mar 12, 2026

request api review.

Edit: IRef won't work because IGeometryImpl is not IDisposable, but acutally wondering why it's not, because we are disposing SKPath in some cases.

_pathCache.Dispose();

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants