You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -156,7 +156,7 @@ A [CompositionSurfaceBrush](/windows/windows-app-sdk/api/winrt/microsoft.ui.comp
156
156
157
157
The following code shows a SpriteVisual painted with a text run rendered onto an ICompositionSurface by using Win2D. To use Win2D with WinUI, install the [Microsoft.Graphics.Win2D NuGet package](https://www.nuget.org/packages/Microsoft.Graphics.Win2D) in your project.
@@ -301,7 +301,7 @@ A [CompositionNineGridBrush](/windows/windows-app-sdk/api/winrt/microsoft.ui.com
301
301
302
302
The following code shows a SpriteVisual painted with a CompositionNineGridBrush. The source of the mask is a CompositionSurfaceBrush which is stretched using a Nine-Grid.
303
303
304
-
```cs
304
+
```csharp
305
305
Compositor_compositor;
306
306
SpriteVisual_nineGridVisual;
307
307
CompositionNineGridBrush_nineGridBrush;
@@ -332,7 +332,7 @@ A [CompositionBackdropBrush](/windows/windows-app-sdk/api/winrt/microsoft.ui.com
332
332
333
333
The following code shows a small visual tree to create an image using CompositionSurfaceBrush and a frosted glass overlay above the image. The frosted glass overlay is created by placing a SpriteVisual filled with an EffectBrush above the image. The EffectBrush uses a CompositionBackdropBrush as an input to the blur effect.
Copy file name to clipboardExpand all lines: hub/apps/develop/composition/composition-effects.md
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -52,7 +52,7 @@ See Win2D’s [Microsoft.Graphics.Canvas.Effects](https://microsoft.github.io/Wi
52
52
53
53
Effects can be chained, allowing an application to simultaneously use multiple effects on an image. Effect graphs can support multiple effects that can refer to one and other. When describing your effect, simply add an effect as input to your effect.
Copy file name to clipboardExpand all lines: hub/apps/develop/composition/composition-shadows.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@ The [DropShadow](/windows/windows-app-sdk/api/winrt/microsoft.ui.composition.dro
13
13
14
14
To create a basic shadow, simply create a new DropShadow and associate it to your visual. The shadow is rectangular by default. A standard set of properties are available to tweak the look and feel of your shadow.
@@ -40,7 +40,7 @@ There are a few ways to define the shape for your DropShadow:
40
40
41
41
If you want your shadow to match the Visual’s content you can either use the Visual’s brush for your Shadow mask property, or set the shadow to automatically inherit mask from the content. If using a LayerVisual, the shadow will inherit the mask by default.
As is standard in the Visual Layer, DropShadow properties can be animated using Composition Animations. Below, we modify the code from the sprinkles sample above to animate the blur radius for the shadow.
Copy file name to clipboardExpand all lines: hub/apps/develop/composition/composition-tailoring.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,7 +36,7 @@ When turned off, acrylic material will automatically fall back to a solid color
36
36
37
37
However, for any custom effects the application needs to respond to the [UISettings.AdvancedEffectsEnabled](/uwp/api/windows.ui.viewmanagement.uisettings.advancedeffectsenabled) property or [AdvancedEffectsEnabledChanged](/uwp/api/windows.ui.viewmanagement.uisettings.advancedeffectsenabledchanged) event and switch out the effect/effect graph to use an effect that has no transparency. An example of this is below:
38
38
39
-
```cs
39
+
```csharp
40
40
publicMainPage()
41
41
{
42
42
varuisettings=newUISettings();
@@ -56,7 +56,7 @@ Similarly, applications should listen and respond to the [UISettings.AnimationsE
56
56
57
57

58
58
59
-
```cs
59
+
```csharp
60
60
publicMainPage()
61
61
{
62
62
varuisettings=newUISettings();
@@ -80,20 +80,20 @@ The API can be added to existing code in a few easy steps.
80
80
81
81
1. Acquire the capabilities object in your application’s constructor.
82
82
83
-
```cs
83
+
```csharp
84
84
_capabilities=newCompositionCapabilities();
85
85
```
86
86
87
87
1. Registeracapabilitieschangedeventlistenerfor your app.
Copy file name to clipboardExpand all lines: hub/apps/develop/composition/composition-visual-tree.md
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -42,7 +42,7 @@ This shows a number of basic concepts for working with the API including:
42
42
43
43
Creating a [**Compositor**](/windows/windows-app-sdk/api/winrt/microsoft.ui.composition.compositor) and storing it in a variable for use as a factory is a simple task. In a WinUI app, you typically retrieve the compositor from a XAML element that is already connected to the visual tree:
@@ -52,7 +52,7 @@ If you need a compositor and do not have a UIElement available, you can use `Com
52
52
53
53
Using the [**Compositor**](/windows/windows-app-sdk/api/winrt/microsoft.ui.composition.compositor) it's easy to create objects whenever you need them, such as a [**SpriteVisual**](/windows/windows-app-sdk/api/winrt/microsoft.ui.composition.spritevisual) and a [**CompositionColorBrush**](/windows/windows-app-sdk/api/winrt/microsoft.ui.composition.compositioncolorbrush):
@@ -63,7 +63,7 @@ While this is only a few lines of code, it demonstrates a powerful concept: [**S
63
63
64
64
The [**Compositor**](/windows/windows-app-sdk/api/winrt/microsoft.ui.composition.compositor) can also be used to create clips to a [**Visual**](/windows/windows-app-sdk/api/winrt/microsoft.ui.composition.visual). Below is an example from the sample of using the [**InsetClip**](/windows/windows-app-sdk/api/winrt/microsoft.ui.composition.insetclip) to trim each side of the visual:
65
65
66
-
```cs
66
+
```csharp
67
67
varclip=_compositor.CreateInsetClip();
68
68
clip.LeftInset=1.0f;
69
69
clip.RightInset=1.0f;
@@ -78,7 +78,7 @@ Like other objects in the API, [**InsetClip**](/windows/windows-app-sdk/api/winr
78
78
79
79
A [**Visual**](/windows/windows-app-sdk/api/winrt/microsoft.ui.composition.visual) can be transformed with a rotation. Note that [**RotationAngle**](/windows/windows-app-sdk/api/winrt/microsoft.ui.composition.visual.rotationangle) supports both radians and degrees. It defaults to radians, but it's easy to specify degrees as shown in the following snippet:
80
80
81
-
```cs
81
+
```csharp
82
82
child.RotationAngleInDegrees=45.0f;
83
83
```
84
84
@@ -88,7 +88,7 @@ Rotation is just one example of a set of transform components provided by the AP
88
88
89
89
Setting the opacity of a visual is a simple operation using a float value. For example, in the sample all the squares start at .8 opacity:
90
90
91
-
```cs
91
+
```csharp
92
92
visual.Opacity=0.8f;
93
93
```
94
94
@@ -100,7 +100,7 @@ The Composition API allows for a Visual's position in a [**VisualCollection**](/
100
100
101
101
In the sample, a [**Visual**](/windows/windows-app-sdk/api/winrt/microsoft.ui.composition.visual) that has been clicked is sorted to the top:
102
102
103
-
```cs
103
+
```csharp
104
104
parent.Children.InsertAtTop(_currentVisual);
105
105
```
106
106
@@ -123,7 +123,7 @@ In the full WinUI sample, all of the concepts above are used together to constru
0 commit comments