Example usage for android.graphics Canvas translate

List of usage examples for android.graphics Canvas translate

Introduction

In this page you can find the example usage for android.graphics Canvas translate.

Prototype

public void translate(float dx, float dy) 

Source Link

Document

Preconcat the current matrix with the specified translation

Usage

From source file:com.acbelter.scheduleview.ScheduleView.java

private void drawEdgeEffects(Canvas canvas) {
    boolean needsInvalidate = false;

    final int overScrollMode = ViewCompat.getOverScrollMode(this);
    if (overScrollMode == ViewCompat.OVER_SCROLL_ALWAYS
            || overScrollMode == ViewCompat.OVER_SCROLL_IF_CONTENT_SCROLLS) {
        if (!mTopEdgeEffect.isFinished()) {
            int saveCount = canvas.save();
            int width = mViewWidth - getPaddingLeft() - getPaddingRight();
            int height = mViewHeight - getPaddingTop() - getPaddingBottom();

            canvas.translate(0, getPaddingTop());

            mTopEdgeEffect.setSize(width, height);
            needsInvalidate |= mTopEdgeEffect.draw(canvas);
            canvas.restoreToCount(saveCount);
        }//from  w w  w  .j a va2 s  . co m
        if (!mBottomEdgeEffect.isFinished()) {
            int saveCount = canvas.save();
            int width = mViewWidth - getPaddingLeft() - getPaddingRight();
            int height = mViewHeight - getPaddingTop() - getPaddingBottom();

            canvas.translate(mViewWidth, mViewHeight - getPaddingBottom());
            canvas.rotate(180);

            mBottomEdgeEffect.setSize(width, height);
            needsInvalidate |= mBottomEdgeEffect.draw(canvas);
            canvas.restoreToCount(saveCount);
        }
    } else {
        mTopEdgeEffect.finish();
        mBottomEdgeEffect.finish();
    }

    if (needsInvalidate) {
        ViewCompat.postInvalidateOnAnimation(this);
    }
}

From source file:com.h6ah4i.android.materialshadowninepatch.MaterialShadowContainerView.java

@Override
protected void onDraw(Canvas canvas) {
    super.onDraw(canvas);

    if ((getChildCount() > 0) && (getChildAt(0).getVisibility() == View.VISIBLE)) {
        if (mUseAmbientShadow) {
            if (mCurrentAmbientShadowDrawable1 != null) {
                mCurrentAmbientShadowDrawable1.draw(canvas);
            }//from   ww  w.j  a  v a  2s . com
            if (mCurrentAmbientShadowDrawable2 != null) {
                mCurrentAmbientShadowDrawable2.draw(canvas);
            }
        }

        if (mUseSpotShadow && (mCurrentSpotShadowDrawable1 != null || mCurrentSpotShadowDrawable2 != null)) {
            final int savedCount = canvas.save(Canvas.MATRIX_SAVE_FLAG);

            canvas.translate(mSpotShadowTranslationX, mSpotShadowTranslationY);

            if (mCurrentSpotShadowDrawable1 != null) {
                mCurrentSpotShadowDrawable1.draw(canvas);
            }

            if (mCurrentSpotShadowDrawable2 != null) {
                mCurrentSpotShadowDrawable2.draw(canvas);
            }

            canvas.restoreToCount(savedCount);
        }
    }
}

From source file:com.dongdong.wheel.WheelView.java

@Override
protected void onDraw(Canvas canvas) {
    super.onDraw(canvas);

    if (mItemsLayout == null) {
        if (mItemsWidth == 0) {
            calculateLayoutWidth(getWidth(), MeasureSpec.EXACTLY);
        } else {/*from  w w  w  .ja  v  a 2  s  .co m*/
            createLayouts(mItemsWidth, mLabelWidth);
        }
    }

    if (mItemsWidth > 0) {
        canvas.save();
        // Skip padding space and hide a part of top and bottom items
        canvas.translate(PADDING, -ITEM_OFFSET);
        drawItems(canvas);
        drawValue(canvas);
        canvas.restore();
    }

    drawCenterRect(canvas);
    drawShadows(canvas);
}

From source file:am.widget.tabstrip.HorizontalLinearTabStripLayout.java

@Override
protected void onDraw(Canvas canvas) {
    super.onDraw(canvas);
    final int count = getChildCount();
    if (mCenter == null && !isShowingDividers() && count <= 0)
        return;/*w  ww .java  2  s. co m*/
    final int paddingStart = ViewCompat.getPaddingStart(this);
    final int paddingTop = getPaddingTop();
    final int paddingBottom = getPaddingBottom();
    final int childWidth = mChildWidth;
    final boolean show = isShowingDividers();
    final Drawable dd = mDivider;
    final int divider = show ? dd.getIntrinsicWidth() : 0;
    final int padding = mDividerPadding;
    int start = paddingStart;
    if (show)
        dd.setBounds(1, paddingTop + padding, divider + 1, getHeight() - paddingBottom - padding);
    if (count == 1) {
        if (show && (mShowDividers & SHOW_DIVIDER_BEGINNING) == SHOW_DIVIDER_BEGINNING) {
            canvas.save();
            canvas.translate(start, 0);
            dd.draw(canvas);
            canvas.restore();
            start += divider;
        }
        start += childWidth;
        if (show && (mShowDividers & SHOW_DIVIDER_END) == SHOW_DIVIDER_END) {
            canvas.save();
            canvas.translate(start, 0);
            dd.draw(canvas);
            canvas.restore();
        }
    } else {
        final boolean middle = (mShowDividers & SHOW_DIVIDER_MIDDLE) == SHOW_DIVIDER_MIDDLE;
        for (int i = 0; i < count; i++) {
            if (i == 0) {
                if (show && (mShowDividers & SHOW_DIVIDER_BEGINNING) == SHOW_DIVIDER_BEGINNING) {
                    canvas.save();
                    canvas.translate(start, 0);
                    dd.draw(canvas);
                    canvas.restore();
                    start += divider;
                }
                start += childWidth;
            } else if (i == count - 1) {
                if (show && middle) {
                    canvas.save();
                    canvas.translate(start, 0);
                    dd.draw(canvas);
                    canvas.restore();
                    start += divider;
                }
                start += childWidth;
                if (show && (mShowDividers & SHOW_DIVIDER_END) == SHOW_DIVIDER_END) {
                    start = getWidth() - ViewCompat.getPaddingEnd(this) - divider;
                    canvas.save();
                    canvas.translate(start, 0);
                    dd.draw(canvas);
                    canvas.restore();
                    break;
                }
            } else {
                if (count % 2 == 0 && count / 2 == i && mCenter != null) {
                    if (show && middle && mCenterAsItem) {
                        canvas.save();
                        canvas.translate(start, 0);
                        dd.draw(canvas);
                        canvas.restore();
                        start += divider;
                    }
                    final Drawable center = mCenter;
                    final int p = mCenterPadding;
                    center.setBounds(0, paddingTop + p, center.getIntrinsicWidth(),
                            getHeight() - paddingBottom - p);
                    canvas.save();
                    canvas.translate(start, 0);
                    center.draw(canvas);
                    canvas.restore();
                    start += center.getIntrinsicWidth();
                    if (show && middle && mCenterAsItem) {
                        canvas.save();
                        canvas.translate(start, 0);
                        dd.draw(canvas);
                        canvas.restore();
                        start += divider;
                    }
                } else {
                    if (show && middle) {
                        canvas.save();
                        canvas.translate(start, 0);
                        dd.draw(canvas);
                        canvas.restore();
                        start += divider;
                    }
                }
                start += childWidth;
            }
        }
    }
}

From source file:com.cssweb.android.view.PriceMini.java

public void drawHKIndex(Canvas canvas) {
    Paint paint = this.mPaint;
    paint.setTypeface(Typeface.DEFAULT_BOLD);
    paint.setAntiAlias(true);/*  w  w  w  . j a  v  a 2  s.  c  om*/
    if (quoteData != null) {
        try {
            JSONArray jArr = quoteData.getJSONArray("data");
            JSONObject jo = jArr.getJSONObject(0);
            double zrsp = jo.getDouble("zrsp");

            double zjcj = jo.getDouble("zjcj");
            paint.setTextSize(mTextSize * 2);
            setColor(paint, zjcj, zrsp);
            paint.setTextAlign(Paint.Align.LEFT);
            canvas.translate(DX * 0.5f, DY * 2f);
            canvas.drawText(Utils.dataFormation(zjcj, stockdigit), x, y, paint);

            paint.setStyle(Paint.Style.STROKE);
            paint.setTextSize(mTextSize);

            double zhangd = jo.getDouble("zd");
            if (zhangd < 0) {
                paint.setColor(GlobalColor.colorPriceDown);
            } else if (zhangd > 0) {
                paint.setColor(GlobalColor.colorpriceUp);
            } else {
                paint.setColor(GlobalColor.colorPriceEqual);
            }
            canvas.translate(0, DY * 0.8f);
            String zhangdie = Utils.dataFormation(zhangd, stockdigit);
            if (zhangdie.equals("-"))
                canvas.drawText("", x, y, paint);
            else
                canvas.drawText(zhangdie, x, y, paint);

            double zhangf = jo.getDouble("zf");
            if (zhangf < 0) {
                paint.setColor(GlobalColor.colorPriceDown);
            } else if (zhangf > 0) {
                paint.setColor(GlobalColor.colorpriceUp);
            } else {
                paint.setColor(GlobalColor.colorPriceEqual);
            }
            canvas.translate(DX * 3.5f, 0);
            String zhangfu = Utils.dataFormation(zhangf * 100, stockdigit);
            if (zhangfu.equals("-"))
                canvas.drawText("", x, y, paint);
            else
                canvas.drawText(zhangfu + "%", x, y, paint);

            paint.setColor(GlobalColor.colorLabelName);

            canvas.translate(-DX * 4f, DY * 1.2f);
            canvas.drawText("", x, y, paint);
            canvas.translate(0, DY);
            canvas.drawText("??", x, y, paint);

            canvas.translate(width / 2, -DY * 1);
            paint.setTextAlign(Paint.Align.RIGHT);
            paint.setColor(GlobalColor.colorLabelName);
            canvas.drawText(Utils.dataFormation(zrsp, stockdigit), x - tips, y, paint);

            paint.setColor(GlobalColor.colorStockName);
            canvas.translate(0, DY);
            canvas.drawText(Utils.getAmountFormat(jo.getDouble("cjje"), true), x - tips, y, paint);

            paint.setColor(GlobalColor.colorLabelName);
            paint.setTextAlign(Paint.Align.LEFT);
            canvas.translate(0, -DY * 4);
            canvas.drawText("", x, y, paint);
            canvas.translate(0, DY);
            canvas.drawText("", x, y, paint);
            canvas.translate(0, DY);
            canvas.drawText("", x, y, paint);
            canvas.translate(0, DY);
            canvas.drawText("", x, y, paint);

            paint.setTextAlign(Paint.Align.RIGHT);
            canvas.translate(width / 2, -DY * 3);
            double jrkp = jo.getDouble("jrkp");
            setColor(paint, jrkp, zrsp);
            canvas.drawText(Utils.dataFormation(jrkp, stockdigit), x - tips, y, paint);

            canvas.translate(0, DY);
            double zg = jo.getDouble("zgcj");
            setColor(paint, zg, zrsp);
            canvas.drawText(Utils.dataFormation(zg, stockdigit), x - tips, y, paint);

            canvas.translate(0, DY);
            double zd = jo.getDouble("zdcj");
            setColor(paint, zd, zrsp);
            canvas.drawText(Utils.dataFormation(zd, stockdigit), x - tips, y, paint);

            paint.setColor(GlobalColor.colorStockName);
            canvas.translate(0, DY);
            canvas.drawText(Utils.dataFormation(jo.getDouble("amp") * 100, 1) + "%", x - tips, y, paint);
        } catch (JSONException e) {
            Log.e(TAG, e.toString());
        }
    } else {//?????
        paint.setTextAlign(Paint.Align.LEFT);
        paint.setColor(GlobalColor.colorLabelName);

        canvas.translate(DX, DY * 2f);
        canvas.drawText("-", x, y, paint);

        paint.setStyle(Paint.Style.STROKE);
        paint.setTextSize(mTextSize);

        canvas.translate(-DX / 2, DY * 0.8f);
        canvas.drawText("-", x, y, paint);

        canvas.translate(DX * 2.5f, 0);
        canvas.drawText("-", x, y, paint);
        canvas.translate(-DX * 3, DY * 1.2f);
        canvas.drawText("", x, y, paint);
        canvas.translate(0, DY);
        canvas.drawText("??", x, y, paint);

        paint.setTextAlign(Paint.Align.LEFT);
        canvas.translate(width / 2, -DY * 4);
        canvas.drawText("", x, y, paint);
        canvas.translate(0, DY);
        canvas.drawText("", x, y, paint);
        canvas.translate(0, DY);
        canvas.drawText("", x, y, paint);
        canvas.translate(0, DY);
        canvas.drawText("", x, y, paint);
    }
}

From source file:org.telegram.ui.ChannelCreateActivity.java

private ChipSpan createAndPutChipForUser(TLRPC.User user) {
    try {//ww w  .j  ava  2s  . c  om
        LayoutInflater lf = (LayoutInflater) ApplicationLoader.applicationContext
                .getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
        View textView = lf.inflate(R.layout.group_create_bubble, null);
        TextView text = (TextView) textView.findViewById(R.id.bubble_text_view);
        String name = UserObject.getUserName(user);
        if (name.length() == 0 && user.phone != null && user.phone.length() != 0) {
            name = PhoneFormat.getInstance().format("+" + user.phone);
        }
        text.setText(name + ", ");

        int spec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
        textView.measure(spec, spec);
        textView.layout(0, 0, textView.getMeasuredWidth(), textView.getMeasuredHeight());
        Bitmap b = Bitmap.createBitmap(textView.getWidth(), textView.getHeight(), Bitmap.Config.ARGB_8888);
        Canvas canvas = new Canvas(b);
        canvas.translate(-textView.getScrollX(), -textView.getScrollY());
        textView.draw(canvas);
        textView.setDrawingCacheEnabled(true);
        Bitmap cacheBmp = textView.getDrawingCache();
        Bitmap viewBmp = cacheBmp.copy(Bitmap.Config.ARGB_8888, true);
        textView.destroyDrawingCache();

        final BitmapDrawable bmpDrawable = new BitmapDrawable(b);
        bmpDrawable.setBounds(0, 0, b.getWidth(), b.getHeight());

        SpannableStringBuilder ssb = new SpannableStringBuilder("");
        ChipSpan span = new ChipSpan(bmpDrawable, ImageSpan.ALIGN_BASELINE);
        allSpans.add(span);
        selectedContacts.put(user.id, span);
        for (ImageSpan sp : allSpans) {
            ssb.append("<<");
            ssb.setSpan(sp, ssb.length() - 2, ssb.length(), SpannableStringBuilder.SPAN_EXCLUSIVE_EXCLUSIVE);
        }
        nameTextView.setText(ssb);
        nameTextView.setSelection(ssb.length());
        return span;
    } catch (Exception e) {
        FileLog.e("tmessages", e);
    }
    return null;
}

From source file:ir.hatamiarash.calendar.view.QiblaCompassView.java

public void drawDial(Canvas canvas) {
    // over here/*from   w w w .jav a  2 s.  c  o m*/
    circlePaint.reset();
    circlePaint.setColor(ContextCompat.getColor(getContext(), R.color.qibla_color));
    circlePaint.setStrokeWidth(1);
    circlePaint.setStyle(Paint.Style.STROKE); // Sadece Cember ciziyor.

    int textHeight = (int) textPaint.measureText("yY");
    markerPaint.reset();
    markerPaint.setColor(ContextCompat.getColor(getContext(), R.color.qibla_color));
    // Draw the background
    canvas.drawCircle(px, py, Radius, circlePaint);
    canvas.drawCircle(px, py, Radius - 20, circlePaint);
    // Rotate our perspective so that the "top" is
    // facing the current bearing.

    int textWidth = (int) textPaint.measureText("W");
    int cardinalX = px - textWidth / 2;
    int cardinalY = py - Radius + textHeight;

    // Draw the marker every 15 degrees and text every 45.
    for (int i = 0; i < 24; i++) {
        // Draw a marker.
        canvas.drawLine(px, py - Radius, px, py - Radius + 10, markerPaint);
        canvas.save();
        canvas.translate(0, textHeight);
        // Draw the cardinal points
        if (i % 6 == 0) {
            String dirString = "";
            switch (i) {
            case (0): {
                dirString = northString;
                break;
            }
            case (6):
                dirString = eastString;
                break;
            case (12):
                dirString = southString;
                break;
            case (18):
                dirString = westString;
                break;
            }
            canvas.drawText(dirString, cardinalX, cardinalY, textPaint);
        } else if (i % 3 == 0) {
            // Draw the text every alternate 45deg
            String angle = String.valueOf(i * 15);
            float angleTextWidth = textPaint.measureText(angle);
            int angleTextX = (int) (px - angleTextWidth / 2);
            int angleTextY = py - Radius + textHeight;
            canvas.drawText(angle, angleTextX, angleTextY, textPaint);
        }
        canvas.restore();
        canvas.rotate(15, px, py);
    }
}

From source file:cn.androidy.androiddevelopmentpatterns.interactivechart.InteractiveLineGraphView.java

/**
 * Draws the overscroll "glow" at the four edges of the chart region, if necessary. The edges
 * of the chart region are stored in {@link #mContentRect}.
 *
 * @see EdgeEffectCompat//from   w w  w  .  j av  a  2 s. co  m
 */
private void drawEdgeEffectsUnclipped(Canvas canvas) {
    // The methods below rotate and translate the canvas as needed before drawing the glow,
    // since EdgeEffectCompat always draws a top-glow at 0,0.

    boolean needsInvalidate = false;

    if (!mEdgeEffectTop.isFinished()) {
        final int restoreCount = canvas.save();
        canvas.translate(mContentRect.left, mContentRect.top);
        mEdgeEffectTop.setSize(mContentRect.width(), mContentRect.height());
        if (mEdgeEffectTop.draw(canvas)) {
            needsInvalidate = true;
        }
        canvas.restoreToCount(restoreCount);
    }

    if (!mEdgeEffectBottom.isFinished()) {
        final int restoreCount = canvas.save();
        canvas.translate(2 * mContentRect.left - mContentRect.right, mContentRect.bottom);
        canvas.rotate(180, mContentRect.width(), 0);
        mEdgeEffectBottom.setSize(mContentRect.width(), mContentRect.height());
        if (mEdgeEffectBottom.draw(canvas)) {
            needsInvalidate = true;
        }
        canvas.restoreToCount(restoreCount);
    }

    if (!mEdgeEffectLeft.isFinished()) {
        final int restoreCount = canvas.save();
        canvas.translate(mContentRect.left, mContentRect.bottom);
        canvas.rotate(-90, 0, 0);
        mEdgeEffectLeft.setSize(mContentRect.height(), mContentRect.width());
        if (mEdgeEffectLeft.draw(canvas)) {
            needsInvalidate = true;
        }
        canvas.restoreToCount(restoreCount);
    }

    if (!mEdgeEffectRight.isFinished()) {
        final int restoreCount = canvas.save();
        canvas.translate(mContentRect.right, mContentRect.top);
        canvas.rotate(90, 0, 0);
        mEdgeEffectRight.setSize(mContentRect.height(), mContentRect.width());
        if (mEdgeEffectRight.draw(canvas)) {
            needsInvalidate = true;
        }
        canvas.restoreToCount(restoreCount);
    }

    if (needsInvalidate) {
        ViewCompat.postInvalidateOnAnimation(this);
    }
}

From source file:com.byagowi.persiancalendar.view.QiblaCompassView.java

public void drawDial(Canvas canvas) {
    // over here/* w ww  .  ja  v  a  2 s. c  o m*/
    circlePaint.reset();
    circlePaint.setColor(ContextCompat.getColor(getContext(), R.color.qibla_color));
    circlePaint.setStrokeWidth(1);
    circlePaint.setStyle(Paint.Style.STROKE); // Sadece Cember ciziyor.

    int textHeight = (int) textPaint.measureText("yY");
    markerPaint.reset();
    markerPaint.setColor(ContextCompat.getColor(getContext(), R.color.qibla_color));
    // Draw the background
    canvas.drawCircle(px, py, Radius, circlePaint);
    canvas.drawCircle(px, py, Radius - 20, circlePaint);
    // Rotate our perspective so that the "top" is
    // facing the current bearing.

    int textWidth = (int) textPaint.measureText("W");
    int cardinalX = px - textWidth / 2;
    int cardinalY = py - Radius + textHeight;

    // Draw the marker every 15 degrees and text every 45.
    for (int i = 0; i < 24; i++) {
        // Draw a marker.
        canvas.drawLine(px, py - Radius, px, py - Radius + 10, markerPaint);
        canvas.save();
        canvas.translate(0, textHeight);
        // Draw the cardinal points
        if (i % 6 == 0) {
            String dirString = "";
            switch (i) {
            case (0): {
                dirString = northString;
                break;
            }
            case (6):
                dirString = eastString;
                break;
            case (12):
                dirString = southString;
                break;
            case (18):
                dirString = westString;
                break;
            }
            canvas.drawText(dirString, cardinalX, cardinalY, textPaint);
        } else if (i % 3 == 0) {
            // Draw the text every alternate 45deg
            String angle = String.valueOf(i * 15);
            float angleTextWidth = textPaint.measureText(angle);
            int angleTextX = (int) (px - angleTextWidth / 2);
            int angleTextY = py - Radius + textHeight;
            canvas.drawText(angle, angleTextX, angleTextY, textPaint);
        }
        canvas.restore();

        canvas.rotate(15, px, py);
    }

}

From source file:android.support.design.widget.ShadowDrawableWrapper.java

private void drawShadow(Canvas canvas) {
    final int rotateSaved = canvas.save();
    canvas.rotate(mRotation, mContentBounds.centerX(), mContentBounds.centerY());

    final float edgeShadowTop = -mCornerRadius - mShadowSize;
    final float shadowOffset = mCornerRadius;
    final boolean drawHorizontalEdges = mContentBounds.width() - 2 * shadowOffset > 0;
    final boolean drawVerticalEdges = mContentBounds.height() - 2 * shadowOffset > 0;

    final float shadowOffsetTop = mRawShadowSize - (mRawShadowSize * SHADOW_TOP_SCALE);
    final float shadowOffsetHorizontal = mRawShadowSize - (mRawShadowSize * SHADOW_HORIZ_SCALE);
    final float shadowOffsetBottom = mRawShadowSize - (mRawShadowSize * SHADOW_BOTTOM_SCALE);

    final float shadowScaleHorizontal = shadowOffset / (shadowOffset + shadowOffsetHorizontal);
    final float shadowScaleTop = shadowOffset / (shadowOffset + shadowOffsetTop);
    final float shadowScaleBottom = shadowOffset / (shadowOffset + shadowOffsetBottom);

    // LT//w w w . ja  v  a  2s  . c o  m
    int saved = canvas.save();
    canvas.translate(mContentBounds.left + shadowOffset, mContentBounds.top + shadowOffset);
    canvas.scale(shadowScaleHorizontal, shadowScaleTop);
    canvas.drawPath(mCornerShadowPath, mCornerShadowPaint);
    if (drawHorizontalEdges) {
        // TE
        canvas.scale(1f / shadowScaleHorizontal, 1f);
        canvas.drawRect(0, edgeShadowTop, mContentBounds.width() - 2 * shadowOffset, -mCornerRadius,
                mEdgeShadowPaint);
    }
    canvas.restoreToCount(saved);
    // RB
    saved = canvas.save();
    canvas.translate(mContentBounds.right - shadowOffset, mContentBounds.bottom - shadowOffset);
    canvas.scale(shadowScaleHorizontal, shadowScaleBottom);
    canvas.rotate(180f);
    canvas.drawPath(mCornerShadowPath, mCornerShadowPaint);
    if (drawHorizontalEdges) {
        // BE
        canvas.scale(1f / shadowScaleHorizontal, 1f);
        canvas.drawRect(0, edgeShadowTop, mContentBounds.width() - 2 * shadowOffset,
                -mCornerRadius + mShadowSize, mEdgeShadowPaint);
    }
    canvas.restoreToCount(saved);
    // LB
    saved = canvas.save();
    canvas.translate(mContentBounds.left + shadowOffset, mContentBounds.bottom - shadowOffset);
    canvas.scale(shadowScaleHorizontal, shadowScaleBottom);
    canvas.rotate(270f);
    canvas.drawPath(mCornerShadowPath, mCornerShadowPaint);
    if (drawVerticalEdges) {
        // LE
        canvas.scale(1f / shadowScaleBottom, 1f);
        canvas.drawRect(0, edgeShadowTop, mContentBounds.height() - 2 * shadowOffset, -mCornerRadius,
                mEdgeShadowPaint);
    }
    canvas.restoreToCount(saved);
    // RT
    saved = canvas.save();
    canvas.translate(mContentBounds.right - shadowOffset, mContentBounds.top + shadowOffset);
    canvas.scale(shadowScaleHorizontal, shadowScaleTop);
    canvas.rotate(90f);
    canvas.drawPath(mCornerShadowPath, mCornerShadowPaint);
    if (drawVerticalEdges) {
        // RE
        canvas.scale(1f / shadowScaleTop, 1f);
        canvas.drawRect(0, edgeShadowTop, mContentBounds.height() - 2 * shadowOffset, -mCornerRadius,
                mEdgeShadowPaint);
    }
    canvas.restoreToCount(saved);

    canvas.restoreToCount(rotateSaved);
}