当前位置: 首页>>代码示例>>C#>>正文


C# Paint.SetShadowLayer方法代码示例

本文整理汇总了C#中Android.Graphics.Paint.SetShadowLayer方法的典型用法代码示例。如果您正苦于以下问题:C# Paint.SetShadowLayer方法的具体用法?C# Paint.SetShadowLayer怎么用?C# Paint.SetShadowLayer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Android.Graphics.Paint的用法示例。


在下文中一共展示了Paint.SetShadowLayer方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetBitmapMarker

        public Bitmap GetBitmapMarker(Context mContext, int resourceId, string text)
        {
            Resources resources = mContext.Resources;
            float scale = resources.DisplayMetrics.Density;
            Bitmap bitmap = BitmapFactory.DecodeResource(resources, resourceId);

            Bitmap.Config bitmapConfig = bitmap.GetConfig();

            // set default bitmap config if none
            if (bitmapConfig == null)
                bitmapConfig = Bitmap.Config.Argb8888;

            bitmap = bitmap.Copy(bitmapConfig, true);

            Canvas canvas = new Canvas(bitmap);
            Paint paint = new Paint(PaintFlags.AntiAlias);
            paint.Color = global::Android.Graphics.Color.Black;
            paint.TextSize = ((int)(14 * scale));
            paint.SetShadowLayer(1f, 0f, 1f, global::Android.Graphics.Color.White);

            // draw text to the Canvas center
            Rect bounds = new Rect();
            paint.GetTextBounds(text, 0, text.Length, bounds);
            int x = (bitmap.Width - bounds.Width()) / 2;
            int y = (bitmap.Height + bounds.Height()) / 2 - 20;

            canvas.DrawText(text, x, y, paint);

            return bitmap;
        }
开发者ID:sgraphics,项目名称:BindableMapTest,代码行数:30,代码来源:ExtendedMapRenderer.cs

示例2: TextDrawable

        public TextDrawable(String text, Context ctx)
        {
            _text = text;

            if (_iconFont == null)
                _iconFont = Typeface.CreateFromAsset(ctx.Assets, "fontawesome-webfont.ttf");

            _paint = new Paint {Color = (Color.White), TextSize = 22f, AntiAlias = true};
            //_paint.SetTypeface(_iconFont);
            _paint.SetShadowLayer(6f, 0, 0, Color.Black);
            _paint.SetStyle(Paint.Style.Fill);
            _paint.TextAlign = Paint.Align.Left;
        }
开发者ID:pythe,项目名称:wristpass,代码行数:13,代码来源:TextDrawable.cs

示例3: CreateAnimationDrawer

        public CreateAnimationDrawer(Context c, BrushItem brush, Canvas canvas, Bitmap myBmp, bool tooAdd = false, int cell = 1, string DrawerState = "brush_selection", Path pathToUse = null)
            : base(c)
        {
            myBitmap = myBmp;
            myCanvas = canvas;
            DrawerStateInternal = DrawerState;
            addOnly = tooAdd;
            status = 0;
            myPath = new Path();
            myPaint = new Paint(PaintFlags.Dither);
            myPaint.AntiAlias = true;
            myPaint.Dither = true;
            myPaint.SetStyle(Paint.Style.Stroke);
            myPaint.StrokeJoin = Paint.Join.Round;
            myPaint.StrokeWidth = brush.Thickness;
            myPaint.StrokeCap = Paint.Cap.Round;
            myPaint.SetARGB(colorUtil.a, colorUtil.r, colorUtil.g, colorUtil.b);

            if (brush.BrushType == AnimationTypesBrushType.Spray)
                myPaint.SetShadowLayer(brush.Thickness, 0, 0, ImageHelper.convWZColorToColor(brush.BrushColor));

            if (DrawerState == "brush_selection")
            {
                if (pathToUse != null)
                {
                    myBoundsPaint = new Paint();
                    myBoundsPaint = new Paint(PaintFlags.Dither);
                    myBoundsPaint.AntiAlias = true;
                    myBoundsPaint.Dither = true;
                    myBoundsPaint.SetStyle(Paint.Style.Stroke);
                    myBoundsPaint.StrokeJoin = Paint.Join.Round;
                    myBoundsPaint.StrokeWidth = 10f;
                    myBoundsPaint.StrokeCap = Paint.Cap.Round;
                    myBoundsPaint.SetARGB(255, 0, 0, 0);
                    myBoundsPaint.SetPathEffect(new DashPathEffect(new float[]
                    {
                        10f,
                        20f
                    }, 0));

                    myPath = pathToUse;
                    AnimationUtil.theCanvas.DrawPath(myPath, myPaint);
                    AnimationUtil.theCanvas.DrawPath(myPath, myPaint);

                    myBoundsRect = new RectF();
                    myPath.ComputeBounds(myBoundsRect, true);
                    AnimationUtil.theCanvas.DrawRect(myBoundsRect, myBoundsPaint);
                }
            }
        }
开发者ID:chimpinano,项目名称:WowZapp-Android,代码行数:50,代码来源:CreateAnimationDrawer.cs

示例4: Init

        private void Init(Color fabColor)
        {
            SetWillNotDraw(false);
            SetLayerType(LayerType.Software, null);
            _buttonPaint = new Paint(PaintFlags.AntiAlias) {Color = fabColor};
            _buttonPaint.SetStyle(Paint.Style.Fill);
            _buttonPaint.SetShadowLayer(10.0f, 0.0f, 3.5f, Color.Argb(100, 0, 0, 0));
            _drawablePaint = new Paint(PaintFlags.AntiAlias);
            Invalidate();

            var windowManager = Context.GetSystemService(Context.WindowService).JavaCast<IWindowManager>();
            var display = windowManager.DefaultDisplay;
            var size = new Point();
            display.GetSize(size);
            _screenHeight = size.Y;
        }
开发者ID:asanyaga,项目名称:BuildTest,代码行数:16,代码来源:Fab.cs


注:本文中的Android.Graphics.Paint.SetShadowLayer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。