Exemple #1
0
        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);
        }
Exemple #2
0
        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);
        }