Adding Variables to Script
Let's modify Listing 9–5 a little bit to learn more about the reflected layer. So far, we only saw how the hello_world
routine from the script was reflected in Listing 9–2. Here we are going to add more variables in the script, which we will call hellorendering2.rs, as shown in Listing 9–9.
Listing 9–9. Changing Background Color (Second Version)
#pragma version(1)
#pragma rs java_package_name(com.apress.proandroid.ch9)
#include "rs_graphics.rsh"
// we removed init() as it was empty anyway
float red = 0.0f; // initialized to 1.0f
float green; // purposely not initialized
static float blue; // purposely not initialized, static
const float alpha = 1.0f; // constant
int root() { // clear the background color ...
Get Pro Android Apps Performance Optimization now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.