@Override public void onBoundsChange(Rect bounds){ if(mDrawingContent != null){ mDrawingContent.setBounds(0, 0, bounds.width(), bounds.height()); } if(mMask != null){ mMask.resize(bounds.width(), bounds.height()); } recreateBitmap(); }
public void resizeShape(final float width,final float height){ shape.getShape().resize(width,height); } public ShapeHolder(ShapeDrawable s) {
public void setHeight(float height) { Shape s = shape.getShape(); s.resize(s.getWidth(), height); } public void resizeShape(final float width,final float height){
public void setHeight(float height) { Shape s = shape.getShape(); s.resize(s.getWidth(), height); }
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()); }
public void setWidth(float width) { Shape s = shape.getShape(); s.resize(width, s.getHeight()); }
public void setWidth(float width) { Shape s = shape.getShape(); s.resize(width, s.getHeight()); }
public void setMask(Shape mask){ mMask = mask; mMask.resize(getBounds().width(), getBounds().height()); recreateBitmap(); invalidateSelf(); }
private void drawBGCircle(Canvas canvas, BGCircle circle) { canvas.save(); canvas.translate(circle.getX() - circle.getRadius() / 2, circle.getY() - circle.getRadius() / 2); circle.getShape().getShape() .resize(circle.getRadius(), circle.getRadius()); circle.getShape().draw(canvas); canvas.restore(); }
private void drawBGCircle(Canvas canvas, BGCircle circle) { canvas.save(); canvas.translate(circle.getX() - circle.getRadius() / 2, circle.getY() - circle.getRadius() / 2); circle.getShape().getShape() .resize(circle.getRadius(), circle.getRadius()); circle.getShape().draw(canvas); canvas.restore(); }
private void drawBGCircle(Canvas canvas, BGCircle circle) { canvas.save(); canvas.translate(circle.getX() - circle.getRadius() / 2, circle.getY() - circle.getRadius() / 2); circle.getShape().getShape().resize(circle.getRadius(), circle.getRadius()); circle.getShape().draw(canvas); canvas.restore(); }
@Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { super.onLayout(changed, left, top, right, bottom); if (changed || mShapeChanged) { mShapeChanged = false; int width = getMeasuredWidth(); int height = getMeasuredHeight(); switch (mShapeMode) { case SHAPE_MODE_ROUND_RECT: break; case SHAPE_MODE_CIRCLE: int min = Math.min(width, height); mRadius = (float) min / 2; break; } if (mShape == null || mRadius != 0) { float[] radius = new float[8]; Arrays.fill(radius, mRadius); mShape = new RoundRectShape(radius, null, null); mStrokeShape = new RoundRectShape(radius, null, null); } mShape.resize(width, height); mStrokeShape.resize(width - mStrokeWidth * 2, height - mStrokeWidth * 2); makeStrokeBitmap(); makeShapeBitmap(); if (mExtension != null) { mExtension.onLayout(mPath, width, height); } } }
public void setType(final int type, final int width, final int height) { Shape shape = null; switch (type) { case BRUSH_ELIPSE: shape = new OvalShape(); break; case BRUSH_LINE: break; case BRUSH_TRIANGLE: shape = new IsoscelesTriangleShape(width, height); break; case BRUSH_RECTANGLE: shape = new BaseShape(width, height); break; } if (shape != null) { mRotation = 0; shape.resize(width, height); setShape(shape); } }
public void setStroke(int strokeColor, float strokeWidth) { if (mStrokeWidth <= 0) return; if (mStrokeWidth != strokeWidth) { mStrokeWidth = strokeWidth; int width = getMeasuredWidth(); int height = getMeasuredHeight(); mStrokeShape.resize(width - mStrokeWidth * 2, height - mStrokeWidth * 2); postInvalidate(); } if (mStrokeColor != strokeColor) { mStrokeColor = strokeColor; makeStrokeBitmap(); postInvalidate(); } }
TypedArray a = getContext().getTheme().obtainStyledAttributes(m_i); Shape m_s1 = new OvalShape(); m_s1.resize(m_indicatorSize, m_indicatorSize); Shape m_s2 = new OvalShape(); m_s2.resize(m_indicatorSize, m_indicatorSize); ((ShapeDrawable) m_activeDrawable).getPaint().setColor( a.getColor(0, Color.DKGRAY));