Consider the following example:
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Top">
<Line Stroke="Red" X1="0" X2="100" Y1="50" Y2="50"/>
<Line Stroke="Red" X1="50" X2="50" Y1="0" Y2="100"/>
</Grid>
Despite the fact that both lines have SolidColorBrush and both have opacity=1, a color blending still occurs: The pixel at the point of intersection is of darker red color.
Why does it happen and how can I prevent it?
Thanks!
P.S Here is another example of the same code with the brushes explicitly defined:
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Top">
<Grid.Resources>
<Style TargetType="{x:Type Line}">
<Setter Property="Stroke">
<Setter.Value>
<SolidColorBrush Color="Red" Opacity="1" />
</Setter.Value>
</Setter>
</Style>
</Grid.Resources>
<Line X1="0" X2="100" Y1="50" Y2="50" />
<Line X1="50" X2="50" Y1="0" Y2="100" />
</Grid>
The three primary colors are red, yellow, and blue; they are the only colors that cannot be made by mixing two other colors.
Ombré /ˈɒmbreɪ/ (literally "shaded" in French) is the blending of one color hue to another, usually moving tints and shades from light to dark.
You might want to look into snapping to pixels. This is a feature of WPF that allows for some extra granularity in rendering. Say if we take a Line
and apply this:
<Line X1="0" X2="100" Y1="50" Y2="50" SnapsToDevicePixels="True"/>
As an example of what this serves to do, here's an image from the linked article:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With