LoadTexture() публичный статический Метод

public static LoadTexture ( Stream bitmapStream ) : SKBitmapInfo
bitmapStream System.IO.Stream
Результат SKBitmapInfo
Пример #1
0
        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);
            }
        }
Пример #2
0
        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);
        }