Book Image

Android NDK: Beginner's Guide

By : Sylvain Ratabouil
Book Image

Android NDK: Beginner's Guide

By: Sylvain Ratabouil

Overview of this book

Table of Contents (18 chapters)
Android NDK Beginner's Guide Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Time for action – writing a luminance threshold filter


Let's append a new component to our UI and implement the new image filter.

  1. Add a new Threshold SeekBar and Button in res/activity_renderscript.xml:

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout
      xmlns:a="http://schemas.android.com/apk/res/android"
      a:layout_width="fill_parent" a:layout_height="fill_parent"
      a:layout_weight="1" a:orientation="vertical" >
      <LinearLayout 
        a:orientation="horizontal"
        a:layout_width="fill_parent" a:layout_height="wrap_content" >
        ...
        <SeekBar a:id="@+id/thresholdBar" a:max="100"
          a:layout_gravity="center_vertical"
          a:layout_width="128dp" a:layout_height="wrap_content" />
        <Button a:id="@+id/thresholdButton" a:text="Threshold"
          a:layout_width="wrap_content" a:layout_height="wrap_content"/>
      </LinearLayout>
      <LinearLayout 
        a:baselineAligned="true" a:orientation="horizontal"
        a:layout_width="fill_parent" a:layout_height...