开发者

Can XAML be used to copy areas of other images?

开发者 https://www.devze.com 2023-03-23 09:17 出处:网络
I\'m looking to us开发者_高级运维e xaml as a way to access spritesheet. Is xaml capable of referencing a png file and displaying just a portion of that file?You should be able to use the following (w

I'm looking to us开发者_高级运维e xaml as a way to access spritesheet.

Is xaml capable of referencing a png file and displaying just a portion of that file?


You should be able to use the following (where you change the composite transform attributes for the sprite offset):

<Rectangle x:Name="R" Width="20" Height="20" >
 <Rectangle.Fill>
  <ImageBrush ImageSource="Spritesheet.png" Stretch="None" AlignmentX="Left" AlignmentY="Top" >
   <ImageBrush.Transform>
    <CompositeTransform TranslateX="-20" TranslateY="-20"/>
   </ImageBrush.Transform>
  </ImageBrush>
 </Rectangle.Fill>
</Rectangle>
0

精彩评论

暂无评论...
验证码 换一张
取 消