private void addPaths() { for (int i = 0; i < pathContents.size(); i++) { path.addPath(pathContents.get(i).getPath()); } }
@Override public void getBounds(RectF outBounds, Matrix parentMatrix, boolean applyParents) { path.reset(); for (int i = 0; i < paths.size(); i++) { path.addPath(paths.get(i).getPath(), parentMatrix); } path.computeBounds(outBounds, false); // Add padding to account for rounding errors. outBounds.set( outBounds.left - 1, outBounds.top - 1, outBounds.right + 1, outBounds.bottom + 1 ); }
@Override public void getBounds(RectF outBounds, Matrix parentMatrix, boolean applyParents) { path.reset(); for (int i = 0; i < paths.size(); i++) { this.path.addPath(paths.get(i).getPath(), parentMatrix); } path.computeBounds(outBounds, false); // Add padding to account for rounding errors. outBounds.set( outBounds.left - 1, outBounds.top - 1, outBounds.right + 1, outBounds.bottom + 1 ); }
@Override public Path getPath() { // TODO: cache this somehow. matrix.reset(); if (transformAnimation != null) { matrix.set(transformAnimation.getMatrix()); } path.reset(); if (hidden) { return path; } for (int i = contents.size() - 1; i >= 0; i--) { Content content = contents.get(i); if (content instanceof PathContent) { path.addPath(((PathContent) content).getPath(), matrix); } } return path; }
@Override public Path getPath() { Path contentPath = contentGroup.getPath(); path.reset(); float copies = this.copies.getValue(); float offset = this.offset.getValue(); for (int i = (int) copies - 1; i >= 0; i--) { matrix.set(transform.getMatrixForRepeater(i + offset)); path.addPath(contentPath, matrix); } return path; }
@Override public void getBounds(RectF outBounds, Matrix parentMatrix, boolean applyParents) { L.beginSection("StrokeContent#getBounds"); path.reset(); for (int i = 0; i < pathGroups.size(); i++) { PathGroup pathGroup = pathGroups.get(i); for (int j = 0; j < pathGroup.paths.size(); j++) { path.addPath(pathGroup.paths.get(j).getPath(), parentMatrix); } } path.computeBounds(rect, false); float width = ((FloatKeyframeAnimation) widthAnimation).getFloatValue(); rect.set(rect.left - width / 2f, rect.top - width / 2f, rect.right + width / 2f, rect.bottom + width / 2f); outBounds.set(rect); // Add padding to account for rounding errors. outBounds.set( outBounds.left - 1, outBounds.top - 1, outBounds.right + 1, outBounds.bottom + 1 ); L.endSection("StrokeContent#getBounds"); }
private void drawUnselected(Canvas canvas) { combinedUnselectedPath.rewind(); for (int page = 0; page < pageCount; page++) { int nextXIndex; if (page == pageCount - 1) { nextXIndex = page; } else { nextXIndex = page + 1; } Path unselectedPath = getUnselectedPath(page, dotCenterX[page], dotCenterX[nextXIndex], page == pageCount - 1 ? INVALID_FRACTION : joiningFractions[page], dotRevealFractions[page]); unselectedPath.addPath(combinedUnselectedPath); combinedUnselectedPath.addPath(unselectedPath); } if (retreatingJoinX1 != INVALID_FRACTION) { Path retreatingJoinPath = getRetreatingJoinPath(); combinedUnselectedPath.addPath(retreatingJoinPath); } canvas.drawPath(combinedUnselectedPath, unselectedPaint); }
@Override public void draw(Canvas canvas, Matrix parentMatrix, int parentAlpha) { if (hidden) { return; } L.beginSection("FillContent#draw"); paint.setColor(((ColorKeyframeAnimation) colorAnimation).getIntValue()); int alpha = (int) ((parentAlpha / 255f * opacityAnimation.getValue() / 100f) * 255); paint.setAlpha(clamp(alpha, 0, 255)); if (colorFilterAnimation != null) { paint.setColorFilter(colorFilterAnimation.getValue()); } path.reset(); for (int i = 0; i < paths.size(); i++) { path.addPath(paths.get(i).getPath(), parentMatrix); } canvas.drawPath(path, paint); L.endSection("FillContent#draw"); }
Path marquee = new Path(); for (float i = -size; i < width; i += size) { marquee.addPath(mMarqueeLine, i + mMarqueeProgress, 0);
Path path = pathList.get(j).getPath(); path.transform(((ContentGroup) content).getTransformationMatrix()); this.remainderPath.addPath(path); remainderPath.addPath(content.getPath()); Path path = pathList.get(j).getPath(); path.transform(((ContentGroup) lastContent).getTransformationMatrix()); this.firstPath.addPath(path);
@Override public void draw(Canvas canvas, Matrix parentMatrix, int parentAlpha) { if (hidden) { return; } L.beginSection("GradientFillContent#draw"); path.reset(); for (int i = 0; i < paths.size(); i++) { path.addPath(paths.get(i).getPath(), parentMatrix); } path.computeBounds(boundsRect, false); Shader shader; if (type == GradientType.Linear) { shader = getLinearGradient(); } else { shader = getRadialGradient(); } shaderMatrix.set(parentMatrix); shader.setLocalMatrix(shaderMatrix); paint.setShader(shader); if (colorFilterAnimation != null) { paint.setColorFilter(colorFilterAnimation.getValue()); } int alpha = (int) ((parentAlpha / 255f * opacityAnimation.getValue() / 100f) * 255); paint.setAlpha(clamp(alpha, 0, 255)); canvas.drawPath(path, paint); L.endSection("GradientFillContent#draw"); }
path.reset(); for (int j = pathGroup.paths.size() - 1; j >= 0; j--) { path.addPath(pathGroup.paths.get(j).getPath(), parentMatrix);
void endElement() { String localName = atts.getName(); if (inDefsElement) { if (localName.equals("defs")) { inDefsElement = false; } return; } if (localName.equals("svg")) { Path p = popPath(); Matrix matrix = popTransform(); p.transform(matrix); pathInfo = new PathInfo(p, width, height); } else if (localName.equals("g")) { // Break out of hidden mode if (hidden) { hiddenLevel--; if (hiddenLevel == 0) { hidden = false; } } Path p = popPath(); Matrix matrix = popTransform(); p.transform(matrix); path.addPath(p); } }
cubicFillPath.addPath(cubicPath);
path.addPath(pathGroup.paths.get(j).getPath(), parentMatrix);
Matrix matrix = popTransform(); p.transform(matrix); path.addPath(p); } else if (!hidden && localName.equals("line")) { Float x1 = getFloatAttr("x1", atts); Matrix matrix = popTransform(); p.transform(matrix); path.addPath(p); } else if (!hidden && localName.equals("circle")) { Float centerX = getFloatAttr("cx", atts); Matrix matrix = popTransform(); p.transform(matrix); path.addPath(p); Matrix matrix = popTransform(); p.transform(matrix); path.addPath(p); Matrix matrix = popTransform(); p.transform(matrix); path.addPath(p); Matrix matrix = popTransform(); p.transform(matrix); path.addPath(p); } else if (!hidden && localName.equals("metadata")) {
cubicFillPath.addPath(cubicPath);