public static RenderTexture ( |
||
canvas | ||
bitmap | ||
rect | ||
opacity | float | |
Результат | void |
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.RenderTexture(canvas, textureInfo.Bitmap, RoundToPixel(destination).ToSkia()); } catch (Exception ex) { Trace.WriteLine(ex.Message); } }
public static void Draw(SKCanvas canvas, LabelStyle style, string text, float x, float y) { var key = text + "_" + style.Font.FontFamily + "_" + style.Font.Size + "_" + (float)style.Font.Size + "_" + style.BackColor + "_" + style.ForeColor; if (!LabelBitmapCache.Keys.Contains(key)) { LabelBitmapCache[key] = new SKBitmapInfo { Bitmap = PlatformLabelBitmap.Create(style, text) }; } var info = LabelBitmapCache[key]; BitmapHelper.RenderTexture(canvas, info.Bitmap, x, y, offsetX: (float)style.Offset.X, offsetY: (float)style.Offset.Y, horizontalAlignment: style.HorizontalAlignment, verticalAlignment: style.VerticalAlignment); }
public static void DrawAsBitmap(SKCanvas canvas, LabelStyle style, IFeature feature, float x, float y) { var text = style.GetLabelText(feature); var key = text + "_" + style.Font.FontFamily + "_" + style.Font.Size + "_" + (float)style.Font.Size + "_" + style.BackColor + "_" + style.ForeColor; if (!LabelBitmapCache.Keys.Contains(key)) { LabelBitmapCache[key] = new SKBitmapInfo { Bitmap = CreateLabelAsBitmap(style, text) } } ; var info = LabelBitmapCache[key]; BitmapHelper.RenderTexture(canvas, info.Bitmap, (int)Math.Round(x), (int)Math.Round(y), offsetX: (float)style.Offset.X, offsetY: (float)-style.Offset.Y, horizontalAlignment: style.HorizontalAlignment, verticalAlignment: style.VerticalAlignment); }
private static void DrawPointWithBitmapStyle(SKCanvas canvas, SymbolStyle symbolStyle, Point destination, IDictionary <int, SKBitmapInfo> symbolBitmapCache) { var stream = BitmapRegistry.Instance.Get(symbolStyle.BitmapId); stream.Position = 0; SKBitmapInfo textureInfo; if (!symbolBitmapCache.Keys.Contains(symbolStyle.BitmapId)) { textureInfo = BitmapHelper.LoadTexture(BitmapRegistry.Instance.Get(symbolStyle.BitmapId)); symbolBitmapCache[symbolStyle.BitmapId] = textureInfo; } else { textureInfo = symbolBitmapCache[symbolStyle.BitmapId]; } BitmapHelper.RenderTexture(canvas, textureInfo.Bitmap, (float)destination.X, (float)destination.Y, (float)symbolStyle.SymbolRotation, (float)symbolStyle.SymbolOffset.X, (float)symbolStyle.SymbolOffset.Y, opacity: (float)symbolStyle.Opacity, scale: (float)symbolStyle.SymbolScale); }