Hello, I think it is more easy to use " MiniMapGenerator.PathImage", sample:
void RefreshMap(object objs)
{
try
{
var prm =(List<double>) objs;
double zoom = prm[0];
double actualWidth = prm[1];
double actualHeight = prm[2];
lock (_lockShowMap)
{
var landmarksMiniMapCache = GenerateLandmarks(zoom);
var image = new MiniMapGenerator.PathImage(Usefuls.ContinentNameMpq, ObjectManager.ObjectManager.Me.Position, landmarksMiniMapCache, (float)zoom);
image.Generate(actualWidth, actualHeight);
if (image.Result != null)
{
// Save img:
if (!string.IsNullOrWhiteSpace(_saveTo))
{
try
{
image.Result.Save(_saveTo, ImageFormat.Jpeg);
}
catch { }
_saveTo = "";
}
// Show img:
var hbmp = image.Result.GetHbitmap();
try
{
var ret = Imaging.CreateBitmapSourceFromHBitmap(hbmp, IntPtr.Zero, Int32Rect.Empty,
BitmapSizeOptions.FromEmptyOptions());
ret.Freeze();
Dispatcher.Invoke(DispatcherPriority.Background, new Action(() => MapImage.Source = ret));
//Dispatcher.BeginInvoke(
// DispatcherPriority.Send,
// new Action(() => MapImage.Source = null));
//Dispatcher.BeginInvoke(
// DispatcherPriority.Send,
// new Action(() => MapImage.Source = ret));
}
finally
{
DeleteObject(hbmp);
}
}
image.Dispose();
}
}
catch
{
}
}