Пример #1
0
        /// <summary>Draw this object to the canvas using the properties defined in this class.
        ///     </summary>
        /// <remarks>Draw this object to the canvas using the properties defined in this class.
        ///     </remarks>
        /// <param name="canvas">canvas to draw into</param>
        public virtual void draw(android.graphics.Canvas canvas)
        {
            float threshold = 1.0f / 256.0f;

            // contribution less than 1 LSB of RGB byte
            if (mAlpha <= threshold)
            {
                // don't bother if it won't show up
                return;
            }
            canvas.save(android.graphics.Canvas.MATRIX_SAVE_FLAG);
            canvas.translate(mX, mY);
            canvas.scale(mScaleX, mScaleY);
            canvas.translate(-0.5f * getWidth(), -0.5f * getHeight());
            mDrawable.setAlpha((int)Sharpen.Util.Round(mAlpha * 255f));
            mDrawable.draw(canvas);
            canvas.restore();
        }