Search in sources :

Example 1 with ContentGroup

use of com.airbnb.lottie.animation.content.ContentGroup in project lottie-android by airbnb.

the class TextLayer method getContentsForCharacter.

private List<ContentGroup> getContentsForCharacter(FontCharacter character) {
    if (contentsForCharacter.containsKey(character)) {
        return contentsForCharacter.get(character);
    }
    List<ShapeGroup> shapes = character.getShapes();
    int size = shapes.size();
    List<ContentGroup> contents = new ArrayList<>(size);
    for (int i = 0; i < size; i++) {
        ShapeGroup sg = shapes.get(i);
        contents.add(new ContentGroup(lottieDrawable, this, sg));
    }
    contentsForCharacter.put(character, contents);
    return contents;
}
Also used : ArrayList(java.util.ArrayList) ContentGroup(com.airbnb.lottie.animation.content.ContentGroup) ShapeGroup(com.airbnb.lottie.model.content.ShapeGroup) Paint(android.graphics.Paint)

Example 2 with ContentGroup

use of com.airbnb.lottie.animation.content.ContentGroup in project lottie-android by airbnb.

the class TextLayer method drawCharacterAsGlyph.

private void drawCharacterAsGlyph(FontCharacter character, Matrix parentMatrix, float fontScale, DocumentData documentData, Canvas canvas) {
    List<ContentGroup> contentGroups = getContentsForCharacter(character);
    for (int j = 0; j < contentGroups.size(); j++) {
        Path path = contentGroups.get(j).getPath();
        path.computeBounds(rectF, false);
        matrix.set(parentMatrix);
        matrix.preTranslate(0, -documentData.baselineShift * Utils.dpScale());
        matrix.preScale(fontScale, fontScale);
        path.transform(matrix);
        if (documentData.strokeOverFill) {
            drawGlyph(path, fillPaint, canvas);
            drawGlyph(path, strokePaint, canvas);
        } else {
            drawGlyph(path, strokePaint, canvas);
            drawGlyph(path, fillPaint, canvas);
        }
    }
}
Also used : Path(android.graphics.Path) ContentGroup(com.airbnb.lottie.animation.content.ContentGroup) Paint(android.graphics.Paint)

Aggregations

Paint (android.graphics.Paint)2 ContentGroup (com.airbnb.lottie.animation.content.ContentGroup)2 Path (android.graphics.Path)1 ShapeGroup (com.airbnb.lottie.model.content.ShapeGroup)1 ArrayList (java.util.ArrayList)1