How to fill a Win10 XAML Polygon with tiles?

可紊 提交于 2019-12-12 05:59:13

问题


I am trying to make XAML Polygon filled with a transformed texture. The code worked well in WPF but in a Windows 10 app there seems to be no TileMode property.

 <Polygon Points="300,200 400,125 400,275" Stroke="Purple" StrokeThickness="2">
        <Polygon.Fill>
            <ImageBrush TileMode="Tile" ImageSource="Assets/StoreLogo.png">
                <ImageBrush.RelativeTransform>
                    <TransformGroup>
                        <ScaleTransform CenterY="0.5" CenterX="0.5" ScaleX="0.2" ScaleY="0.2"/>
                        <SkewTransform CenterY="0.5" CenterX="0.5"/>
                        <RotateTransform CenterY="0.5" CenterX="0.5" Angle="61.928"/>
                        <TranslateTransform/>
                    </TransformGroup>
                </ImageBrush.RelativeTransform>
            </ImageBrush>
        </Polygon.Fill>
    </Polygon> 

回答1:


You can tile using the Win2D library. They have sample code as well; there's a tiling sample under "effects" (EffectsSample.xaml.cs).



来源:https://stackoverflow.com/questions/35574505/how-to-fill-a-win10-xaml-polygon-with-tiles

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!