diff options
author | Jason Sams <jsams@google.com> | 2012-09-13 17:00:48 -0700 |
---|---|---|
committer | Jason Sams <jsams@google.com> | 2012-09-13 17:00:48 -0700 |
commit | 80d819033d4687507907f787d47379b7b37eae19 (patch) | |
tree | 8a6533a8e512adeb453644ad98f918a6e919a372 /graphics/java/android/renderscript/ScriptIntrinsicLUT.java | |
parent | 83cdb021eb9a8cfe26cd565febadb1a70380f3a9 (diff) | |
download | frameworks_base-80d819033d4687507907f787d47379b7b37eae19.zip frameworks_base-80d819033d4687507907f787d47379b7b37eae19.tar.gz frameworks_base-80d819033d4687507907f787d47379b7b37eae19.tar.bz2 |
Unhide intrinsics and document API.
Change-Id: I0233245c68f9a08780213062e62cfea6cf909c13
Diffstat (limited to 'graphics/java/android/renderscript/ScriptIntrinsicLUT.java')
-rw-r--r-- | graphics/java/android/renderscript/ScriptIntrinsicLUT.java | 52 |
1 files changed, 40 insertions, 12 deletions
diff --git a/graphics/java/android/renderscript/ScriptIntrinsicLUT.java b/graphics/java/android/renderscript/ScriptIntrinsicLUT.java index e7d8d34..e45c0fd 100644 --- a/graphics/java/android/renderscript/ScriptIntrinsicLUT.java +++ b/graphics/java/android/renderscript/ScriptIntrinsicLUT.java @@ -20,17 +20,19 @@ import android.content.Context; import android.content.res.Resources; import android.util.Log; - /** - * @hide + * Intrinsic for applying a per-channel lookup table. Each + * channel of the input has an independant lookup table. The + * tables are 256 entries in size and can cover the full value + * range of {@link Element#U8_4}. **/ -public class ScriptIntrinsicLUT extends ScriptIntrinsic { - private Matrix4f mMatrix = new Matrix4f(); +public final class ScriptIntrinsicLUT extends ScriptIntrinsic { + private final Matrix4f mMatrix = new Matrix4f(); private Allocation mTables; - private byte mCache[] = new byte[1024]; + private final byte mCache[] = new byte[1024]; private boolean mDirty = true; - ScriptIntrinsicLUT(int id, RenderScript rs) { + private ScriptIntrinsicLUT(int id, RenderScript rs) { super(id, rs); mTables = Allocation.createSized(rs, Element.U8(rs), 1024); for (int ct=0; ct < 256; ct++) { @@ -43,12 +45,14 @@ public class ScriptIntrinsicLUT extends ScriptIntrinsic { } /** - * Supported elements types are uchar4 + * Supported elements types are {@link Element#U8_4} + * + * The defaults tables are identity. * - * @param rs - * @param e + * @param rs The Renderscript context + * @param e Element type for intputs and outputs * - * @return ScriptIntrinsicColorMatrix + * @return ScriptIntrinsicLUT */ public static ScriptIntrinsicLUT create(RenderScript rs, Element e) { int id = rs.nScriptIntrinsicCreate(3, e.getID(rs)); @@ -66,24 +70,48 @@ public class ScriptIntrinsicLUT extends ScriptIntrinsic { } } + /** + * Set an entry in the red channel lookup table + * + * @param index Must be 0-255 + * @param value Must be 0-255 + */ public void setRed(int index, int value) { validate(index, value); mCache[index] = (byte)value; mDirty = true; } + /** + * Set an entry in the green channel lookup table + * + * @param index Must be 0-255 + * @param value Must be 0-255 + */ public void setGreen(int index, int value) { validate(index, value); mCache[index+256] = (byte)value; mDirty = true; } + /** + * Set an entry in the blue channel lookup table + * + * @param index Must be 0-255 + * @param value Must be 0-255 + */ public void setBlue(int index, int value) { validate(index, value); mCache[index+512] = (byte)value; mDirty = true; } + /** + * Set an entry in the alpha channel lookup table + * + * @param index Must be 0-255 + * @param value Must be 0-255 + */ public void setAlpha(int index, int value) { validate(index, value); mCache[index+768] = (byte)value; @@ -92,8 +120,8 @@ public class ScriptIntrinsicLUT extends ScriptIntrinsic { /** - * Invoke the kernel and apply the matrix to each cell of ain and copy to - * aout. + * Invoke the kernel and apply the lookup to each cell of ain + * and copy to aout. * * @param ain Input allocation * @param aout Output allocation |