Brush 15.11.2018 vjj 1
15.11.2018 vjj 3 Brush SolidColorBrush, LinearGradientBrush RadialGradientBrush ImageBrush DrawingBrush VisualBrush
15.11.2018 vjj 4 SolidColorBursh GradientBrush Color Brush LinearGradientBrush RadialGradientBrush
15.11.2018 vjj 5 Color <Rectangle Width="100" Height="30" Fill="Blue" /> <Rectangle Width="100" Height="30" > <Rectangle.Fill> <SolidColorBrush Color="Blue" /> <SolidColorBrush Color="#00F" /> <SolidColorBrush Color="#F00F" /> <SolidColorBrush Color="#0000FF" /> <SolidColorBrush Color="#FF0000FF" /> <SolidColorBrush> <SolidColorBrush.Color> <Color ScA="1.0" ScR="0.0" ScG="0.0" ScB="1.0" /> <Color A="255" R="0" G="0" B="255" /> </SolidColorBrush.Color> </SolidColorBrush> </Rectangle.Fill> </Rectangle>
15.11.2018 vjj 6 LinearGradientBrush <LinearGradientBrush StartPoint="0,0" EndPoint="1,0"> <LinearGradientBrush.GradientStops> <GradientStop Color="Yellow" Offset="0" /> <GradientStop Color="Red" Offset="0.25" /> <GradientStop Color="Blue" Offset="0.75" /> <GradientStop Color="LimeGreen" Offset="1" /> </LinearGradientBrush.GradientStops> </LinearGradientBrush>
vjj 15.11.2018 7 LinearGradientBrush StartPoint="0.25,0.5" EndPoint="0.75,0.5" StartPoint="0.5,0" EndPoint="0.5,1" StartPoint="0,0" EndPoint="1,1" SpreadMethod="Pad" SpreadMethod="Reflect" SpreadMethod="Repeat"
15.11.2018 vjj 8 RadialGradientBrush <RadialGradientBrush GradientOrigin="0.5,0.5" Center="0.5,0.5" RadiusX="0.5" RadiusY="0.5"> <RadialGradientBrush.GradientStops> <GradientStop Color="Yellow" Offset="0" /> <GradientStop Color="Red" Offset="0.25" /> <GradientStop Color="Blue" Offset="0.75" /> <GradientStop Color="LimeGreen" Offset="1" /> </RadialGradientBrush.GradientStops> </RadialGradientBrush>
15.11.2018 vjj 9 RadialGradientBrush Center="0.5,0.5" RadiusX="0.5" RadiusY="0.5" GradientOrigin="0.5,0.5" Center="0.5,0.5" RadiusX="0.5" RadiusY="0.5" GradientOrigin="0.75,0.25" Center="0.1,0.1" RadiusX="0.5" RadiusY="0.5" GradientOrigin="0.5,0.5"
15.11.2018 vjj 10 SpreadMethod="Pad" RadialGradientBrush SpreadMethod="Reflect" SpreadMethod="Repeat"
15.11.2018 vjj 11 Tile Brush ImageBrush DrawingBrush VisualBrush
15.11.2018 vjj 12 ImageBrush <Ellipse Width="100" Height="100"> <Ellipse.Background> <ImageBrush ImageSource="image.jpg" /> </Ellipse.Background> </Ellipse>
15.11.2018 vjj 13 Stretch Fill default celá dlaždice vyplněna celým obrázkem stretching - deformace Uniform celý nedeformovaný obrázek uvnitř dlaždice uniform stretching volné okraje UniformToFill celá dlaždice vyplněna nedeformovaným obrázkem ořezávání (cropping) None bez úprav výřez nebo volné okraje
15.11.2018 vjj 14 default Stretch behavior - Fill <Rectangle Width="200" Height="200"> <Rectangle.Fill> <ImageBrush ImageSource="c:\image.jpg" Stretch="Fill" /> </Rectangle.Fill> </Rectangle>
15.11.2018 vjj 15 Stretch behavior Uniform <Border Width="200" Height="200" Background="DarkBlue" > <Rectangle Width="200" Height="200" > <Rectangle.Fill> <ImageBrush ImageSource="c:\image.jpg" Stretch="Uniform" /> </Rectangle.Fill> </Rectangle> </Border>
15.11.2018 vjj 16 Stretch behavior UniformToFill <Rectangle Width="200" Height="100" Margin="10"> <Rectangle.Fill> <ImageBrush ImageSource="c:\image.jpg" Stretch="UniformToFill" /> </Rectangle.Fill> </Rectangle>
15.11.2018 vjj 17 Stretch behavior None <Rectangle Width="200" Height="100" Margin="10"> <Rectangle.Fill> <ImageBrush ImageSource="c:\image.jpg" Stretch="None" /> </Rectangle.Fill> </Rectangle>
15.11.2018 vjj 18 DrawingBrush Vybarvuje pomocí objektů odvozených od Drawing GeometryDrawing ImageDrawing GlyphRunDrawing VideoDrawing DrawingGroup
15.11.2018 vjj 19 sample (xii) <Ellipse Height="200" Width="400" Stroke="Yellow" StrokeThickness="10" StrokeDashArray="1 1 3 1" StrokeDashCap="Triangle"> <Ellipse.Fill> <DrawingBrush TileMode="Tile" Viewport="0,0,0.4,0.5"> <DrawingBrush.Drawing> <DrawingGroup> <DrawingGroup.Children> <GeometryDrawing Brush="Gray" Geometry="M0,0.1 L0.1,0 1,0.9, 0.9,1Z" /> <GeometryDrawing Brush="Gray" Geometry="M0.9,0 L1,0.1 0.1,1 0,0.9Z" /> <GeometryDrawing Brush="#FFFF00" Geometry="M0.25,0.25 L0.5,0.125 0.75,0.25 0.5,0.5Z" /> <GeometryDrawing Brush="Black" Geometry="M0.25,0.75 L0.5,0.875 0.75,0.75 0.5,0.5Z" /> <GeometryDrawing Brush="#FF0000" Geometry="M0.25,0.75 L0.125,0.5 0.25,0.25 0.5,0.5Z" /> <GeometryDrawing Brush="MediumBlue" Geometry="M0.75,0.25 L0.875,0.5 0.75,0.75 0.5,0.5Z" /> </DrawingGroup.Children> </DrawingGroup> </DrawingBrush.Drawing> </DrawingBrush> </Ellipse.Fill> </Ellipse>
sample (xii) 15.11.2018 vjj 20
15.11.2018 vjj 21 VisualBrush Lze s ním dělat opravdu cokoliv Vybarvuje pomocí objektů typu Visual Button ViewPort3D
15.11.2018 vjj 22 VisualBrush <Canvas Width="400" Height="600" Background="DarkBlue" > <Button Width="400" Height="600" > <Button.Background> <VisualBrush TileMode="FlipX" Viewport="0,0,0.3,0.3"> <VisualBrush.Visual> <StackPanel Background="Orange"> <TextBlock <Rectangle <Image <Button <Ellipse </StackPanel> </VisualBrush.Visual> </VisualBrush> </Button.Background> </Button> </Border>
sample (xiii) 15.11.2018 vjj 23
sample (xiii) <Button> <Canvas Background="LightGray" Margin="10" Width="420" Height="620" > <Canvas.Resources> <Style TargetType="{x:Type Button}"> <Setter Property="FontSize" Value="72" /> <Setter Property="FontWeight" Value="Bold" /> </Style> </Canvas.Resources> <Button Width="400" Height="600" Margin="10" Foreground="Green"> <Button.Background> <VisualBrush > <!-- TileMode="FlipX" Viewport="0,0,0.3,0.5"> --> <VisualBrush.Visual> <StackPanel Background="Orange"> <StackPanel.Resources> <Style TargetType="{x:Type Button}"> <Setter Property="FontSize" Value="12" /> <Setter Property="FontWeight" Value="Normal" /> </Style> <Style TargetType="{x:Type TextBlock}"> <Setter Property="FontWeight" Value="Normal" /> </Style> </StackPanel.Resources> <TextBlock TextAlignment="Center" FontSize="16pt" Margin="2"> Hello, World! </TextBlock> <Rectangle Width="100" Height="5" Fill="Blue" Margin="2" /> <Image Source="C:\Users\vjj\Pictures\Bentley.jpg" Width="100" Height="50" /> <Ellipse Height="40" Width="110" > <Ellipse.Fill> <VisualBrush> <VisualBrush.Visual> <Grid> <Grid.Background> <ImageBrush ImageSource="C:\Users\vjj\Pictures\Bentley.jpg" /> </Grid.Background> <TextBlock Foreground="Red">. </TextBlock> </Grid> 15.11.2018 </VisualBrush.Visual> vjj 24
15.11.2018 vjj 25 Tile TileMode - způsob opakování otisků štětce None Tile FlipX FlipY FlipXY Vieport velikost dlaždice - část oblasti vyplněná jedním otiskem štětce ViewportUnits Relative - default Absolute
15.11.2018 vjj 28