Skip to content

Commit 46ad787

Browse files
committed
fix csharp language slugs
1 parent 0634867 commit 46ad787

6 files changed

Lines changed: 39 additions & 39 deletions

File tree

hub/apps/develop/composition/composition-brushes.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ The following illustration and code shows a small visual tree to create a rectan
5555

5656
![CompositionColorBrush](images/composition-compositioncolorbrush.png)
5757

58-
```cs
58+
```csharp
5959
Compositor _compositor;
6060
ContainerVisual _container;
6161
SpriteVisual _colorVisual1, _colorVisual2;
@@ -87,7 +87,7 @@ The following illustration and code shows a SpriteVisual painted with a LinearGr
8787

8888
![CompositionLinearGradientBrush](images/composition-compositionlineargradientbrush.png)
8989

90-
```cs
90+
```csharp
9191
Compositor _compositor;
9292
SpriteVisual _gradientVisual;
9393
CompositionLinearGradientBrush _redyellowBrush;
@@ -110,7 +110,7 @@ The following illustration and code shows a SpriteVisual painted with a RadialGr
110110

111111
![CompositionRadialGradientBrush](images/radial-gradient-brush.png)
112112

113-
```cs
113+
```csharp
114114
Compositor _compositor;
115115
SpriteVisual _gradientVisual;
116116
CompositionRadialGradientBrush RGBrush;
@@ -133,7 +133,7 @@ The following illustration and code shows a SpriteVisual painted with a bitmap o
133133

134134
![CompositionSurfaceBrush](images/composition-compositionsurfacebrush.png)
135135

136-
```cs
136+
```csharp
137137
Compositor _compositor;
138138
SpriteVisual _imageVisual;
139139
CompositionSurfaceBrush _imageBrush;
@@ -156,7 +156,7 @@ A [CompositionSurfaceBrush](/windows/windows-app-sdk/api/winrt/microsoft.ui.comp
156156

157157
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.
158158

159-
```cs
159+
```csharp
160160
Compositor _compositor;
161161
CanvasDevice _device;
162162
CompositionGraphicsDevice _compositionGraphicsDevice;
@@ -203,7 +203,7 @@ A [CompositionSurfaceBrush](/windows/windows-app-sdk/api/winrt/microsoft.ui.comp
203203

204204
The following code shows a SpriteVisual painted with a video loaded onto an ICompositionSurface.
205205

206-
```cs
206+
```csharp
207207
Compositor _compositor;
208208
SpriteVisual _videoVisual;
209209
CompositionSurfaceBrush _videoBrush;
@@ -236,7 +236,7 @@ The following illustration and code shows a SpriteVisual painted with an image o
236236

237237
![CompositionEffectBrush](images/composition-cat-desaturated.png)
238238

239-
```cs
239+
```csharp
240240
Compositor _compositor;
241241
SpriteVisual _effectVisual;
242242
CompositionEffectBrush _effectBrush;
@@ -273,7 +273,7 @@ The following illustration and code shows a SpriteVisual painted with a Composit
273273

274274
![CompositionMaskBrush](images/composition-compositionmaskbrush.png)
275275

276-
```cs
276+
```csharp
277277
Compositor _compositor;
278278
SpriteVisual _maskVisual;
279279
CompositionMaskBrush _maskBrush;
@@ -301,7 +301,7 @@ A [CompositionNineGridBrush](/windows/windows-app-sdk/api/winrt/microsoft.ui.com
301301

302302
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.
303303

304-
```cs
304+
```csharp
305305
Compositor _compositor;
306306
SpriteVisual _nineGridVisual;
307307
CompositionNineGridBrush _nineGridBrush;
@@ -332,7 +332,7 @@ A [CompositionBackdropBrush](/windows/windows-app-sdk/api/winrt/microsoft.ui.com
332332

333333
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.
334334

335-
```cs
335+
```csharp
336336
Compositor _compositor;
337337
ContainerVisual _containerVisual;
338338
SpriteVisual _imageVisual;

hub/apps/develop/composition/composition-effects.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ See Win2D’s [Microsoft.Graphics.Canvas.Effects](https://microsoft.github.io/Wi
5252

5353
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.
5454

55-
```cs
55+
```csharp
5656
IGraphicsEffect graphicsEffect =
5757
new Microsoft.Graphics.Canvas.Effects.ArithmeticCompositeEffect
5858
{
@@ -83,13 +83,13 @@ When compiling the effect description above, you have the flexibility of either
8383

8484
Compiling an effect with saturation baked in:
8585

86-
```cs
86+
```csharp
8787
var effectFactory = _compositor.CreateEffectFactory(graphicsEffect);
8888
```
8989

9090
Compiling an effect with dynamic saturation:
9191

92-
```cs
92+
```csharp
9393
var effectFactory = _compositor.CreateEffectFactory(graphicsEffect, new[]{"SaturationEffect.Saturation"});
9494
_catEffect = effectFactory.CreateBrush();
9595
_catEffect.SetSourceParameter("mySource", surfaceBrush);
@@ -100,7 +100,7 @@ The saturation property of the effect above can then be either set to a static v
100100

101101
You can create a ScalarKeyFrame that will be used to animate the Saturation property of an effect like this:
102102

103-
```cs
103+
```csharp
104104
ScalarKeyFrameAnimation effectAnimation = _compositor.CreateScalarKeyFrameAnimation();
105105
effectAnimation.InsertKeyFrame(0f, 0f);
106106
effectAnimation.InsertKeyFrame(0.50f, 1f);
@@ -111,7 +111,7 @@ ScalarKeyFrameAnimation effectAnimation = _compositor.CreateScalarKeyFrameAnimat
111111

112112
Start the animation on the Saturation property of the effect like this:
113113

114-
```cs
114+
```csharp
115115
catEffect.Properties.StartAnimation("saturationEffect.Saturation", effectAnimation);
116116
```
117117

@@ -156,15 +156,15 @@ In the next few steps we will use composition API’s to apply a saturation effe
156156

157157
### Setting your Composition Basics
158158

159-
```cs
159+
```csharp
160160
_compositor = ElementCompositionPreview.GetElementVisual(MyHost).Compositor;
161161
_root = _compositor.CreateContainerVisual();
162162
ElementCompositionPreview.SetElementChildVisual(MyHost, _root);
163163
```
164164

165165
### Creating a CompositionSurface Brush
166166

167-
```cs
167+
```csharp
168168
CompositionSurfaceBrush surfaceBrush = _compositor.CreateSurfaceBrush();
169169
LoadedImageSurface imageSurface = LoadedImageSurface.StartLoadFromUri(new Uri("ms-appx:///Assets/cat.png"));
170170
surfaceBrush.Surface = imageSurface;
@@ -174,7 +174,7 @@ surfaceBrush.Surface = imageSurface;
174174

175175
1. Create the graphics effect.
176176

177-
```cs
177+
```csharp
178178
var graphicsEffect = new SaturationEffect
179179
{
180180
Saturation = 0.0f,
@@ -184,7 +184,7 @@ surfaceBrush.Surface = imageSurface;
184184

185185
1. Compile the effect and create the effect brush.
186186

187-
```cs
187+
```csharp
188188
var effectFactory = _compositor.CreateEffectFactory(graphicsEffect);
189189

190190
var catEffect = effectFactory.CreateBrush();
@@ -193,7 +193,7 @@ surfaceBrush.Surface = imageSurface;
193193

194194
1. Create a SpriteVisual in the composition tree and apply the effect.
195195

196-
```cs
196+
```csharp
197197
var catVisual = _compositor.CreateSpriteVisual();
198198
catVisual.Brush = catEffect;
199199
catVisual.Size = new Vector2(219, 300);

hub/apps/develop/composition/composition-lighting.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ When lights target a Visual (add to [Targets](/windows/windows-app-sdk/api/winrt
4343

4444
In the sample below, we use a PointLight to target a XAML TextBlock.
4545

46-
```cs
46+
```csharp
4747
_pointLight = _compositor.CreatePointLight();
4848
_pointLight.Color = Colors.White;
4949
_pointLight.CoordinateSpace = text; //set up co-ordinate space for offset
@@ -52,7 +52,7 @@ In the sample below, we use a PointLight to target a XAML TextBlock.
5252

5353
By adding animation to the offset of the point light, a shimmering effect is easily achieved.
5454

55-
```cs
55+
```csharp
5656
_pointLight.Offset = new Vector3(-(float)TextBlock.ActualWidth, (float)TextBlock.ActualHeight / 2, (float)TextBlock.FontSize);
5757
```
5858

@@ -121,7 +121,7 @@ Property | Description
121121

122122
The sample below shows how to add a normal map to a SceneLightingEffect.
123123

124-
```cs
124+
```csharp
125125
CompositionBrush CreateNormalMapBrush(ICompositionSurface normalMapImage)
126126
{
127127
var colorSourceEffect = new ColorSourceEffect()

hub/apps/develop/composition/composition-shadows.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ The [DropShadow](/windows/windows-app-sdk/api/winrt/microsoft.ui.composition.dro
1313

1414
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.
1515

16-
```cs
16+
```csharp
1717
var basicRectVisual = _compositor.CreateSpriteVisual();
1818
basicRectVisual.Brush = _compositor.CreateColorBrush(Colors.Blue);
1919
basicRectVisual.Offset = new Vector3(100, 100, 20);
@@ -40,7 +40,7 @@ There are a few ways to define the shape for your DropShadow:
4040

4141
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.
4242

43-
```cs
43+
```csharp
4444
var imageSurface = LoadedImageSurface.StartLoadFromUri(new Uri("ms-appx:///Assets/myImage.png"));
4545
var imageBrush = _compositor.CreateSurfaceBrush(imageSurface);
4646

@@ -66,7 +66,7 @@ In some cases, you may want to shape the shadow such that it doesn’t match you
6666

6767
In the below example, we load two surfaces - one for the Visual content and one for the Shadow mask:
6868

69-
```cs
69+
```csharp
7070
var imageSurface = LoadedImageSurface.StartLoadFromUri(new Uri("ms-appx:///Assets/myImage.png"));
7171
var imageBrush = _compositor.CreateSurfaceBrush(imageSurface);
7272

@@ -92,7 +92,7 @@ imageSpriteVisual.Shadow = shadow;
9292

9393
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.
9494

95-
```cs
95+
```csharp
9696
ScalarKeyFrameAnimation blurAnimation = _compositor.CreateScalarKeyFrameAnimation();
9797
blurAnimation.InsertKeyFrame(0.0f, 25.0f);
9898
blurAnimation.InsertKeyFrame(0.7f, 50.0f);

hub/apps/develop/composition/composition-tailoring.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ When turned off, acrylic material will automatically fall back to a solid color
3636

3737
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:
3838

39-
```cs
39+
```csharp
4040
public MainPage()
4141
{
4242
var uisettings = new UISettings();
@@ -56,7 +56,7 @@ Similarly, applications should listen and respond to the [UISettings.AnimationsE
5656

5757
![Animations Option in Settings](images/tailoring-animations-setting.png)
5858

59-
```cs
59+
```csharp
6060
public MainPage()
6161
{
6262
var uisettings = new UISettings();
@@ -80,20 +80,20 @@ The API can be added to existing code in a few easy steps.
8080

8181
1. Acquire the capabilities object in your application’s constructor.
8282

83-
```cs
83+
```csharp
8484
_capabilities = new CompositionCapabilities();
8585
```
8686

8787
1. Register a capabilities changed event listener for your app.
8888

89-
```cs
89+
```csharp
9090
_capabilities.Changed += HandleCapabilitiesChanged;
9191
```
9292

9393
1. Add content to the event callback method to handle various capabilities levels. This may or may not be similar to the next step below.
9494
1. When using effects, check the capabilities object first. Consider using conditional checks or switch control statements, depending on how you want to tailor the effects.
9595

96-
```cs
96+
```csharp
9797
if (_capabilities.AreEffectsSupported())
9898
{
9999
// Add incremental effects updates here

hub/apps/develop/composition/composition-visual-tree.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ This shows a number of basic concepts for working with the API including:
4242

4343
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:
4444

45-
```cs
45+
```csharp
4646
Compositor compositor = ElementCompositionPreview.GetElementVisual(MyHost).Compositor;
4747
```
4848

@@ -52,7 +52,7 @@ If you need a compositor and do not have a UIElement available, you can use `Com
5252

5353
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):
5454

55-
```cs
55+
```csharp
5656
var visual = _compositor.CreateSpriteVisual();
5757
visual.Brush = _compositor.CreateColorBrush(Color.FromArgb(0xFF, 0xFF, 0xFF, 0xFF));
5858
```
@@ -63,7 +63,7 @@ While this is only a few lines of code, it demonstrates a powerful concept: [**S
6363

6464
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:
6565

66-
```cs
66+
```csharp
6767
var clip = _compositor.CreateInsetClip();
6868
clip.LeftInset = 1.0f;
6969
clip.RightInset = 1.0f;
@@ -78,7 +78,7 @@ Like other objects in the API, [**InsetClip**](/windows/windows-app-sdk/api/winr
7878

7979
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:
8080

81-
```cs
81+
```csharp
8282
child.RotationAngleInDegrees = 45.0f;
8383
```
8484

@@ -88,7 +88,7 @@ Rotation is just one example of a set of transform components provided by the AP
8888

8989
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:
9090

91-
```cs
91+
```csharp
9292
visual.Opacity = 0.8f;
9393
```
9494

@@ -100,7 +100,7 @@ The Composition API allows for a Visual's position in a [**VisualCollection**](/
100100

101101
In the sample, a [**Visual**](/windows/windows-app-sdk/api/winrt/microsoft.ui.composition.visual) that has been clicked is sorted to the top:
102102

103-
```cs
103+
```csharp
104104
parent.Children.InsertAtTop(_currentVisual);
105105
```
106106

@@ -123,7 +123,7 @@ In the full WinUI sample, all of the concepts above are used together to constru
123123
</Page>
124124
```
125125

126-
```cs
126+
```csharp
127127
using System;
128128
using System.Numerics;
129129
using Microsoft.UI.Composition;

0 commit comments

Comments
 (0)