Lines Matching refs:canvas

46     public static void paintShadow(Outline viewOutline, float elevation, Canvas canvas) {
53 int saved = modifyCanvas(canvas, shadowSize);
84 sideShadow(canvas, edgePaint, edgeShadowRect, outline.left, inset.top, 0);
86 sideShadow(canvas, edgePaint, edgeShadowRect, outline.right, inset.bottom, 2);
89 sideShadow(canvas, edgePaint, edgeShadowRect, inset.right, outline.top, 1);
95 sideShadow(canvas, edgePaint, edgeShadowRect, inset.left, outline.bottom, 3);
98 drawCorner(canvas, cornerPaint, path, inset.right, inset.bottom, outerArcRadius, 0);
99 drawCorner(canvas, cornerPaint, path, inset.left, inset.bottom, outerArcRadius, 1);
100 drawCorner(canvas, cornerPaint, path, inset.left, inset.top, outerArcRadius, 2);
101 drawCorner(canvas, cornerPaint, path, inset.right, inset.top, outerArcRadius, 3);
103 canvas.restoreToCount(saved);
113 * Translate canvas by half of shadow size up, so that it appears that light is coming
116 private static int modifyCanvas(Canvas canvas, float shadowSize) {
117 Rect clipBounds = canvas.getClipBounds();
121 int saved = canvas.save();
122 // Usually canvas has been translated to the top left corner of the view when this is
124 // Thus, we just expand in each direction by width and height of the canvas.
125 canvas.clipRect(-canvas.getWidth(), -canvas.getHeight(), canvas.getWidth(),
126 canvas.getHeight(), Op.REPLACE);
127 canvas.translate(0, shadowSize / 2f);
131 private static void sideShadow(Canvas canvas, Paint edgePaint,
136 int saved = canvas.save();
137 canvas.translate(dx, dy);
138 canvas.rotate(rotations * PERPENDICULAR_ANGLE);
139 canvas.drawRect(edgeShadowRect, edgePaint);
140 canvas.restoreToCount(saved);
144 * @param canvas Canvas to draw the rectangle on.
152 private static void drawCorner(Canvas canvas, Paint paint, Path path, float x, float y,
154 int saved = canvas.save();
155 canvas.translate(x, y);
161 canvas.drawPath(path, paint);
162 canvas.restoreToCount(saved);