Пример #1
0
        protected override void OnBoundsChange(Rect bounds)
        {
            base.OnBoundsChange(bounds);
            mRect.Set(margin, margin, bounds.Width() - margin, bounds.Height() - margin);

            if (useGradientOverlay)
            {
                var            colors   = new int[] { 0, 0, 0x7f000000 };
                var            pos      = new float[] { 0.0f, 0.7f, 1.0f };
                RadialGradient vignette = new RadialGradient(mRect.CenterX(),
                                                             mRect.CenterY() * 1.0f / 0.7f,
                                                             mRect.CenterX() * 1.3f,
                                                             colors,
                                                             pos, Shader.TileMode.Clamp);

                Matrix oval = new Matrix();
                oval.SetScale(1.0f, 0.7f);
                vignette.SetLocalMatrix(oval);

                paint.SetShader(new ComposeShader(bitmapShader, vignette, PorterDuff.Mode.SrcOver));
            }
        }