0

Here is my question: I'm working with real time image processing, so I want to use ScriptIntrinsicColorMatrix instead of regular ColorMatrix (cause it's much faster)

android.renderscript.ScriptIntrinsicColorMatrix (API level 19) has method setAdd

void    setAdd(float r, float g, float b, float a)
void    setAdd(Float4 f)
Set the value to be added after the color matrix has been applied.

its parameters has the same meaning as (e, j, o, t) in ColorMatrix formula

   R’ = a*R + b*G + c*B + d*A + e;
   G’ = f*R + g*G + h*B + i*A + j;
   B’ = k*R + l*G + m*B + n*A + o;
   A’ = p*R + q*G + r*B + s*A + t;

My min SDK version is 14, so I've got to use android.support.v8.renderscript.ScriptIntrinsicColorMatrix from support library.
Unfortunately it doesn't have these setAdd methods. And I can't find a workaround for them.

Did anybody have deal with that problem? Is it possible to fully cover ColorMatrix features with render script Instrinsic from support library or should I write my own custom RenderScript?

VinSmile
  • 756
  • 6
  • 10
  • https://developer.android.com/reference/android/support/v8/renderscript/ScriptIntrinsicColorMatrix.html#setAdd(float,%20float,%20float,%20float) – pskink Sep 01 '15 at 10:59
  • Well... I checked things twice and found that setAdd was added only to build tool 23.0.0 (Which has bug related to render script :) ) in 21.0.1 these methods are absent. Anyway, thanks you a lot, your comment pointed me in right direction – VinSmile Sep 01 '15 at 12:17
  • By the way, build tool 23.0.0 defect is described here http://stackoverflow.com/questions/32080309/using-buildtoolsversion-23-fails-because-multiple-dex-files-define-animres – VinSmile Sep 01 '15 at 12:18
  • what does support library version have to do with build tool version? do i miss something? – pskink Sep 01 '15 at 12:19
  • Real path to the imported class looks like this: C:\Users\VinSmile\AppData\Local\Android\sdk1\build-tools\22.0.1\renderscript\lib\renderscript-v8.jar!\android\support\v8\renderscript\ScriptIntrinsicColorMatrix.class – VinSmile Sep 01 '15 at 12:20

1 Answers1

0

Ok, possible solution (thanks to pskink for advising):

1) Change build tool version to 23.0.0 (it won't compile at this point due to defect in this build tool)
2) Try workaround from this guy
3) Profit

I've just tested it, and it works. Hope android will fix this defect soon

Community
  • 1
  • 1
VinSmile
  • 756
  • 6
  • 10