推荐一款自己编写的一款软件,图集分割软件(绿色、纯净、免费、共享)
因为开发的时候需要将一些图集软件还原成碎图。也找到可以用的,但都不够理想:
texturepack软件成生的图集没有相应的碎图工具,倒是有一些可用的, spine生成的图集本生自带碎图工具,操作麻烦,所以想自己动手写一个可以同时给二个软件碎图的工具.
ImageSplit 是基于wpf 的应用程序,是自己一边学习,顺手完成的作品:
1. 运行缩放,拖动图片
2. 支持spine、 texturepack等工具生成的图集
3. 支持显示碎图区域、名称
4. 绿色、纯净、免费、共享。
5. 软件分享地址:我用夸克网盘分享了「ImgSplitv1.0.0.zip」,点击链接即可保存。打开「夸克APP」,无需下载在线播放视频,畅享原画5倍速,支持电视投屏。
链接:https://pan.quark.cn/s/17bbe4874328
技术实现: 移动、缩放cavas:
<Border x:Name="border" PreviewMouseDown="border_PreviewMouseDown" PreviewMouseMove="border_PreviewMouseMove" PreviewMouseWheel="Border_MouseWheel" ClipToBounds="True" Background="LightCyan"> <Canvas x:Name="canvas" Width="{Binding ActualWidth, ElementName=border, Mode=OneWay}" Height="{Binding ActualHeight, ElementName=border, Mode=OneWay}" > <Image Source="{Binding Path=ImgPah}" ></Image> </Canvas> </Border>
代码实现:
private void Border_MouseWheel(object sender, MouseWheelEventArgs e)
{
System.Windows.Point pt = e.GetPosition(border);
TransformGroup? tg = canvas.RenderTransform as TransformGroup;
if (tg == null) { tg = new TransformGroup(); canvas.RenderTransform = tg; }
double s = ((double)e.Delta) / 1000.0 + 1.0;
tg.Children.Add(new ScaleTransform(s, s, pt.X, pt.Y));
e.Handled = true;
}
System.Windows.Point previousPt;
bool isTranslateStart= false;
private void border_PreviewMouseDown(object sender, MouseButtonEventArgs e)
{
if (e.LeftButton == MouseButtonState.Pressed )
{
previousPt = e.GetPosition(border);
isTranslateStart = true;
}
e.Handled = true;
}
private void border_PreviewMouseMove(object sender, MouseEventArgs e)
{
if(e.LeftButton == MouseButtonState.Pressed && isTranslateStart)
{
System.Windows.Point currentPt = e.GetPosition(border);
Vector v= currentPt - previousPt;
TransformGroup? tg = canvas.RenderTransform as TransformGroup;
if (tg == null) { tg = new TransformGroup(); canvas.RenderTransform = tg; }
tg.Children.Add(new TranslateTransform(v.X,v.Y) );
previousPt = currentPt;
}
e.Handled= true;
}
标签:纯净,碎图,软件,tg,共享,TransformGroup,border,图集
From: https://www.cnblogs.com/abc126655/p/18243320