Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: introduce SkiaVisual, SKCanvasElement and GLCanvasElement to allow externally adding sophisticated graphics #16621

Open
wants to merge 32 commits into
base: master
Choose a base branch
from

Conversation

ramezgerges
Copy link
Contributor

@ramezgerges ramezgerges commented May 7, 2024

GitHub Issue (If applicable): closes ##15166 closes #9405 closes #11034 closes https://github.com/unoplatform/private/issues/349

PR Type

What kind of change does this PR introduce?

What is the current behavior?

What is the new behavior?

PR Checklist

Please check if your PR fulfills the following requirements:

Other information

Internal Issue (If applicable):

@github-actions github-actions bot added area/skia ✏️ Categorizes an issue or PR as relevant to Skia area/automation Categorizes an issue or PR as relevant to project automation kind/documentation labels May 7, 2024
@unodevops
Copy link
Contributor

🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-16621/index.html

1 similar comment
@unodevops
Copy link
Contributor

🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-16621/index.html

doc/articles/controls/SkiaCanvas.md Outdated Show resolved Hide resolved
doc/articles/controls/SkiaCanvas.md Outdated Show resolved Hide resolved
doc/articles/controls/SkiaCanvas.md Outdated Show resolved Hide resolved
doc/articles/controls/SkiaCanvas.md Outdated Show resolved Hide resolved
doc/articles/controls/SkiaCanvas.md Outdated Show resolved Hide resolved
doc/articles/controls/SkiaCanvas.md Show resolved Hide resolved
src/Uno.UI.Runtime.Skia/GLCanvasElement.cs Outdated Show resolved Hide resolved
src/Uno.UI.Runtime.Skia/GLCanvasElement.cs Outdated Show resolved Hide resolved

if (_gl.CheckFramebufferStatus(GLEnum.Framebuffer) != GLEnum.FramebufferComplete)
{
throw new InvalidOperationException("Offscreen framebuffer is not complete");
Copy link
Member

Choose a reason for hiding this comment

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

If a user gets this message, what can be done? If possible, let's make the message actionable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If the user gets this message, then we couldn't construct the offscreen framebuffer and the user should report this as a bug. I don't think there's anything that can be done externally.

return;
}

using var _ = new GLStateDisposable(_gl!);
Copy link
Member

Choose a reason for hiding this comment

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

What if _gl is null?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

_gl cannot be be null if the element is IsLoaded, since we attempt to create a GL object there and throw if we couldn't. I would like this to be more explicit, but I'm not sure if there's something simple to enforce this beside adding a comment.

@unodevops
Copy link
Contributor

🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-16621/index.html

@unodevops
Copy link
Contributor

🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-16621/index.html

@unodevops
Copy link
Contributor

🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-16621/index.html

@@ -97,6 +97,10 @@
</ProjectReference>
</ItemGroup>

<ItemGroup>
<PackageReference Include="Silk.NET.OpenGL" Version="2.16.0" />
Copy link
Member

Choose a reason for hiding this comment

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

This shouldn't be needed here. I see the usages are only in the Uno.UI.Runtime.Skia and Uno.UI.Runtime.Skia.Wpf packages

@@ -35,4 +35,8 @@
<ProjectReference Include="..\Uno.UWP\Uno.Skia.csproj" TreatAsPackageReference="false" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Silk.NET.OpenGL" Version="2.16.0" />
Copy link
Member

Choose a reason for hiding this comment

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

You'll need to add this to nuspec. But I'm not sure if it's a good idea to have this dependency. @jeromelaban thoughts?

Copy link
Member

Choose a reason for hiding this comment

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

We already have that dependency in platform specific targets for Linux and WPF. We should also be able to have that dependency running Angle on macOS, afaik.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/automation Categorizes an issue or PR as relevant to project automation area/skia ✏️ Categorizes an issue or PR as relevant to Skia kind/documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

OpenGL and/or Generic 3D View support
4 participants