heifwriter/src/main/java/androidx/heifwriter/HeifEncoder.java
public void addBitmap(@NonNull Bitmap bitmap) {
        if (mInputMode != INPUT_MODE_BITMAP) {
            throw new IllegalStateException("addBitmap is only allowed in bitmap input mode");
        }

        boolean takeFrame = mEOSTracker.updateLastInputAndEncoderTime(
                computePresentationTime(mInputIndex),
                computePresentationTime(mInputIndex + mNumTiles - 1));

        if (!takeFrame) return;

        synchronized (this) {
            for (int row = 0; row < mGridRows; row++) {
                for (int col = 0; col < mGridCols; col++) {
                    int left = col * mGridWidth;
                    int top = row * mGridHeight;
                    mSrcRect.set(left, top, left + mGridWidth, top + mGridHeight);
                    Canvas canvas = mEncoderSurface.lockCanvas(null);
                    canvas.drawBitmap(bitmap, mSrcRect, mDstRect, null);
                    mEncoderSurface.unlockCanvasAndPost(canvas);
                }
            }
        }
    }
/**
     * Adds one bitmap to be encoded.
     */
Adds one bitmap to be encoded.
Adds one bitmap to be encoded .
public void addBitmap(@NonNull Bitmap bitmap) {
        if (mInputMode != INPUT_MODE_BITMAP) {
            throw new IllegalStateException("addBitmap is only allowed in bitmap input mode");
        }
        boolean takeFrame = mEOSTracker.updateLastInputAndEncoderTime(
                computePresentationTime(mInputIndex),
                computePresentationTime(mInputIndex + mNumTiles - 1));
        if (!takeFrame) return;
        synchronized (this) {
            for (int row = 0; row < mGridRows; row++) {
                for (int col = 0; col < mGridCols; col++) {
                    int left = col * mGridWidth;
                    int top = row * mGridHeight;
                    mSrcRect.set(left, top, left + mGridWidth, top + mGridHeight);
                    Canvas canvas = mEncoderSurface.lockCanvas(null);
                    canvas.drawBitmap(bitmap, mSrcRect, mDstRect, null);
                    mEncoderSurface.unlockCanvasAndPost(canvas);
                }
            }
        }
    }
public void addBitmap ( @ NonNull Bitmap bitmap ) { if ( mInputMode != INPUT_MODE_BITMAP ) { throw new IllegalStateException ( "addBitmap is only allowed in bitmap input mode" ) ; } boolean takeFrame = mEOSTracker . updateLastInputAndEncoderTime ( computePresentationTime ( mInputIndex ) , computePresentationTime ( mInputIndex + mNumTiles - 1 ) ) ; if ( ! takeFrame ) return ; synchronized ( this ) { for ( int row = 0 ; row < mGridRows ; row ++ ) { for ( int col = 0 ; col < mGridCols ; col ++ ) { int left = col * mGridWidth ; int top = row * mGridHeight ; mSrcRect . set ( left , top , left + mGridWidth , top + mGridHeight ) ; Canvas canvas = mEncoderSurface . lockCanvas ( null ) ; canvas . drawBitmap ( bitmap , mSrcRect , mDstRect , null ) ; mEncoderSurface . unlockCanvasAndPost ( canvas ) ; } } } }
Adds one bitmap to be encoded.
Adds one bitmap to be encoded .