1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| Image fondGraph = new Bitmap(MapEnCour.Largeur * 32, MapEnCour.Hauteur * 32);
Image tmp;
Graphics graphApercut = Graphics.FromImage(fondGraph);
for (int x = 0; x < MapEnCour.Largeur; x++)
for (int y = 0; y < MapEnCour.Hauteur; y++)
foreach (Epaisseur e in epaisseurs)
{
tmp = CommunStandardMethodes.BitmapSourceToImage(e.GetCellBitmapSource(x, y));
graphApercut.DrawImageUnscaled(tmp, (x * tmp.Width), (y * tmp.Height), tmp.Width, tmp.Height);
}
graphApercut.Save();
MemoryStream ms = new MemoryStream();
fondGraph.Save(ms, ImageFormat.Png);
System.Windows.Media.Imaging.BitmapImage apercutMap = new System.Windows.Media.Imaging.BitmapImage();
apercutMap.BeginInit();
apercutMap.StreamSource = ms;
apercutMap.EndInit();
imgApercuMap.Source = apercutMap; |