MotionViews-Android icon indicating copy to clipboard operation
MotionViews-Android copied to clipboard

Add Curve Text

Open lavanyaarul opened this issue 3 years ago • 0 comments

I tried lot to make curve text.but it didnt make it

int radius = 255; float textWidth = textPaint.measureText(textLayer.getText()); float circumference = (float) (2 * Math.PI * radius); //Длина окружности float textAngle = textWidth * 360 / circumference; //Угол занимаемый текстом float startAngle = -90 - (textAngle / 2); float offset = textPaint.getTextSize(); RectF oval = new RectF(offset, offset, radius3+ offset, radius3 + offset); // calculate height for the entity, min - Limits.MIN_BITMAP_HEIGHT int boundsHeight = sl.getHeight(); // create bitmap not smaller than TextLayer.Limits.MIN_BITMAP_HEIGHT int bmpHeight = (int) (canvasHeight * Math.max(TextLayer.Limits.MIN_BITMAP_HEIGHT, 1.0F * boundsHeight / canvasHeight));

    Bitmap bmp= Bitmap.createBitmap((int)oval.width(), bmpHeight, Bitmap.Config.ARGB_8888);


    Canvas canvas = new Canvas(bmp);
    canvas.save();


    Path pathArc = new Path();
    pathArc.addArc(oval, 250, 270);
    canvas.drawTextOnPath(textLayer.getText(), pathArc, 0, 0, textPaint);

added like this in TextEntity Class.please guide me

lavanyaarul avatar Aug 11 '21 09:08 lavanyaarul