Category: Android Codez | Last Updates: 31/05/2017
Hey Android developer, It's amazing and easy to create bitmap blur effect. Let's see how to do!
RenderScript Support Library
Okay! Now you are ready to use RenderScripts Support Library. Let's start....
I have created a separate java class for create blur effect.
src/BlurMaker.java
In our activity class,
RenderScripts data from Wikipedia
RenderScript Support Library
In this project We are going to use RenderScript Support Library. First of all let's learn something about the RenderScript.
- RenderScript is a component of the Android operating system for mobile devices, that takes advantage of heterogeneous hardware to offer an API for performance acceleration.
- It allows developers to increase the performance of their applications at the cost of writing a greater amount of more complex code.
- It provides the developer three primary tools:
- A general purpose compute API across different system computing hardware
- A compute API similar to CUDA, OpenCL or GLSL
- A familiar C99-derived language
- It can also be used for 3D graphics. Android 4.2 added new capabilities to script intrinsics, such as Blend and Blur; as well as ScriptGroups which allow you to chain together related RenderScript scripts and execute them with one call.
Using RenderScripts Support Library
In Android Studio Project Add the following configuration to project build.gradle
defaultConfig { minSdkVersion 11 targetSdkVersion 24
//add this two lines renderscriptTargetApi 19 renderscriptSupportModeEnabled true }
Okay! Now you are ready to use RenderScripts Support Library. Let's start....
I have created a separate java class for create blur effect.
src/BlurMaker.java
In our activity class,
ImageView imageView = (ImageView) findViewById(R.id.imageView); Bitmap srcBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.my_img);
imageView.setImageBitmap(BlurMaker.createBlur(getApplicationContext(), srcBitmap, 7.5f));
RenderScripts data from Wikipedia
No comments :
Post a Comment