title: How to allocate the LUT to use on ScriptIntrinsic3DLUT?
body: <p>working with RenderScript, I'm trying to use the ScriptIntrinsic3DLUT (<a href="http://developer.android.com/reference/android/renderscript/ScriptIntrinsic3DLUT.html" rel="nofollow noreferrer">http://developer.android.com/reference/android/renderscript/ScriptIntrinsic3DLUT.html</a>)</p>
  
  <p>In general this scrip works just like any other renderscript</p>
  
  <ul>
  <li>create RS context</li>
  <li>create script with this context</li>
  <li>create input and output allocations</li>
  <li>set script parameters</li>
  <li>call the kernel</li>
  </ul>
  
  <p>may problem is on the <code>set script parameters</code> step, from the docs I should call <code>script.setLUT (Allocation lut)</code>, but what is the appropriate way of generating/setting values for this allocation?</p>
  
  <p>sample of the code I have is:</p>
  
  <pre><code>// create RS context
  RenderScript rs = RenderScript.create(context);
  
  // create output bitmap
  Bitmap bitmapOut = Bitmap.createBitmap(bitmapIn.getWidth(), bitmapIn.getHeight(), bitmapIn.getConfig());
  
  // create bitmap allocations
  Allocation allocIn = Allocation.createFromBitmap(rs, bitmapIn);
  Allocation allocOut = Allocation.createFromBitmap(rs, bitmapOut);
  
  // create script
  ScriptIntrinsic3DLUT script = ScriptIntrinsic3DLUT.create(rs, Element.U8_4(rs));
  
  // set 3D LUT for the script
  how to create the `Allocation lut` ??
  script.setLUT(lut);
  
  // process the script
  script.forEach(allocIn, allocOut);
  
  // copy result to bitmap output
  allocOut.copyTo(bitmapOut);
  </code></pre>
  
  <p>My question is similar to <a href="https://stackoverflow.com/questions/25686572/how-to-use-scriptintrinsic3dlut-with-a-cube-file">How to use ScriptIntrinsic3DLUT with a .cube file?</a></p>
  
  <p>but it is not the same. I do not care about the cube file. I can create the LUT from array of bytes, ints, matrix, whatever. I just want to know how-to/where-to place those bytes inside the allocation. What's the appropriate formatting for this allocation?</p>