public void SyncStroke(InkStrokeContainer containner,double currentCanvasWidth,bool syncAll = true, InkStroke stroke = null)
{
lock(locker)
{
try
{
if (syncAll)
{
Strokes.Clear();
foreach (var item in containner.GetStrokes())
{
InkStroke strokeClone = item.Clone();
strokeClone.PointTransform = System.Numerics.Matrix3x2.CreateScale((float)(currentCanvasWidth / originalCanvasWidth));
Strokes.Add(strokeClone);
}
}
else
{
if (null != stroke)
{
InkStroke strokeClone = stroke.Clone();
strokeClone.PointTransform = System.Numerics.Matrix3x2.CreateScale((float)(currentCanvasWidth / originalCanvasWidth));
Strokes.Add(strokeClone);
}
else
{
containner.Clear();
foreach (var item in Strokes)
{
InkStroke strokeClone = item.Clone();
strokeClone.PointTransform = System.Numerics.Matrix3x2.CreateScale((float)(currentCanvasWidth / originalCanvasWidth));
containner.AddStroke(strokeClone);
}
}
}
}
catch(Exception e)
{
#if DEBUG
System.Diagnostics.Debug.WriteLine(e.Message);
#endif
}
}
}