diff options
author | Hak Matsuda <hakuro@google.com> | 2014-01-31 16:37:51 -0800 |
---|---|---|
committer | Hak Matsuda <hakuro@google.com> | 2014-02-06 13:43:15 -0800 |
commit | 1ca4f621796c877be91fd3266b785b54ef0b86b6 (patch) | |
tree | 329bb0eee18f02c3805541eefc10e891166c33b8 /renderScript | |
parent | 19b8151afc6bc3d025eec92281bbde5b96857377 (diff) | |
download | android-1ca4f621796c877be91fd3266b785b54ef0b86b6.tar.gz |
Initial checkin of RenderScriptIntrinsic sample
Change-Id: I206b30bec63c13255d8d322133eee90f02485e3a
Diffstat (limited to 'renderScript')
25 files changed, 1151 insertions, 0 deletions
diff --git a/renderScript/RenderScriptIntrinsic/RenderScriptIntrinsicSample/.gitignore b/renderScript/RenderScriptIntrinsic/RenderScriptIntrinsicSample/.gitignore new file mode 100644 index 00000000..6eb878d4 --- /dev/null +++ b/renderScript/RenderScriptIntrinsic/RenderScriptIntrinsicSample/.gitignore @@ -0,0 +1,16 @@ +# Copyright 2013 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +src/template/ +src/common/ +build.gradle diff --git a/renderScript/RenderScriptIntrinsic/RenderScriptIntrinsicSample/src/main/AndroidManifest.xml b/renderScript/RenderScriptIntrinsic/RenderScriptIntrinsicSample/src/main/AndroidManifest.xml new file mode 100644 index 00000000..d0697ea5 --- /dev/null +++ b/renderScript/RenderScriptIntrinsic/RenderScriptIntrinsicSample/src/main/AndroidManifest.xml @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="UTF-8"?><!-- + Copyright 2014 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + + +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="com.example.android.renderscriptintrinsic" + android:versionCode="1" + android:versionName="1.0"> + + <uses-sdk + android:minSdkVersion="8" + android:targetSdkVersion="19" /> + + <application + android:allowBackup="true" + android:label="@string/app_name" + android:icon="@drawable/ic_launcher" + android:theme="@style/AppTheme"> + + <activity + android:name=".MainActivity" + android:label="@string/app_name" + android:theme="@style/FullscreenTheme"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> + </application> + + +</manifest> diff --git a/renderScript/RenderScriptIntrinsic/RenderScriptIntrinsicSample/src/main/java/com/example/android/renderscriptintrinsic/MainActivity.java b/renderScript/RenderScriptIntrinsic/RenderScriptIntrinsicSample/src/main/java/com/example/android/renderscriptintrinsic/MainActivity.java new file mode 100644 index 00000000..4b6f5ce1 --- /dev/null +++ b/renderScript/RenderScriptIntrinsic/RenderScriptIntrinsicSample/src/main/java/com/example/android/renderscriptintrinsic/MainActivity.java @@ -0,0 +1,370 @@ +/* + * Copyright (C) 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.android.renderscriptintrinsic; + +import android.app.Activity; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; +import android.os.AsyncTask; +import android.os.Bundle; +import android.widget.CompoundButton; +import android.widget.CompoundButton.OnCheckedChangeListener; +import android.widget.ImageView; +import android.widget.RadioButton; +import android.widget.SeekBar; +import android.widget.SeekBar.OnSeekBarChangeListener; +import android.support.v8.renderscript.*; + +public class MainActivity extends Activity { + /* Number of bitmaps that is used for renderScript thread and UI thread synchronization. + Ideally, this can be reduced to 2, however in some devices, 2 buffers still showing tierings on UI. + Investigating a root cause. + */ + private final int NUM_BITMAPS = 3; + private int mCurrentBitmap = 0; + private Bitmap mBitmapIn; + private Bitmap[] mBitmapsOut; + private ImageView mImageView; + + private RenderScript mRS; + private Allocation mInAllocation; + private Allocation[] mOutAllocations; + + private ScriptIntrinsicBlur mScriptBlur; + private ScriptIntrinsicConvolve5x5 mScriptConvolve; + private ScriptIntrinsicColorMatrix mScriptMatrix; + + private final int MODE_BLUR = 0; + private final int MODE_CONVOLVE = 1; + private final int MODE_COLORMATRIX = 2; + + private int mFilterMode = MODE_BLUR; + + private RenderScriptTask mLatestTask = null; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + setContentView(R.layout.main_layout); + + /* + * Initialize UI + */ + + //Set up main image view + mBitmapIn = loadBitmap(R.drawable.data); + mBitmapsOut = new Bitmap[NUM_BITMAPS]; + for (int i = 0; i < NUM_BITMAPS; ++i) { + mBitmapsOut[i] = Bitmap.createBitmap(mBitmapIn.getWidth(), + mBitmapIn.getHeight(), mBitmapIn.getConfig()); + } + + mImageView = (ImageView) findViewById(R.id.imageView); + mImageView.setImageBitmap(mBitmapsOut[mCurrentBitmap]); + mCurrentBitmap += (mCurrentBitmap + 1) % NUM_BITMAPS; + + //Set up seekbar + final SeekBar seekbar = (SeekBar) findViewById(R.id.seekBar1); + seekbar.setProgress(50); + seekbar.setOnSeekBarChangeListener(new OnSeekBarChangeListener() { + public void onProgressChanged(SeekBar seekBar, int progress, + boolean fromUser) { + updateImage(progress); + } + + @Override + public void onStartTrackingTouch(SeekBar seekBar) { + } + + @Override + public void onStopTrackingTouch(SeekBar seekBar) { + } + }); + + //Setup effect selector + RadioButton radio0 = (RadioButton) findViewById(R.id.radio0); + radio0.setOnCheckedChangeListener(new OnCheckedChangeListener() { + + @Override + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { + if (isChecked) { + mFilterMode = MODE_BLUR; + updateImage(seekbar.getProgress()); + } + } + }); + RadioButton radio1 = (RadioButton) findViewById(R.id.radio1); + radio1.setOnCheckedChangeListener(new OnCheckedChangeListener() { + + @Override + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { + if (isChecked) { + mFilterMode = MODE_CONVOLVE; + updateImage(seekbar.getProgress()); + } + } + }); + RadioButton radio2 = (RadioButton) findViewById(R.id.radio2); + radio2.setOnCheckedChangeListener(new OnCheckedChangeListener() { + + @Override + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { + if (isChecked) { + mFilterMode = MODE_COLORMATRIX; + updateImage(seekbar.getProgress()); + } + } + }); + + /* + * Create renderScript + */ + createScript(); + + /* + * Create thumbnails + */ + createThumbnail(); + + + /* + * Invoke renderScript kernel and update imageView + */ + mFilterMode = MODE_BLUR; + updateImage(50); + } + + private void createScript() { + mRS = RenderScript.create(this); + + mInAllocation = Allocation.createFromBitmap(mRS, mBitmapIn); + + mOutAllocations = new Allocation[NUM_BITMAPS]; + for (int i = 0; i < NUM_BITMAPS; ++i) { + mOutAllocations[i] = Allocation.createFromBitmap(mRS, mBitmapsOut[i]); + } + + /* + Create intrinsics. + RenderScript has built-in features such as blur, convolve filter etc. + These intrinsics are handy for specific operations without writing RenderScript kernel. + In the sample, it's creating blur, convolve and matrix intrinsics. + */ + + mScriptBlur = ScriptIntrinsicBlur.create(mRS, Element.U8_4(mRS)); + mScriptConvolve = ScriptIntrinsicConvolve5x5.create(mRS, + Element.U8_4(mRS)); + mScriptMatrix = ScriptIntrinsicColorMatrix.create(mRS, + Element.U8_4(mRS)); + } + + private void performFilter(Allocation inAllocation, + Allocation outAllocation, Bitmap bitmapOut, float value) { + switch (mFilterMode) { + case MODE_BLUR: + /* + * Set blur kernel size + */ + mScriptBlur.setRadius(value); + + /* + * Invoke filter kernel + */ + mScriptBlur.setInput(inAllocation); + mScriptBlur.forEach(outAllocation); + break; + case MODE_CONVOLVE: { + float f1 = value; + float f2 = 1.0f - f1; + + // Emboss filter kernel + float coefficients[] = {-f1 * 2, 0, -f1, 0, 0, 0, -f2 * 2, -f2, 0, + 0, -f1, -f2, 1, f2, f1, 0, 0, f2, f2 * 2, 0, 0, 0, f1, 0, + f1 * 2,}; + /* + * Set kernel parameter + */ + mScriptConvolve.setCoefficients(coefficients); + + /* + * Invoke filter kernel + */ + mScriptConvolve.setInput(inAllocation); + mScriptConvolve.forEach(outAllocation); + break; + } + case MODE_COLORMATRIX: { + /* + * Set HUE rotation matrix + * The matrix below performs a combined operation of, + * RGB->HSV transform * HUE rotation * HSV->RGB transform + */ + float cos = (float) Math.cos((double) value); + float sin = (float) Math.sin((double) value); + Matrix3f mat = new Matrix3f(); + mat.set(0, 0, (float) (.299 + .701 * cos + .168 * sin)); + mat.set(1, 0, (float) (.587 - .587 * cos + .330 * sin)); + mat.set(2, 0, (float) (.114 - .114 * cos - .497 * sin)); + mat.set(0, 1, (float) (.299 - .299 * cos - .328 * sin)); + mat.set(1, 1, (float) (.587 + .413 * cos + .035 * sin)); + mat.set(2, 1, (float) (.114 - .114 * cos + .292 * sin)); + mat.set(0, 2, (float) (.299 - .3 * cos + 1.25 * sin)); + mat.set(1, 2, (float) (.587 - .588 * cos - 1.05 * sin)); + mat.set(2, 2, (float) (.114 + .886 * cos - .203 * sin)); + mScriptMatrix.setColorMatrix(mat); + + /* + * Invoke filter kernel + */ + mScriptMatrix.forEach(inAllocation, outAllocation); + } + break; + } + + /* + * Copy to bitmap and invalidate image view + */ + outAllocation.copyTo(bitmapOut); + } + + /* + Convert seekBar progress parameter (0-100 in range) to parameter for each intrinsic filter. + (e.g. 1.0-25.0 in Blur filter) + */ + private float getFilterParameter(int i) { + float f = 0.f; + switch (mFilterMode) { + case MODE_BLUR: { + final float max = 25.0f; + final float min = 1.f; + f = (float) ((max - min) * (i / 100.0) + min); + } + break; + case MODE_CONVOLVE: { + final float max = 2.f; + final float min = 0.f; + f = (float) ((max - min) * (i / 100.0) + min); + } + break; + case MODE_COLORMATRIX: { + final float max = (float) Math.PI; + final float min = (float) -Math.PI; + f = (float) ((max - min) * (i / 100.0) + min); + } + break; + } + return f; + + } + + /* + * In the AsyncTask, it invokes RenderScript intrinsics to do a filtering. + * After the filtering is done, an operation blocks at Allication.copyTo() in AsyncTask thread. + * Once all operation is finished at onPostExecute() in UI thread, it can invalidate and update ImageView UI. + */ + private class RenderScriptTask extends AsyncTask<Float, Integer, Integer> { + Boolean issued = false; + + protected Integer doInBackground(Float... values) { + int index = -1; + if (isCancelled() == false) { + issued = true; + index = mCurrentBitmap; + + performFilter(mInAllocation, mOutAllocations[index], mBitmapsOut[index], values[0]); + mCurrentBitmap = (mCurrentBitmap + 1) % NUM_BITMAPS; + } + return index; + } + + void updateView(Integer result) { + if (result != -1) { + // Request UI update + mImageView.setImageBitmap(mBitmapsOut[result]); + mImageView.invalidate(); + } + } + + protected void onPostExecute(Integer result) { + updateView(result); + } + + protected void onCancelled(Integer result) { + if (issued) { + updateView(result); + } + } + } + + /* + Invoke AsynchTask and cancel previous task. + When AsyncTasks are piled up (typically in slow device with heavy kernel), + Only the latest (and already started) task invokes RenderScript operation. + */ + private void updateImage(int progress) { + float f = getFilterParameter(progress); + + if (mLatestTask != null) + mLatestTask.cancel(false); + mLatestTask = new RenderScriptTask(); + + mLatestTask.execute(f); + } + + /* + Helper to load Bitmap from resource + */ + private Bitmap loadBitmap(int resource) { + final BitmapFactory.Options options = new BitmapFactory.Options(); + options.inPreferredConfig = Bitmap.Config.ARGB_8888; + return BitmapFactory.decodeResource(getResources(), resource, options); + } + + /* + Create thumbNail for UI. It invokes RenderScript kernel synchronously in UI-thread, + which is OK for small thumbnail (but not ideal). + */ + private void createThumbnail() { + int width = 72; + int height = 96; + float scale = getResources().getDisplayMetrics().density; + int pixelsWidth = (int) (width * scale + 0.5f); + int pixelsHeight = (int) (height * scale + 0.5f); + + //Temporary image + Bitmap tempBitmap = Bitmap.createScaledBitmap(mBitmapIn, pixelsWidth, pixelsHeight, false); + Allocation inAllocation = Allocation.createFromBitmap(mRS, tempBitmap); + + //Create thumbnail with each RS intrinsic and set it to radio buttons + int[] modes = {MODE_BLUR, MODE_CONVOLVE, MODE_COLORMATRIX}; + int[] ids = {R.id.radio0, R.id.radio1, R.id.radio2}; + int[] parameter = {50, 100, 25}; + for (int mode : modes) { + mFilterMode = mode; + float f = getFilterParameter(parameter[mode]); + + Bitmap destBitpmap = Bitmap.createBitmap(tempBitmap.getWidth(), + tempBitmap.getHeight(), tempBitmap.getConfig()); + Allocation outAllocation = Allocation.createFromBitmap(mRS, destBitpmap); + performFilter(inAllocation, outAllocation, destBitpmap, f); + + ThumbnailRadioButton button = (ThumbnailRadioButton) findViewById(ids[mode]); + button.setThumbnail(destBitpmap); + } + } +} diff --git a/renderScript/RenderScriptIntrinsic/RenderScriptIntrinsicSample/src/main/java/com/example/android/renderscriptintrinsic/ThumbnailRadioButton.java b/renderScript/RenderScriptIntrinsic/RenderScriptIntrinsicSample/src/main/java/com/example/android/renderscriptintrinsic/ThumbnailRadioButton.java new file mode 100644 index 00000000..160e970b --- /dev/null +++ b/renderScript/RenderScriptIntrinsic/RenderScriptIntrinsicSample/src/main/java/com/example/android/renderscriptintrinsic/ThumbnailRadioButton.java @@ -0,0 +1,111 @@ +/* + * Copyright (C) 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.android.renderscriptintrinsic; + +import android.graphics.Bitmap; +import android.graphics.Color; +import android.graphics.Paint; +import android.graphics.drawable.BitmapDrawable; +import android.graphics.drawable.Drawable; +import android.graphics.drawable.LayerDrawable; +import android.graphics.drawable.ShapeDrawable; +import android.graphics.drawable.StateListDrawable; +import android.graphics.drawable.shapes.RectShape; +import android.os.Build; +import android.view.Gravity; +import android.widget.RadioButton; +import android.content.Context; +import android.util.AttributeSet; + +/* + A button with Thumbnail which extends Radio Button. + The widget override a background drawable of Radio Button with a StateList Drawable. + Each state has a LayerDrawable with a Thumbnail image and a Focus rectangle. + It's using original Radio Buttons text as a label, because LayerDrawable showed some issues with Canvas.drawText(). + */ +public class ThumbnailRadioButton extends RadioButton { + public ThumbnailRadioButton(Context context) { + super(context); + init(); + } + + public ThumbnailRadioButton(Context context, AttributeSet attrs) { + super(context, attrs); + init(); + } + + public ThumbnailRadioButton(Context context, AttributeSet attrs, int defStyle) { + super(context, attrs, defStyle); + init(); + } + + private void init() { + setButtonDrawable(android.R.color.transparent); + } + + public void setThumbnail(Bitmap bitmap) { + //Bitmap drawable + BitmapDrawable bmp = new BitmapDrawable(getResources(), bitmap); + bmp.setGravity(Gravity.CENTER); + + int strokeWidth = 24; + //Checked state + ShapeDrawable rectChecked = new ShapeDrawable(new RectShape()); + rectChecked.getPaint().setColor(0xFFFFFFFF); + rectChecked.getPaint().setStyle(Paint.Style.STROKE); + rectChecked.getPaint().setStrokeWidth(strokeWidth); + rectChecked.setIntrinsicWidth(bitmap.getWidth() + strokeWidth); + rectChecked.setIntrinsicHeight(bitmap.getHeight() + strokeWidth); + Drawable drawableArray[] = new Drawable[]{bmp, rectChecked}; + LayerDrawable layerChecked = new LayerDrawable(drawableArray); + + //Unchecked state + ShapeDrawable rectUnchecked = new ShapeDrawable(new RectShape()); + rectUnchecked.getPaint().setColor(0x0); + rectUnchecked.getPaint().setStyle(Paint.Style.STROKE); + rectUnchecked.getPaint().setStrokeWidth(strokeWidth); + rectUnchecked.setIntrinsicWidth(bitmap.getWidth() + strokeWidth); + rectUnchecked.setIntrinsicHeight(bitmap.getHeight() + strokeWidth); + Drawable drawableArray2[] = new Drawable[]{bmp, rectUnchecked}; + LayerDrawable layerUnchecked = new LayerDrawable(drawableArray2); + + //Statelist drawable + StateListDrawable states = new StateListDrawable(); + states.addState(new int[]{android.R.attr.state_checked}, + layerChecked); + states.addState(new int[]{}, + layerUnchecked); + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) + setBackground(states); + else + setBackgroundDrawable(states); + + //Offset text to center/bottom of the checkbox + Paint paint = new Paint(); + paint.setAntiAlias(true); + paint.setTextSize(getTextSize()); + paint.setTypeface(getTypeface()); + float w = paint.measureText(getText(), 0, getText().length()); + setPadding(getPaddingLeft() + (int) ((bitmap.getWidth() - w) / 2.f + .5f), + getPaddingTop() + (int) (bitmap.getHeight() * 0.70), + getPaddingRight(), + getPaddingBottom()); + + setShadowLayer(5, 0, 0, Color.BLACK); + } +} diff --git a/renderScript/RenderScriptIntrinsic/RenderScriptIntrinsicSample/src/main/res/drawable-hdpi/ic_launcher.png b/renderScript/RenderScriptIntrinsic/RenderScriptIntrinsicSample/src/main/res/drawable-hdpi/ic_launcher.png Binary files differnew file mode 100755 index 00000000..75b3c978 --- /dev/null +++ b/renderScript/RenderScriptIntrinsic/RenderScriptIntrinsicSample/src/main/res/drawable-hdpi/ic_launcher.png diff --git a/renderScript/RenderScriptIntrinsic/RenderScriptIntrinsicSample/src/main/res/drawable-mdpi/ic_launcher.png b/renderScript/RenderScriptIntrinsic/RenderScriptIntrinsicSample/src/main/res/drawable-mdpi/ic_launcher.png Binary files differnew file mode 100755 index 00000000..4ccd98e0 --- /dev/null +++ b/renderScript/RenderScriptIntrinsic/RenderScriptIntrinsicSample/src/main/res/drawable-mdpi/ic_launcher.png diff --git a/renderScript/RenderScriptIntrinsic/RenderScriptIntrinsicSample/src/main/res/drawable-nodpi/data.jpg b/renderScript/RenderScriptIntrinsic/RenderScriptIntrinsicSample/src/main/res/drawable-nodpi/data.jpg Binary files differnew file mode 100644 index 00000000..48e48e61 --- /dev/null +++ b/renderScript/RenderScriptIntrinsic/RenderScriptIntrinsicSample/src/main/res/drawable-nodpi/data.jpg diff --git a/renderScript/RenderScriptIntrinsic/RenderScriptIntrinsicSample/src/main/res/drawable-xhdpi/ic_launcher.png b/renderScript/RenderScriptIntrinsic/RenderScriptIntrinsicSample/src/main/res/drawable-xhdpi/ic_launcher.png Binary files differnew file mode 100755 index 00000000..7c5aeed0 --- /dev/null +++ b/renderScript/RenderScriptIntrinsic/RenderScriptIntrinsicSample/src/main/res/drawable-xhdpi/ic_launcher.png diff --git a/renderScript/RenderScriptIntrinsic/RenderScriptIntrinsicSample/src/main/res/drawable-xxhdpi/ic_launcher.png b/renderScript/RenderScriptIntrinsic/RenderScriptIntrinsicSample/src/main/res/drawable-xxhdpi/ic_launcher.png Binary files differnew file mode 100755 index 00000000..3c45f511 --- /dev/null +++ b/renderScript/RenderScriptIntrinsic/RenderScriptIntrinsicSample/src/main/res/drawable-xxhdpi/ic_launcher.png diff --git a/renderScript/RenderScriptIntrinsic/RenderScriptIntrinsicSample/src/main/res/layout/main_layout.xml b/renderScript/RenderScriptIntrinsic/RenderScriptIntrinsicSample/src/main/res/layout/main_layout.xml new file mode 100644 index 00000000..13516d8c --- /dev/null +++ b/renderScript/RenderScriptIntrinsic/RenderScriptIntrinsicSample/src/main/res/layout/main_layout.xml @@ -0,0 +1,51 @@ +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:background="#0099cc" + tools:context=".MainActivity"> + + <ImageView + android:id="@+id/imageView" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:scaleType="centerCrop" + android:src="@drawable/data" /> + + <RadioGroup + android:id="@+id/radioGroup1" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_centerHorizontal="true" + android:orientation="horizontal" + android:layout_above="@+id/seekBar1" + android:layout_marginBottom="8dp"> + + <com.example.android.renderscriptintrinsic.ThumbnailRadioButton + android:id="@+id/radio0" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:checked="true" + android:text="Blur" /> + + <com.example.android.renderscriptintrinsic.ThumbnailRadioButton + android:id="@+id/radio1" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="Emboss" /> + + <com.example.android.renderscriptintrinsic.ThumbnailRadioButton + android:id="@+id/radio2" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="Hue" /> + </RadioGroup> + + <SeekBar + android:id="@+id/seekBar1" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_alignParentBottom="true" + android:layout_marginBottom="16dp" /> + +</RelativeLayout> diff --git a/renderScript/RenderScriptIntrinsic/RenderScriptIntrinsicSample/src/main/res/values-v11/styles.xml b/renderScript/RenderScriptIntrinsic/RenderScriptIntrinsicSample/src/main/res/values-v11/styles.xml new file mode 100644 index 00000000..f3a90c68 --- /dev/null +++ b/renderScript/RenderScriptIntrinsic/RenderScriptIntrinsicSample/src/main/res/values-v11/styles.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + + <!-- + Base application theme for API 11+. This theme completely replaces + AppBaseTheme from res/values/styles.xml on API 11+ devices. + --> + <style name="AppBaseTheme" parent="android:Theme.Holo.Light"> + <!-- API 11 theme customizations can go here. --> + </style> + + <style name="FullscreenTheme" parent="android:Theme.Holo"> + <item name="android:actionBarStyle">@style/FullscreenActionBarStyle</item> + <item name="android:windowActionBarOverlay">true</item> + <item name="android:windowBackground">@null</item> + <item name="buttonBarStyle">?android:attr/buttonBarStyle</item> + <item name="buttonBarButtonStyle">?android:attr/buttonBarButtonStyle</item> + </style> + + <style name="FullscreenActionBarStyle" parent="android:Widget.Holo.ActionBar"> + <item name="android:background">@color/black_overlay</item> + </style> + +</resources> diff --git a/renderScript/RenderScriptIntrinsic/RenderScriptIntrinsicSample/src/main/res/values-v14/styles.xml b/renderScript/RenderScriptIntrinsic/RenderScriptIntrinsicSample/src/main/res/values-v14/styles.xml new file mode 100644 index 00000000..a91fd037 --- /dev/null +++ b/renderScript/RenderScriptIntrinsic/RenderScriptIntrinsicSample/src/main/res/values-v14/styles.xml @@ -0,0 +1,12 @@ +<resources> + + <!-- + Base application theme for API 14+. This theme completely replaces + AppBaseTheme from BOTH res/values/styles.xml and + res/values-v11/styles.xml on API 14+ devices. + --> + <style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar"> + <!-- API 14 theme customizations can go here. --> + </style> + +</resources> diff --git a/renderScript/RenderScriptIntrinsic/RenderScriptIntrinsicSample/src/main/res/values/attrs.xml b/renderScript/RenderScriptIntrinsic/RenderScriptIntrinsicSample/src/main/res/values/attrs.xml new file mode 100644 index 00000000..e67df0a3 --- /dev/null +++ b/renderScript/RenderScriptIntrinsic/RenderScriptIntrinsicSample/src/main/res/values/attrs.xml @@ -0,0 +1,14 @@ +<resources> + + <!-- + Declare custom theme attributes that allow changing which styles are + used for button bars depending on the API level. + ?android:attr/buttonBarStyle is new as of API 11 so this is + necessary to support previous API levels. + --> + <declare-styleable name="ButtonBarContainerTheme"> + <attr name="buttonBarStyle" format="reference" /> + <attr name="buttonBarButtonStyle" format="reference" /> + </declare-styleable> + +</resources> diff --git a/renderScript/RenderScriptIntrinsic/RenderScriptIntrinsicSample/src/main/res/values/colors.xml b/renderScript/RenderScriptIntrinsic/RenderScriptIntrinsicSample/src/main/res/values/colors.xml new file mode 100644 index 00000000..327c0604 --- /dev/null +++ b/renderScript/RenderScriptIntrinsic/RenderScriptIntrinsicSample/src/main/res/values/colors.xml @@ -0,0 +1,5 @@ +<resources> + + <color name="black_overlay">#66000000</color> + +</resources> diff --git a/renderScript/RenderScriptIntrinsic/RenderScriptIntrinsicSample/src/main/res/values/styles.xml b/renderScript/RenderScriptIntrinsic/RenderScriptIntrinsicSample/src/main/res/values/styles.xml new file mode 100644 index 00000000..9cecf825 --- /dev/null +++ b/renderScript/RenderScriptIntrinsic/RenderScriptIntrinsicSample/src/main/res/values/styles.xml @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + + <!-- + Base application theme, dependent on API level. This theme is replaced + by AppBaseTheme from res/values-vXX/styles.xml on newer devices. + --> + <style name="AppBaseTheme" parent="android:Theme.Light"> + <!-- + Theme customizations available in newer API levels can go in + res/values-vXX/styles.xml, while customizations related to + backward-compatibility can go here. + --> + </style> + + <!-- Application theme. --> + <style name="AppTheme" parent="AppBaseTheme"> + <!-- All customizations that are NOT specific to a particular API-level can go here. --> + </style> + + <style name="FullscreenTheme" parent="android:Theme.NoTitleBar"> + <item name="android:windowContentOverlay">@null</item> + <item name="android:windowBackground">@null</item> + <item name="buttonBarStyle">@style/ButtonBar</item> + <item name="buttonBarButtonStyle">@style/ButtonBarButton</item> + </style> + + <style name="ButtonBar"> + <item name="android:paddingLeft">2dp</item> + <item name="android:paddingTop">5dp</item> + <item name="android:paddingRight">2dp</item> + <item name="android:paddingBottom">0dp</item> + <item name="android:background">@android:drawable/bottom_bar</item> + </style> + + <style name="ButtonBarButton" /> + +</resources> diff --git a/renderScript/RenderScriptIntrinsic/RenderScriptIntrinsicSample/tests/AndroidManifest.xml b/renderScript/RenderScriptIntrinsic/RenderScriptIntrinsicSample/tests/AndroidManifest.xml new file mode 100644 index 00000000..96fa2079 --- /dev/null +++ b/renderScript/RenderScriptIntrinsic/RenderScriptIntrinsicSample/tests/AndroidManifest.xml @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2014 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + --> +<!-- package name must be unique so suffix with "tests" so package loader doesn't ignore us --> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="com.example.android.renderscriptintrinsic.tests" + android:versionCode="1" + android:versionName="1.0"> + + <uses-sdk + android:minSdkVersion="8" + android:targetSdkVersion="19" /> + + <!-- We add an application tag here just so that we can indicate that + this package needs to link against the android.test library, + which is needed when building test cases. --> + <application> + <uses-library android:name="android.test.runner" /> + </application> + + <!-- + Specifies the instrumentation test runner used to run the tests. + --> + <instrumentation + android:name="android.test.InstrumentationTestRunner" + android:targetPackage="com.example.android.renderscriptintrinsic" + android:label="Tests for com.example.android.renderscriptintrinsic" /> + +</manifest>
\ No newline at end of file diff --git a/renderScript/RenderScriptIntrinsic/RenderScriptIntrinsicSample/tests/src/com/example/android/renderscriptintrinsic/tests/SampleTests.java b/renderScript/RenderScriptIntrinsic/RenderScriptIntrinsicSample/tests/src/com/example/android/renderscriptintrinsic/tests/SampleTests.java new file mode 100644 index 00000000..c1864f0d --- /dev/null +++ b/renderScript/RenderScriptIntrinsic/RenderScriptIntrinsicSample/tests/src/com/example/android/renderscriptintrinsic/tests/SampleTests.java @@ -0,0 +1,79 @@ +/* +* Copyright 2013 The Android Open Source Project +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + + +/* +* Copyright (C) 2013 The Android Open Source Project +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.example.android.renderscriptintrinsic.tests; + +import com.example.android.renderscriptintrinsic.*; + +import android.test.ActivityInstrumentationTestCase2; + +/** +* Tests for RenderScriptIntrinsic sample. +*/ +public class SampleTests extends ActivityInstrumentationTestCase2<MainActivity> { + + private MainActivity mTestActivity; + private RenderScriptIntrinsicFragment mTestFragment; + + public SampleTests() { + super(MainActivity.class); + } + + @Override + protected void setUp() throws Exception { + super.setUp(); + + // Starts the activity under test using the default Intent with: + // action = {@link Intent#ACTION_MAIN} + // flags = {@link Intent#FLAG_ACTIVITY_NEW_TASK} + // All other fields are null or empty. + mTestActivity = getActivity(); + mTestFragment = (RenderScriptIntrinsicFragment) + mTestActivity.getSupportFragmentManager().getFragments().get(1); + } + + /** + * Test if the test fixture has been set up correctly. + */ + public void testPreconditions() { + //Try to add a message to add context to your assertions. These messages will be shown if + //a tests fails and make it easy to understand why a test failed + assertNotNull("mTestActivity is null", mTestActivity); + assertNotNull("mTestFragment is null", mTestFragment); + } + + /** + * Add more tests below. + */ + +}
\ No newline at end of file diff --git a/renderScript/RenderScriptIntrinsic/build.gradle b/renderScript/RenderScriptIntrinsic/build.gradle new file mode 100644 index 00000000..f9f6f652 --- /dev/null +++ b/renderScript/RenderScriptIntrinsic/build.gradle @@ -0,0 +1,14 @@ + + + + +// BEGIN_EXCLUDE +import com.example.android.samples.build.SampleGenPlugin +apply plugin: SampleGenPlugin + +samplegen { + pathToBuild "../../../../build" + pathToSamplesCommon "../../common" +} +apply from: "../../../../build/build.gradle" +// END_EXCLUDE diff --git a/renderScript/RenderScriptIntrinsic/buildSrc/build.gradle b/renderScript/RenderScriptIntrinsic/buildSrc/build.gradle new file mode 100644 index 00000000..29282af4 --- /dev/null +++ b/renderScript/RenderScriptIntrinsic/buildSrc/build.gradle @@ -0,0 +1,18 @@ + + + +repositories { + mavenCentral() +} +dependencies { + compile 'org.freemarker:freemarker:2.3.20' +} + +sourceSets { + main { + groovy { + srcDir new File(rootDir, "../../../../../build/buildSrc/src/main/groovy") + } + } +} + diff --git a/renderScript/RenderScriptIntrinsic/gradle/wrapper/gradle-wrapper.jar b/renderScript/RenderScriptIntrinsic/gradle/wrapper/gradle-wrapper.jar Binary files differnew file mode 100644 index 00000000..58385981 --- /dev/null +++ b/renderScript/RenderScriptIntrinsic/gradle/wrapper/gradle-wrapper.jar diff --git a/renderScript/RenderScriptIntrinsic/gradle/wrapper/gradle-wrapper.properties b/renderScript/RenderScriptIntrinsic/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..0f9e4854 --- /dev/null +++ b/renderScript/RenderScriptIntrinsic/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Thu Jan 30 18:12:33 PST 2014 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=http\://services.gradle.org/distributions/gradle-1.10-bin.zip diff --git a/renderScript/RenderScriptIntrinsic/gradlew b/renderScript/RenderScriptIntrinsic/gradlew new file mode 100755 index 00000000..91a7e269 --- /dev/null +++ b/renderScript/RenderScriptIntrinsic/gradlew @@ -0,0 +1,164 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; +esac + +# For Cygwin, ensure paths are in UNIX format before anything is touched. +if $cygwin ; then + [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` +fi + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >&- +APP_HOME="`pwd -P`" +cd "$SAVED" >&- + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/renderScript/RenderScriptIntrinsic/gradlew.bat b/renderScript/RenderScriptIntrinsic/gradlew.bat new file mode 100644 index 00000000..aec99730 --- /dev/null +++ b/renderScript/RenderScriptIntrinsic/gradlew.bat @@ -0,0 +1,90 @@ +@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windowz variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+if "%@eval[2+2]" == "4" goto 4NT_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+goto execute
+
+:4NT_args
+@rem Get arguments from the 4NT Shell from JP Software
+set CMD_LINE_ARGS=%$
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/renderScript/RenderScriptIntrinsic/settings.gradle b/renderScript/RenderScriptIntrinsic/settings.gradle new file mode 100644 index 00000000..702ca572 --- /dev/null +++ b/renderScript/RenderScriptIntrinsic/settings.gradle @@ -0,0 +1,4 @@ + + + +include 'RenderScriptIntrinsicSample' diff --git a/renderScript/RenderScriptIntrinsic/template-params.xml b/renderScript/RenderScriptIntrinsic/template-params.xml new file mode 100644 index 00000000..fe67f2a1 --- /dev/null +++ b/renderScript/RenderScriptIntrinsic/template-params.xml @@ -0,0 +1,48 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Copyright 2013 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + + + +<sample> + <name>RenderScriptIntrinsic</name> + <group>RenderScript</group> + <package>com.example.android.renderscriptintrinsic</package> + + <!-- change minSdk if needed--> + <minSdk>8</minSdk> + + <dependency_external>'renderscript-v8.jar'</dependency_external> + + <defaultConfig> + renderscriptTargetApi 18 + renderscriptSupportMode true + </defaultConfig> + + <strings> + <intro> + <![CDATA[ + RenderScriptIntrinsic sample that demonstrates how to use RenderScript intrinsics. + Creates several RenderScript intrinsics and shows a filtering result with various parameters. + Also shows how to extends RedioButton with StateListDrawable. + ]]> + </intro> + </strings> + + <template src="base"/> + <common src="logger"/> + +</sample> |