forked from AvaloniaUI/Avalonia
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request AvaloniaUI#3378 from AvaloniaUI/feature/drawing-image
Display Drawings in Image control
- Loading branch information
Showing
30 changed files
with
270 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,52 @@ | ||
<UserControl xmlns="https://github.com/avaloniaui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
x:Class="ControlCatalog.Pages.ImagePage"> | ||
<StackPanel Orientation="Vertical" Spacing="4"> | ||
<TextBlock Classes="h1">Image</TextBlock> | ||
<TextBlock Classes="h2">Displays an image</TextBlock> | ||
|
||
<StackPanel Orientation="Horizontal" | ||
Margin="0,16,0,0" | ||
HorizontalAlignment="Center" | ||
Spacing="16"> | ||
<StackPanel Orientation="Vertical"> | ||
<TextBlock>No Stretch</TextBlock> | ||
<Image Source="/Assets/delicate-arch-896885_640.jpg" | ||
Width="100" Height="200" | ||
Stretch="None"/> | ||
</StackPanel> | ||
|
||
<StackPanel Orientation="Vertical"> | ||
<TextBlock>Fill</TextBlock> | ||
<Image Source="/Assets/delicate-arch-896885_640.jpg" | ||
Width="100" Height="200" | ||
Stretch="Fill"/> | ||
</StackPanel> | ||
<DockPanel> | ||
<StackPanel DockPanel.Dock="Top" Orientation="Vertical" Spacing="4"> | ||
<TextBlock Classes="h1">Image</TextBlock> | ||
<TextBlock Classes="h2">Displays an image</TextBlock> | ||
</StackPanel> | ||
|
||
<StackPanel Orientation="Vertical"> | ||
<TextBlock>Uniform</TextBlock> | ||
<Image Source="/Assets/delicate-arch-896885_640.jpg" | ||
Width="100" Height="200" | ||
Stretch="Uniform"/> | ||
</StackPanel> | ||
<Grid ColumnDefinitions="*,*" RowDefinitions="Auto,*" Margin="64"> | ||
|
||
<DockPanel Grid.Column="0" Grid.Row="1" Margin="16"> | ||
<TextBlock DockPanel.Dock="Top" Classes="h3" Margin="0 8">Bitmap</TextBlock> | ||
<ComboBox Name="bitmapStretch" DockPanel.Dock="Top" SelectedIndex="2" SelectionChanged="BitmapStretchChanged"> | ||
<ComboBoxItem>None</ComboBoxItem> | ||
<ComboBoxItem>Fill</ComboBoxItem> | ||
<ComboBoxItem>Uniform</ComboBoxItem> | ||
<ComboBoxItem>UniformToFill</ComboBoxItem> | ||
</ComboBox> | ||
<Image Name="bitmapImage" | ||
Source="/Assets/delicate-arch-896885_640.jpg"/> | ||
</DockPanel> | ||
|
||
<StackPanel Orientation="Vertical"> | ||
<TextBlock>UniformToFill</TextBlock> | ||
<Image Source="/Assets/delicate-arch-896885_640.jpg" | ||
Width="100" Height="200" | ||
Stretch="UniformToFill"/> | ||
</StackPanel> | ||
</StackPanel> | ||
<StackPanel Orientation="Vertical"> | ||
<TextBlock>Window Icon as an Image</TextBlock> | ||
<Image Name="Icon" Width="100" Height="200" Stretch="None" /> | ||
</StackPanel> | ||
</StackPanel> | ||
<DockPanel Grid.Column="1" Grid.Row="1" Margin="16"> | ||
<TextBlock DockPanel.Dock="Top" Classes="h3" Margin="0 8">Drawing</TextBlock> | ||
<ComboBox Name="drawingStretch" DockPanel.Dock="Top" SelectedIndex="2" SelectionChanged="DrawingStretchChanged"> | ||
<ComboBoxItem>None</ComboBoxItem> | ||
<ComboBoxItem>Fill</ComboBoxItem> | ||
<ComboBoxItem>Uniform</ComboBoxItem> | ||
<ComboBoxItem>UniformToFill</ComboBoxItem> | ||
</ComboBox> | ||
<Image Name="drawingImage"> | ||
<Image.Source> | ||
<DrawingImage> | ||
<GeometryDrawing Brush="Red"> | ||
<PathGeometry> | ||
<PathFigure StartPoint="0,0" IsClosed="True"> | ||
<QuadraticBezierSegment Point1="50,0" Point2="50,-50" /> | ||
<QuadraticBezierSegment Point1="100,-50" Point2="100,0" /> | ||
<LineSegment Point="50,0" /> | ||
<LineSegment Point="50,50" /> | ||
</PathFigure> | ||
</PathGeometry> | ||
</GeometryDrawing> | ||
</DrawingImage> | ||
</Image.Source> | ||
</Image> | ||
</DockPanel> | ||
</Grid> | ||
|
||
</DockPanel> | ||
</UserControl> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
namespace Avalonia.Media | ||
using Avalonia.Platform; | ||
|
||
namespace Avalonia.Media | ||
{ | ||
public abstract class Drawing : AvaloniaObject | ||
{ | ||
public abstract void Draw(DrawingContext context); | ||
|
||
public abstract Rect GetBounds(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.