public static void Draw(SKCanvas canvas, IViewport viewport, IStyle style, IFeature feature, IDictionary <object, SKBitmapInfo> skBitmapCache, long currentIteration) { try { var raster = (IRaster)feature.Geometry; SKBitmapInfo textureInfo; if (!skBitmapCache.Keys.Contains(raster)) { textureInfo = BitmapHelper.LoadTexture(raster.Data); skBitmapCache[raster] = textureInfo; } else { textureInfo = skBitmapCache[raster]; } textureInfo.IterationUsed = currentIteration; skBitmapCache[raster] = textureInfo; var destination = WorldToScreen(viewport, feature.Geometry.GetBoundingBox()); BitmapHelper.RenderRaster(canvas, textureInfo.Bitmap, RoundToPixel(destination).ToSkia()); } catch (Exception ex) { Logger.Log(LogLevel.Error, ex.Message, ex); } }
public static void Draw(SKCanvas canvas, IViewport viewport, IStyle style, IFeature feature, float opacity, IDictionary <object, BitmapInfo> tileCache, long currentIteration) { try { var raster = (IRaster)feature.Geometry; BitmapInfo bitmapInfo; if (!tileCache.Keys.Contains(raster)) { bitmapInfo = BitmapHelper.LoadBitmap(raster.Data); tileCache[raster] = bitmapInfo; } else { bitmapInfo = tileCache[raster]; } bitmapInfo.IterationUsed = currentIteration; tileCache[raster] = bitmapInfo; var boundingBox = feature.Geometry.GetBoundingBox(); if (viewport.IsRotated) { var priorMatrix = canvas.TotalMatrix; var matrix = CreateRotationMatrix(viewport, boundingBox, priorMatrix); canvas.SetMatrix(matrix); var destination = new BoundingBox(0.0, 0.0, boundingBox.Width, boundingBox.Height); BitmapHelper.RenderRaster(canvas, bitmapInfo.Bitmap, destination.ToSkia(), opacity); canvas.SetMatrix(priorMatrix); } else { var destination = WorldToScreen(viewport, feature.Geometry.GetBoundingBox()); BitmapHelper.RenderRaster(canvas, bitmapInfo.Bitmap, RoundToPixel(destination).ToSkia(), opacity); } } catch (Exception ex) { Logger.Log(LogLevel.Error, ex.Message, ex); } }