FileDocCategorySizeDatePackage
Frame.javaAPI DocAndroid 5.1 API6262Thu Mar 12 22:22:30 GMT 2015android.filterfw.core

Frame

public abstract class Frame extends Object
hide

Fields Summary
public static final int
NO_BINDING
public static final long
TIMESTAMP_NOT_SET
public static final long
TIMESTAMP_UNKNOWN
private android.filterfw.core.FrameFormat
mFormat
private android.filterfw.core.FrameManager
mFrameManager
private boolean
mReadOnly
private boolean
mReusable
private int
mRefCount
private int
mBindingType
private long
mBindingId
private long
mTimestamp
Constructors Summary
Frame(android.filterfw.core.FrameFormat format, android.filterfw.core.FrameManager frameManager)


        
        mFormat = format.mutableCopy();
        mFrameManager = frameManager;
    
Frame(android.filterfw.core.FrameFormat format, android.filterfw.core.FrameManager frameManager, int bindingType, long bindingId)

        mFormat = format.mutableCopy();
        mFrameManager = frameManager;
        mBindingType = bindingType;
        mBindingId = bindingId;
    
Methods Summary
protected voidassertFrameMutable()

        if (isReadOnly()) {
            throw new RuntimeException("Attempting to modify read-only frame!");
        }
    
protected static android.graphics.BitmapconvertBitmapToRGBA(android.graphics.Bitmap bitmap)

        if (bitmap.getConfig() == Bitmap.Config.ARGB_8888) {
            return bitmap;
        } else {
            Bitmap result = bitmap.copy(Bitmap.Config.ARGB_8888, false);
            if (result == null) {
                throw new RuntimeException("Error converting bitmap to RGBA!");
            } else if (result.getRowBytes() != result.getWidth() * 4) {
                throw new RuntimeException("Unsupported row byte count in bitmap!");
            }
            return result;
        }
    
final intdecRefCount()

        --mRefCount;
        return mRefCount;
    
public longgetBindingId()

        return mBindingId;
    
public intgetBindingType()

        return mBindingType;
    
public abstract android.graphics.BitmapgetBitmap()

public intgetCapacity()

        return getFormat().getSize();
    
public abstract java.nio.ByteBuffergetData()

public abstract float[]getFloats()

public android.filterfw.core.FrameFormatgetFormat()

        return mFormat;
    
public android.filterfw.core.FrameManagergetFrameManager()

        return mFrameManager;
    
public abstract int[]getInts()

public abstract java.lang.ObjectgetObjectValue()

public intgetRefCount()

        return mRefCount;
    
public longgetTimestamp()

        return mTimestamp;
    
protected abstract booleanhasNativeAllocation()

final intincRefCount()

        ++mRefCount;
        return mRefCount;
    
public booleanisReadOnly()

        return mReadOnly;
    
final booleanisReusable()

        return mReusable;
    
final voidmarkReadOnly()

        mReadOnly = true;
    
protected voidonFrameFetch()
Called when a frame is fetched from an internal store such as a cache.

    
protected voidonFrameStore()
Called just before a frame is stored, such as when storing to a cache or context.

    
public android.filterfw.core.Framerelease()

        if (mFrameManager != null) {
            return mFrameManager.releaseFrame(this);
        } else {
            return this;
        }
    
protected abstract voidreleaseNativeAllocation()

protected booleanrequestResize(int[] newDimensions)

        return false;
    
protected voidreset(android.filterfw.core.FrameFormat newFormat)

        mFormat = newFormat.mutableCopy();
        mReadOnly = false;
        mRefCount = 1;
    
public android.filterfw.core.Frameretain()

        if (mFrameManager != null) {
            return mFrameManager.retainFrame(this);
        } else {
            return this;
        }
    
public abstract voidsetBitmap(android.graphics.Bitmap bitmap)

public abstract voidsetData(java.nio.ByteBuffer buffer, int offset, int length)

public voidsetData(java.nio.ByteBuffer buffer)

        setData(buffer, 0, buffer.limit());
    
public voidsetData(byte[] bytes, int offset, int length)

        setData(ByteBuffer.wrap(bytes, offset, length));
    
public voidsetDataFromFrame(android.filterfw.core.Frame frame)

        setData(frame.getData());
    
public abstract voidsetFloats(float[] floats)

protected voidsetFormat(android.filterfw.core.FrameFormat format)

        mFormat = format.mutableCopy();
    
protected voidsetGenericObjectValue(java.lang.Object value)

        throw new RuntimeException(
            "Cannot set object value of unsupported type: " + value.getClass());
    
public abstract voidsetInts(int[] ints)

public voidsetObjectValue(java.lang.Object object)

        assertFrameMutable();

        // Attempt to set the value using a specific setter (which may be more optimized), and
        // fall back to the setGenericObjectValue(...) in case of no match.
        if (object instanceof int[]) {
            setInts((int[])object);
        } else if (object instanceof float[]) {
            setFloats((float[])object);
        } else if (object instanceof ByteBuffer) {
            setData((ByteBuffer)object);
        } else if (object instanceof Bitmap) {
            setBitmap((Bitmap)object);
        } else {
            setGenericObjectValue(object);
        }
    
protected voidsetReusable(boolean reusable)

        mReusable = reusable;
    
public voidsetTimestamp(long timestamp)

        mTimestamp = timestamp;