Skip to content

Commit

Permalink
docs: minor adjustments to GLCanvasElement and SKCanvasElement docs
Browse files Browse the repository at this point in the history
(cherry picked from commit 1c8d843)
  • Loading branch information
ramezgerges authored and mergify[bot] committed Oct 18, 2024
1 parent e639ebb commit b04cabe
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 12 deletions.
4 changes: 2 additions & 2 deletions doc/articles/controls/GLCanvasElement.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ These three abstract methods take a `Silk.NET.OpenGL.GL` parameter that can be u

### The GLCanvasElement constructor

The protected constructor requires a `Func<Window>` argument that fetches the `Microsoft.UI.Xaml.Window` object that the `GLCanvasElement` belongs to. This function is required because WinUI doesn't yet provide a way to get the `Window` of a `FrameworkElement`. This paramater is ignored on Uno Platform and must be set to null. This function is only called while the `GLCanvasElement` is still in the visual tree.
The protected constructor requires a `Func<Window>` argument that fetches the `Microsoft.UI.Xaml.Window` object that the `GLCanvasElement` belongs to. This function is required because WinUI doesn't yet provide a way to get the `Window` of a `FrameworkElement`. This parameter is ignored on Uno Platform and must be set to null. This function is only called while the `GLCanvasElement` is still in the visual tree.

### The `Init` method

Expand All @@ -47,7 +47,7 @@ To learn more about using [Silk.NET](https://www.nuget.org/packages/Silk.NET.Ope

## Full example

To see this in action, here's a complete sample that uses `GLCanvasElement` to draw a triangle. Note how you have to be careful with surrounding all the OpenGL-related logic in platform-specific guards. This is the case for both the [XAML](platform-specific-xaml) and the [code-behind](platform-specific-csharp).
To see this in action, here's a complete sample that uses `GLCanvasElement` to draw a triangle. Note how you have to be careful with surrounding all the OpenGL-related logic in platform-specific guards. This is the case for both the [XAML](platform-specific-xaml) and the [code-behind](platform-specific-csharp). For complete C# projects, visit our [GLCanvasElement Samples in the Uno.Samples repository](https://aka.platform.uno/glcanvaselement-sample).

XAML:

Expand Down
7 changes: 2 additions & 5 deletions doc/articles/controls/SKCanvasElement.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,10 @@ XAML:
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:BlankApp"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:skia="http://uno.ui/skia"
xmlns:not_skia="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
mc:Ignorable="d skia"
d:DesignHeight="300"
d:DesignWidth="400">
mc:Ignorable="skia">

<Grid>
<skia:Grid>
Expand All @@ -70,7 +67,7 @@ namespace BlankApp
{
public sealed partial class SKCanvasElement_Simple : UserControl
{
#if __SKIA__
#if HAS_UNO_SKIA
public int MaxSampleIndex => SKCanvasElementImpl.SampleCount - 1;
#endif

Expand Down
2 changes: 1 addition & 1 deletion src/AddIns/Uno.WinUI.Graphics2DSK/SKCanvasElement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public abstract class SKCanvasElement : FrameworkElement
/// <param name="area">The dimensions of the clipping area.</param>
/// <remarks>
/// When called, the <paramref name="canvas"/> is already set up such that the origin (0,0) is at the top-left of the clipping area.
/// Drawing outside this area (i.e. outside the (0, 0, area.Width, area.Height) rectangle will be clipped out.
/// Drawing outside this area (i.e. outside the (0, 0, area.Width, area.Height) rectangle) will be clipped out.
/// </remarks>
protected abstract void RenderOverride(SKCanvas canvas, Size area);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,10 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:UITests.Shared.Windows_UI_Composition"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:skia="http://uno.ui/skia"
xmlns:not_skia="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
mc:Ignorable="d skia"
d:DesignHeight="300"
d:DesignWidth="400">
mc:Ignorable="skia">

<Grid>
<skia:Grid>
Expand Down

0 comments on commit b04cabe

Please sign in to comment.