@Override @Nullable protected Throwable doInBackground(Void... params) { if (mViewBitmap == null) { return new NullPointerException("ViewBitmap is null"); } else if (mViewBitmap.isRecycled()) { return new NullPointerException("ViewBitmap is recycled"); } else if (mCurrentImageRect.isEmpty()) { return new NullPointerException("CurrentImageRect is empty"); } float resizeScale = resize(); try { crop(resizeScale); mViewBitmap = null; } catch (Throwable throwable) { return throwable; } return null; }
protected boolean setRectToRect(RectF src, RectF dst, ScaleToFit stf) { if (dst.isEmpty()) { mValues[0] = mValues[1] =
public RectFAssert isEmpty() { isNotNull(); assertThat(actual.isEmpty()) // .overridingErrorMessage("Expected to be empty but was not.") // .isTrue(); return this; }
public RectFAssert isNotEmpty() { isNotNull(); assertThat(actual.isEmpty()) // .overridingErrorMessage("Expected to not be empty but was.") // .isFalse(); return this; }
@Override void drawLayer(Canvas canvas, Matrix parentMatrix, int parentAlpha) { L.beginSection("CompositionLayer#draw"); canvas.save(); newClipRect.set(0, 0, layerModel.getPreCompWidth(), layerModel.getPreCompHeight()); parentMatrix.mapRect(newClipRect); for (int i = layers.size() - 1; i >= 0 ; i--) { boolean nonEmptyClip = true; if (!newClipRect.isEmpty()) { nonEmptyClip = canvas.clipRect(newClipRect); } if (nonEmptyClip) { BaseLayer layer = layers.get(i); layer.draw(canvas, parentMatrix, parentAlpha); } } canvas.restore(); L.endSection("CompositionLayer#draw"); }
@Override public void draw(@NonNull Canvas canvas) { if (cornersState == 1f || clipRect.isEmpty() || bitmapPaint.getShader() == null) { super.draw(canvas); } else { float rx = 0.5f * clipRect.width() * (1f - cornersState); float ry = 0.5f * clipRect.height() * (1f - cornersState); canvas.rotate(clipRotation, clipRect.centerX(), clipRect.centerY()); canvas.drawRoundRect(clipRect, rx, ry, bitmapPaint); canvas.rotate(-clipRotation, clipRect.centerX(), clipRect.centerY()); if (GestureDebug.isDrawDebugOverlay()) { DebugOverlay.drawDebug(this, canvas); } } }
@Override public void draw(Canvas canvas) { if (mClip) { if (!mScale.isEmpty()) { int saveCount = canvas.save(); canvas.clipRect(getBounds()); super.draw(canvas); canvas.restoreToCount(saveCount); } } else { super.draw(canvas); } } }
if (mGridPoints == null && !mCropViewRect.isEmpty()) {
@Implementation protected boolean setRectToRect(RectF src, RectF dst, Matrix.ScaleToFit stf) { if (src.isEmpty()) { reset(); return false; } return simpleMatrix.setRectToRect(src, dst, stf); }
@Override protected void onBoundsChange(Rect bounds) { if (mClip) { if (!mScale.isEmpty()) { mTemp.left = (int) ((mScale.left * bounds.right - mScale.right * bounds.left) / (mScale.left * (1 - mScale.right) - mScale.right * (1 - mScale.left))); mTemp.right = (int) (((1 - mScale.right) * bounds.left - (1 - mScale.left) * bounds.right) / (mScale.left * (1 - mScale.right) - mScale.right * (1 - mScale.left))); mTemp.top = (int) ((mScale.top * bounds.bottom - mScale.bottom * bounds.top) / (mScale.top * (1 - mScale.bottom) - mScale.bottom * (1 - mScale.top))); mTemp.bottom = (int) (((1 - mScale.bottom) * bounds.top - (1 - mScale.top) * bounds.bottom) / (mScale.top * (1 - mScale.bottom) - mScale.bottom * (1 - mScale.top))); super.onBoundsChange(mTemp); } } else { super.onBoundsChange(bounds); } }
@Override public boolean onTouchEvent(MotionEvent event) { if (mCropViewRect.isEmpty() || mFreestyleCropMode == FREESTYLE_CROP_MODE_DISABLE) { return false;
private void updateShaderMatrix() { if (!clipRect.isEmpty() && bitmapPaint.getShader() != null) { getController().getState().get(tmpMatrix); // Including paddings & reverting rotation (will be applied later in draw() method) tmpMatrix.postTranslate(getPaddingLeft(), getPaddingTop()); tmpMatrix.postRotate(-clipRotation, clipRect.centerX(), clipRect.centerY()); bitmapPaint.getShader().setLocalMatrix(tmpMatrix); } }
@Override protected void computeRender(float renderProgress) { if (mCurrentBounds.isEmpty()) { return;
@Override protected void computeRender(float renderProgress) { if (mCurrentBounds.isEmpty()) { return; } if (mMotherMovePath.isEmpty()) { mMotherMovePath.set(createMotherMovePath()); mMotherMovePathMeasure.setPath(mMotherMovePath, false); mChildMovePath.set(createChildMovePath()); mChildMovePathMeasure.setPath(mChildMovePath, false); } //mother oval float motherMoveProgress = MOTHER_MOVE_INTERPOLATOR.getInterpolation(renderProgress); mMotherMovePathMeasure.getPosTan(getCurrentMotherMoveLength(motherMoveProgress), mMotherPosition, null); mMotherOvalHalfWidth = mMaxMotherOvalSize; mMotherOvalHalfHeight = mMaxMotherOvalSize * getMotherShapeFactor(motherMoveProgress); //child Oval float childMoveProgress = CHILD_MOVE_INTERPOLATOR.getInterpolation(renderProgress); mChildMovePathMeasure.getPosTan(getCurrentChildMoveLength(childMoveProgress), mChildPosition, null); setupChildParams(childMoveProgress); mRotateDegrees = (int) (Math.toDegrees(Math.atan((mMotherPosition[1] - mChildPosition[1]) / (mMotherPosition[0] - mChildPosition[0])))); mRevealCircleRadius = getCurrentRevealCircleRadius(renderProgress); mCurrentOvalColor = getCurrentOvalColor(renderProgress); mCurrentBackgroundColor = getCurrentBackgroundColor(renderProgress); }
if (!rect.isEmpty()) { L.beginSection("Layer#saveLayer"); saveLayerCompat(canvas, rect, contentPaint, true);
@SuppressWarnings("UnusedReturnValue") public RectF drawLabel(Canvas canvas, RectF bounds, float anglePercent) { if (!mVisible) { return null; } if (bounds == null || bounds.isEmpty()) { throw new IllegalArgumentException("Drawing bounds can not be null or empty"); } if (mSeriesItem.getSeriesLabel() != null) { return mSeriesItem.getSeriesLabel().draw(canvas, bounds, anglePercent, getPositionPercent(), mPositionCurrentEnd); } return null; }
super.onDraw(canvas); if (mArcBounds == null || mArcBounds.isEmpty()) { return;
/** * Draw this series in the current position calculated by the ValueAnimator. * * @param canvas Canvas used to draw * @param bounds Bounds to be used to draw the arc * @return true if drawing has already been handled */ public boolean draw(Canvas canvas, RectF bounds) { if (!mVisible) { return true; } if (bounds == null || bounds.isEmpty()) { throw new IllegalArgumentException("Drawing bounds can not be null or empty"); } processBoundsChange(bounds); if (mDrawMode == DecoEvent.EventType.EVENT_EFFECT) { // Delegate the drawing to the ArcEffect as required if (mEffect != null) { mEffect.draw(canvas, mBoundsInset, mPercentComplete, mAngleStart, mAngleSweep); } return true; } processRevealEffect(); if (mColorAnimate != null) { mPaint.setColor(mColorAnimate.getColorCurrent(mPercentComplete)); } else if (mPaint.getColor() != getSeriesItem().getColor()) { mPaint.setColor(getSeriesItem().getColor()); } return false; }
public RectFAssert isEmpty() { isNotNull(); assertThat(actual.isEmpty()) // .overridingErrorMessage("Expected to be empty but was not.") // .isTrue(); return this; }
@Implementation protected boolean setRectToRect(RectF src, RectF dst, Matrix.ScaleToFit stf) { if (src.isEmpty()) { reset(); return false; } return simpleMatrix.setRectToRect(src, dst, stf); }