예제 #1
0
파일: BaseBundle.cs 프로젝트: pirica/FModel
        private new void DrawDisplayName(SKCanvas c)
        {
            if (string.IsNullOrEmpty(DisplayName))
            {
                return;
            }

            _headerPaint.Shader = null;
            _headerPaint.Color  = SKColors.White;
            while (_headerPaint.MeasureText(DisplayName) > Width)
            {
                _headerPaint.TextSize -= 1;
            }

            var shaper     = new CustomSKShaper(_headerPaint.Typeface);
            var shapedText = shaper.Shape(DisplayName, _headerPaint);

            c.DrawShapedText(shaper, DisplayName, (Width - shapedText.Points[^ 1].X) / 2, _headerHeight / 2 + _headerPaint.TextSize / 2 - 10, _headerPaint);
예제 #2
0
        public void DrawHeader(SKCanvas c)
        {
            c.DrawRect(new SKRect(0, 0, Width, Height), _headerPaint);

            _headerPaint.Shader = SKShader.CreateRadialGradient(new SKPoint(Width / 2, _headerHeight / 2), Width / 5 * 4,
                                                                new[] { SKColors.SkyBlue.WithAlpha(50), SKColors.Blue.WithAlpha(50) }, SKShaderTileMode.Clamp);
            c.DrawRect(new SKRect(0, 0, Width, Height), _headerPaint);

            _headerPaint.Shader = SKShader.CreateLinearGradient(new SKPoint(Width / 2, _headerHeight), new SKPoint(Width / 2, 75),
                                                                new[] { SKColors.Black.WithAlpha(25), SKColors.Blue.WithAlpha(0) }, SKShaderTileMode.Clamp);
            c.DrawRect(new SKRect(0, 75, Width, _headerHeight), _headerPaint);

            _headerPaint.Shader = null;
            _headerPaint.Color  = SKColors.White;
            while (_headerPaint.MeasureText(DisplayName) > Width)
            {
                _headerPaint.TextSize -= 1;
            }

            var shaper     = new CustomSKShaper(_headerPaint.Typeface);
            var shapedText = shaper.Shape(DisplayName, _headerPaint);

            c.DrawShapedText(shaper, DisplayName, (Width - shapedText.Points[^ 1].X) / 2, _headerHeight / 2 + _headerPaint.TextSize / 2 - 10, _headerPaint);