i find that the google's doc about the RenderScript has update(https://developer.android.com/guide/topics/renderscript/compute.html). so i use it's code to test but o got an error about that
Error:(31, 23) error: implicit declaration of function 'rsCreateAllocation_uchar4' is invalid in C99
Error:(31, 17) error: initializing 'rs_allocation' (aka 'struct rs_allocation') with an expression of incompatible type 'int'
that is the code:
rs_allocation tmp = rsCreateAllocation_uchar4(imageWidth, imageHeight);
rsForEach(invert, inputImage, tmp);
rsForEach(greyscale, tmp, outputImage);
so i want to know: 1:why this happen(i think the sdk api is the reason but i have update my AS, SDK and sdk tool to newest)? 2:what's the difference between the
uchar4 RS_KERNEL root(uchr4 in, unit32_t x, uint32_t y)
and
void RS_KERNEL root(uchr4* in, uchar4* out, unit32_t x, uint32_t y)
i think the second method is more fast?! but i can't sure. and the method that using the pointer as params is'n used to a function that not named root()(i test it).so if the method with pointer params is faster how can i use 2 or more kernel function in a RS file?
The rsCreateAllocation*() functions are only available when targeting Android Nougat (i.e. API level 24 and higher). I assume that you are getting this error because you have chosen a RenderScript target API that is much lower than that.