@Override
    protected void onDraw(Shape shape, Canvas canvas, Paint paint) {

      canvas.save();
      canvas.translate(widthFactor / 2, heightFactor / 2);

      shape.draw(canvas, paint);

      canvas.restore();
    }
示例#2
0
 @Override
 protected void onDraw(Shape shape, Canvas canvas, Paint paint) {
   shape.draw(canvas, fillpaint);
   shape.draw(canvas, strokepaint);
 }
 public void setHeight(float height) {
   Shape s = shape.getShape();
   s.resize(s.getWidth(), height);
 }
 public void setWidth(float width) {
   Shape s = shape.getShape();
   s.resize(width, s.getHeight());
 }
示例#5
0
 /**
  * Called from the drawable's draw() method after the canvas has been set to draw the shape at
  * (0,0). Subclasses can override for special effects such as multiple layers, stroking, etc.
  */
 protected void onDraw(Shape shape, Canvas canvas, Paint paint) {
   shape.draw(canvas, paint);
 }