Skip to content

Add Curve Text #49

@lavanyaarul

Description

@lavanyaarul

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions