1
0
Fork 0
mirror of https://github.com/Nioux/AideDeJeu.git synced 2025-10-30 15:06:06 +00:00

SkiaSharp + font

This commit is contained in:
Yan Maniez 2019-05-02 00:11:16 +02:00
parent b981bdd4bc
commit a80d7b26cf
3 changed files with 20 additions and 2 deletions

View file

@ -22,6 +22,7 @@
<None Remove="OGL.txt" />
<None Remove="Pdf\178_hd_01_feuille_de_perso_v1.pdf" />
<None Remove="Pdf\AlverataIrregularPEMedium.ttf" />
<None Remove="Pdf\BLKCHCRY.TTF" />
<None Remove="Pdf\feuille_de_personnage_editable.pdf" />
<None Remove="Pdf\LinLibertine_aBL.ttf" />
<None Remove="Pdf\LinLibertine_aBS.ttf" />
@ -47,6 +48,7 @@
<EmbeddedResource Include="OGL.txt" />
<EmbeddedResource Include="Pdf\178_hd_01_feuille_de_perso_v1.pdf" />
<EmbeddedResource Include="Pdf\AlverataIrregularPEMedium.ttf" />
<EmbeddedResource Include="Pdf\BLKCHCRY.TTF" />
<EmbeddedResource Include="Pdf\feuille_de_personnage_editable.pdf" />
<EmbeddedResource Include="Pdf\LinLibertine_aBL.ttf" />
<EmbeddedResource Include="Pdf\LinLibertine_aBS.ttf" />

Binary file not shown.

View file

@ -41,12 +41,23 @@ namespace AideDeJeu.Views
float sumx = diceRolls.Sum(kv => kv.Value);
float sizey = info.Height / (maxy - miny + 1);
SKTypeface typeface = null;
var inFont = AideDeJeu.Tools.Helpers.GetResourceStream("AideDeJeu.Pdf.LinLibertine_R.ttf");
typeface = SKTypeface.FromStream(inFont);
SKPaint strokePaint = new SKPaint()
{
Color = new SKColor(0x9B, 0x1C, 0x47),
Style = SKPaintStyle.Stroke,
StrokeWidth = 1,
TextSize = sizey * 0.8f,
};
SKPaint strokeFont = new SKPaint()
{
Color = new SKColor(0x9B, 0x1C, 0x47),
Style = SKPaintStyle.Stroke,
StrokeWidth = 1,
TextSize = sizey * 0.6f,
Typeface = typeface
};
canvas.Clear();
foreach (var diceRoll in diceRolls)
@ -54,8 +65,13 @@ namespace AideDeJeu.Views
float x = diceRoll.Value;
float y = diceRoll.Key;
canvas.DrawRect(new SKRect(0, ((y - miny) * sizey), x * info.Width / maxx, ((y - miny) * sizey) + sizey - 5), strokePaint);
canvas.DrawText($"{y} => {x / sumx * 100:0.00}%", 10, ((y - miny) * sizey) + sizey * 0.8f, strokePaint);
}
canvas.DrawText($"{y} => {x / sumx * 100:0.00}%", 10, ((y - miny) * sizey) + sizey * 0.6f, strokeFont);
}
typeface.Dispose();
strokeFont.Dispose();
strokePaint.Dispose();
}
}
}