DrawingPage.xaml 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. <UserControl
  2. xmlns="https://github.com/avaloniaui"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. x:Class="RenderDemo.Pages.DrawingPage">
  5. <UserControl.Styles>
  6. <Style>
  7. <Style.Resources>
  8. <DrawingGroup x:Key="Bulb">
  9. <DrawingGroup.Transform>
  10. <MatrixTransform Matrix="1,0,0,1,0,-1028.4" />
  11. </DrawingGroup.Transform>
  12. <DrawingGroup>
  13. <DrawingGroup.Transform>
  14. <MatrixTransform Matrix="1,0,0,1.25,-10,1031.4" />
  15. </DrawingGroup.Transform>
  16. <GeometryDrawing Brush="#FF7F8C8D"
  17. Geometry="F1 M24,14 A2,2,0,1,1,20,14 A2,2,0,1,1,24,14 z" />
  18. </DrawingGroup>
  19. <GeometryDrawing Brush="#FFF39C12"
  20. Geometry="F1 M12,1030.4 C8.134,1030.4 5,1033.6 5,1037.6 5,1040.7 8.125,1043.5 9,1045.4 9.875,1047.2 9,1050.4 9,1050.4 L12,1049.9 15,1050.4 C15,1050.4 14.125,1047.2 15,1045.4 15.875,1043.5 19,1040.7 19,1037.6 19,1033.6 15.866,1030.4 12,1030.4 z" />
  21. <GeometryDrawing Brush="#FFF1C40F"
  22. Geometry="F1 M12,1030.4 C15.866,1030.4 19,1033.6 19,1037.6 19,1040.7 15.875,1043.5 15,1045.4 14.125,1047.2 15,1050.4 15,1050.4 L12,1049.9 12,1030.4 z" />
  23. <GeometryDrawing Brush="#FFE67E22"
  24. Geometry="F1 M9,1036.4 L8,1037.4 12,1049.4 16,1037.4 15,1036.4 14,1037.4 13,1036.4 12,1037.4 11,1036.4 10,1037.4 9,1036.4 z M9,1037.4 L10,1038.4 10.5,1037.9 11,1037.4 11.5,1037.9 12,1038.4 12.5,1037.9 13,1037.4 13.5,1037.9 14,1038.4 15,1037.4 15.438,1037.8 12,1048.1 8.5625,1037.8 9,1037.4 z" />
  25. <DrawingGroup>
  26. <DrawingGroup.Transform>
  27. <MatrixTransform Matrix="1,0,0,1,9,1045.4" />
  28. </DrawingGroup.Transform>
  29. <GeometryDrawing Brush="#FFBDC3C7">
  30. <GeometryDrawing.Geometry>
  31. <RectangleGeometry Rect="0,0,6,5" />
  32. </GeometryDrawing.Geometry>
  33. </GeometryDrawing>
  34. </DrawingGroup>
  35. <GeometryDrawing Brush="#FF95A5A6"
  36. Geometry="F1 M9,1045.4 L9,1050.4 12,1050.4 12,1049.4 15,1049.4 15,1048.4 12,1048.4 12,1047.4 15,1047.4 15,1046.4 12,1046.4 12,1045.4 9,1045.4 z" />
  37. <GeometryDrawing Brush="#FF7F8C8D"
  38. Geometry="F1 M9,1046.4 L9,1047.4 12,1047.4 12,1046.4 9,1046.4 z M9,1048.4 L9,1049.4 12,1049.4 12,1048.4 9,1048.4 z" />
  39. </DrawingGroup>
  40. </Style.Resources>
  41. </Style>
  42. </UserControl.Styles>
  43. <Grid RowDefinitions="Auto,Auto,Auto"
  44. ColumnDefinitions="Auto,Auto,Auto,Auto">
  45. <TextBlock Text="None"
  46. Margin="3" />
  47. <Border Grid.Column="0"
  48. Grid.Row="1"
  49. VerticalAlignment="Top"
  50. HorizontalAlignment="Left"
  51. BorderThickness="1"
  52. BorderBrush="Gray"
  53. Margin="5">
  54. <Image>
  55. <Image.Source>
  56. <DrawingImage Drawing="{DynamicResource Bulb}" />
  57. </Image.Source>
  58. </Image>
  59. </Border>
  60. <TextBlock Text="Fill"
  61. Margin="3"
  62. Grid.Column="1" />
  63. <Border Grid.Column="1"
  64. Grid.Row="1"
  65. VerticalAlignment="Top"
  66. HorizontalAlignment="Left"
  67. BorderThickness="1"
  68. BorderBrush="Gray"
  69. Margin="5">
  70. <Image Width="100" Height="50" Stretch="Fill">
  71. <Image.Source>
  72. <DrawingImage Drawing="{DynamicResource Bulb}" />
  73. </Image.Source>
  74. </Image>
  75. </Border>
  76. <TextBlock Text="Uniform"
  77. Margin="3"
  78. Grid.Column="2" />
  79. <Border Grid.Column="2"
  80. Grid.Row="1"
  81. VerticalAlignment="Top"
  82. HorizontalAlignment="Left"
  83. BorderThickness="1"
  84. BorderBrush="Gray"
  85. Margin="5">
  86. <Image Width="100" Height="50" Stretch="Uniform">
  87. <Image.Source>
  88. <DrawingImage Drawing="{DynamicResource Bulb}" />
  89. </Image.Source>
  90. </Image>
  91. </Border>
  92. <TextBlock Text="UniformToFill"
  93. Margin="3"
  94. Grid.Column="3" />
  95. <Border Grid.Column="3"
  96. Grid.Row="1"
  97. VerticalAlignment="Top"
  98. HorizontalAlignment="Left"
  99. BorderThickness="1"
  100. BorderBrush="Gray"
  101. Margin="5">
  102. <Image Width="100" Height="50" Stretch="UniformToFill">
  103. <Image.Source>
  104. <DrawingImage Drawing="{DynamicResource Bulb}" />
  105. </Image.Source>
  106. </Image>
  107. </Border>
  108. <!-- For comparison -->
  109. <Ellipse Grid.Row="2"
  110. Grid.Column="0"
  111. Width="100"
  112. Height="50"
  113. Stretch="None"
  114. Fill="Blue"
  115. Margin="5"/>
  116. <Ellipse Grid.Row="2"
  117. Grid.Column="1"
  118. Width="100"
  119. Height="50"
  120. Stretch="Fill"
  121. Fill="Blue"
  122. Margin="5" />
  123. <Ellipse Grid.Row="2"
  124. Grid.Column="2"
  125. Width="100"
  126. Height="50"
  127. Stretch="Uniform"
  128. Fill="Blue"
  129. Margin="5" />
  130. <Ellipse Grid.Row="2"
  131. Grid.Column="3"
  132. Width="100"
  133. Height="50"
  134. Stretch="UniformToFill"
  135. Fill="Blue"
  136. Margin="5" />
  137. </Grid>
  138. </UserControl>