Bonjour, J'ai actuellement cette méthode qui dessine une ligne sur un UIImageView.Ligne de dessin sur un UIImage NOT UIImageView - Xamarin iOS
Cependant j'essaye de le rendre compatible avec un UIImage et n'ai pas eu de chance. This example here fonctionne magnifiquement pour le texte mais pas idéal pour les lignes.
DrawOnUIImageView.cs
private void Draw(Face face, UIImageView imageView)
{
CAShapeLayer boundingBoxLayer = new CAShapeLayer();
boundingBoxLayer.Frame = face.rect;
boundingBoxLayer.FillColor = null;
boundingBoxLayer.StrokeColor = UIColor.Red.CGColor;
imageView.Layer.AddSublayer(boundingBoxLayer);
CAShapeLayer secondBoxLayer = new CAShapeLayer();
secondBoxLayer.FillColor = null;
secondBoxLayer.StrokeColor = UIColor.Green.CGColor;
boundingBoxLayer.AddSublayer(secondBoxLayer);
var path = new CGPath();
List<LandmarkLine> lines = new List<LandmarkLine>();
foreach (var landmark in face.landmarks)
{
List<CGPoint> addTo = new List<CGPoint>();
foreach (var point in landmark.points)
{
addTo.Add(new CGPoint((point.X * face.rect.Width), (1 - point.Y) * face.rect.Height));
}
CGPath outline = new CGPath();
outline.AddLines(addTo.ToArray());
outline.CloseSubpath();
path.AddPath(outline);
}
secondBoxLayer.Path = path;
//imageView.Layer.AddSublayer(outline);
}
Tous les conseils sur ce serait génial. Merci