Full Code of chiuki/android-graphics-demo for AI

master 98209d5b9167 cached
51 files
67.8 KB
18.2k tokens
91 symbols
1 requests
Download .txt
Repository: chiuki/android-graphics-demo
Branch: master
Commit: 98209d5b9167
Files: 51
Total size: 67.8 KB

Directory structure:
gitextract_megs46ev/

├── .gitignore
├── LICENSE
├── README.md
├── app/
│   ├── build.gradle
│   ├── proguard-rules.pro
│   └── src/
│       └── main/
│           ├── AndroidManifest.xml
│           ├── java/
│           │   └── com/
│           │       └── sqisland/
│           │           └── android/
│           │               └── graphics_demo/
│           │                   ├── AboutActivity.java
│           │                   ├── BlurMaskFilterActivity.java
│           │                   ├── ClipRectActivity.java
│           │                   ├── ColorMatrixActivity.java
│           │                   ├── EmbossMaskFilterActivity.java
│           │                   ├── FourColorsActivity.java
│           │                   ├── HollowTextActivity.java
│           │                   ├── MainActivity.java
│           │                   ├── PatternedTextActivity.java
│           │                   ├── PeekThroughActivity.java
│           │                   ├── PorterDuffActivity.java
│           │                   ├── RainbowGradientActivity.java
│           │                   ├── RenderscriptBlurActivity.java
│           │                   ├── RenderscriptConvolutionActivity.java
│           │                   ├── SpinnerImageActivity.java
│           │                   ├── util/
│           │                   │   ├── ImageUtil.java
│           │                   │   └── ViewUtil.java
│           │                   └── widget/
│           │                       ├── FourColorsImageView.java
│           │                       ├── PeekThroughImageView.java
│           │                       └── RainbowTextView.java
│           └── res/
│               ├── layout/
│               │   ├── activity_about.xml
│               │   ├── activity_blur_mask_filter.xml
│               │   ├── activity_clip_rect.xml
│               │   ├── activity_emboss_mask_filter.xml
│               │   ├── activity_four_colors.xml
│               │   ├── activity_hollow_text.xml
│               │   ├── activity_patterned_text.xml
│               │   ├── activity_peek_through.xml
│               │   ├── activity_rainbow_text.xml
│               │   └── activity_spinner_image.xml
│               ├── values/
│               │   ├── colors.xml
│               │   ├── dimens.xml
│               │   ├── strings.xml
│               │   └── styles.xml
│               ├── values-v11/
│               │   └── styles.xml
│               ├── values-v14/
│               │   └── styles.xml
│               ├── values-v21/
│               │   └── styles.xml
│               └── values-w820dp/
│                   └── dimens.xml
├── build.gradle
├── gradle/
│   └── wrapper/
│       ├── gradle-wrapper.jar
│       └── gradle-wrapper.properties
├── gradle.properties
├── gradlew
├── gradlew.bat
└── settings.gradle

================================================
FILE CONTENTS
================================================

================================================
FILE: .gitignore
================================================
.DS_Store
.idea/*
.gradle
local.properties
/*/out
build
*.iml
*.iws
*.ipr
*.swp
*.apk
*.ap_


================================================
FILE: LICENSE
================================================
Apache License
                           Version 2.0, January 2004
                        http://www.apache.org/licenses/

   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

   1. Definitions.

      "License" shall mean the terms and conditions for use, reproduction,
      and distribution as defined by Sections 1 through 9 of this document.

      "Licensor" shall mean the copyright owner or entity authorized by
      the copyright owner that is granting the License.

      "Legal Entity" shall mean the union of the acting entity and all
      other entities that control, are controlled by, or are under common
      control with that entity. For the purposes of this definition,
      "control" means (i) the power, direct or indirect, to cause the
      direction or management of such entity, whether by contract or
      otherwise, or (ii) ownership of fifty percent (50%) or more of the
      outstanding shares, or (iii) beneficial ownership of such entity.

      "You" (or "Your") shall mean an individual or Legal Entity
      exercising permissions granted by this License.

      "Source" form shall mean the preferred form for making modifications,
      including but not limited to software source code, documentation
      source, and configuration files.

      "Object" form shall mean any form resulting from mechanical
      transformation or translation of a Source form, including but
      not limited to compiled object code, generated documentation,
      and conversions to other media types.

      "Work" shall mean the work of authorship, whether in Source or
      Object form, made available under the License, as indicated by a
      copyright notice that is included in or attached to the work
      (an example is provided in the Appendix below).

      "Derivative Works" shall mean any work, whether in Source or Object
      form, that is based on (or derived from) the Work and for which the
      editorial revisions, annotations, elaborations, or other modifications
      represent, as a whole, an original work of authorship. For the purposes
      of this License, Derivative Works shall not include works that remain
      separable from, or merely link (or bind by name) to the interfaces of,
      the Work and Derivative Works thereof.

      "Contribution" shall mean any work of authorship, including
      the original version of the Work and any modifications or additions
      to that Work or Derivative Works thereof, that is intentionally
      submitted to Licensor for inclusion in the Work by the copyright owner
      or by an individual or Legal Entity authorized to submit on behalf of
      the copyright owner. For the purposes of this definition, "submitted"
      means any form of electronic, verbal, or written communication sent
      to the Licensor or its representatives, including but not limited to
      communication on electronic mailing lists, source code control systems,
      and issue tracking systems that are managed by, or on behalf of, the
      Licensor for the purpose of discussing and improving the Work, but
      excluding communication that is conspicuously marked or otherwise
      designated in writing by the copyright owner as "Not a Contribution."

      "Contributor" shall mean Licensor and any individual or Legal Entity
      on behalf of whom a Contribution has been received by Licensor and
      subsequently incorporated within the Work.

   2. Grant of Copyright License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      copyright license to reproduce, prepare Derivative Works of,
      publicly display, publicly perform, sublicense, and distribute the
      Work and such Derivative Works in Source or Object form.

   3. Grant of Patent License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      (except as stated in this section) patent license to make, have made,
      use, offer to sell, sell, import, and otherwise transfer the Work,
      where such license applies only to those patent claims licensable
      by such Contributor that are necessarily infringed by their
      Contribution(s) alone or by combination of their Contribution(s)
      with the Work to which such Contribution(s) was submitted. If You
      institute patent litigation against any entity (including a
      cross-claim or counterclaim in a lawsuit) alleging that the Work
      or a Contribution incorporated within the Work constitutes direct
      or contributory patent infringement, then any patent licenses
      granted to You under this License for that Work shall terminate
      as of the date such litigation is filed.

   4. Redistribution. You may reproduce and distribute copies of the
      Work or Derivative Works thereof in any medium, with or without
      modifications, and in Source or Object form, provided that You
      meet the following conditions:

      (a) You must give any other recipients of the Work or
          Derivative Works a copy of this License; and

      (b) You must cause any modified files to carry prominent notices
          stating that You changed the files; and

      (c) You must retain, in the Source form of any Derivative Works
          that You distribute, all copyright, patent, trademark, and
          attribution notices from the Source form of the Work,
          excluding those notices that do not pertain to any part of
          the Derivative Works; and

      (d) If the Work includes a "NOTICE" text file as part of its
          distribution, then any Derivative Works that You distribute must
          include a readable copy of the attribution notices contained
          within such NOTICE file, excluding those notices that do not
          pertain to any part of the Derivative Works, in at least one
          of the following places: within a NOTICE text file distributed
          as part of the Derivative Works; within the Source form or
          documentation, if provided along with the Derivative Works; or,
          within a display generated by the Derivative Works, if and
          wherever such third-party notices normally appear. The contents
          of the NOTICE file are for informational purposes only and
          do not modify the License. You may add Your own attribution
          notices within Derivative Works that You distribute, alongside
          or as an addendum to the NOTICE text from the Work, provided
          that such additional attribution notices cannot be construed
          as modifying the License.

      You may add Your own copyright statement to Your modifications and
      may provide additional or different license terms and conditions
      for use, reproduction, or distribution of Your modifications, or
      for any such Derivative Works as a whole, provided Your use,
      reproduction, and distribution of the Work otherwise complies with
      the conditions stated in this License.

   5. Submission of Contributions. Unless You explicitly state otherwise,
      any Contribution intentionally submitted for inclusion in the Work
      by You to the Licensor shall be under the terms and conditions of
      this License, without any additional terms or conditions.
      Notwithstanding the above, nothing herein shall supersede or modify
      the terms of any separate license agreement you may have executed
      with Licensor regarding such Contributions.

   6. Trademarks. This License does not grant permission to use the trade
      names, trademarks, service marks, or product names of the Licensor,
      except as required for reasonable and customary use in describing the
      origin of the Work and reproducing the content of the NOTICE file.

   7. Disclaimer of Warranty. Unless required by applicable law or
      agreed to in writing, Licensor provides the Work (and each
      Contributor provides its Contributions) on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
      implied, including, without limitation, any warranties or conditions
      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
      PARTICULAR PURPOSE. You are solely responsible for determining the
      appropriateness of using or redistributing the Work and assume any
      risks associated with Your exercise of permissions under this License.

   8. Limitation of Liability. In no event and under no legal theory,
      whether in tort (including negligence), contract, or otherwise,
      unless required by applicable law (such as deliberate and grossly
      negligent acts) or agreed to in writing, shall any Contributor be
      liable to You for damages, including any direct, indirect, special,
      incidental, or consequential damages of any character arising as a
      result of this License or out of the use or inability to use the
      Work (including but not limited to damages for loss of goodwill,
      work stoppage, computer failure or malfunction, or any and all
      other commercial damages or losses), even if such Contributor
      has been advised of the possibility of such damages.

   9. Accepting Warranty or Additional Liability. While redistributing
      the Work or Derivative Works thereof, You may choose to offer,
      and charge a fee for, acceptance of support, warranty, indemnity,
      or other liability obligations and/or rights consistent with this
      License. However, in accepting such obligations, You may act only
      on Your own behalf and on Your sole responsibility, not on behalf
      of any other Contributor, and only if You agree to indemnify,
      defend, and hold each Contributor harmless for any liability
      incurred by, or claims asserted against, such Contributor by reason
      of your accepting any such warranty or additional liability.

   END OF TERMS AND CONDITIONS

   APPENDIX: How to apply the Apache License to your work.

      To apply the Apache License to your work, attach the following
      boilerplate notice, with the fields enclosed by brackets "{}"
      replaced with your own identifying information. (Don't include
      the brackets!)  The text should be enclosed in the appropriate
      comment syntax for the file format. We also recommend that a
      file or class name and description of purpose be included on the
      same "printed page" as the copyright notice for easier
      identification within third-party archives.

   Copyright 2014 Chiu-Ki Chan

   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.



================================================
FILE: README.md
================================================
Android Graphics Demo
---------------------

Companion app for my [Android Shaders and Filters talk][1], demonstrating:

 * `LinearGradient`
 * `BitmapShader`
 * `ColorMatrixColorFilter`
 * `LightingColorFilter`
 * `PorterDuffXfermode`
 * `EmbossMaskFilter`
 * `BlurMaskFilter`
 * `ScriptIntrinsicBlur`
 * `ScriptIntrinsicConvolve3x3`

  [1]: http://chiuki.github.io/android-shaders-filters


================================================
FILE: app/build.gradle
================================================
apply plugin: 'com.android.application'

android {
  compileSdkVersion 23
  buildToolsVersion "23.0.2"

  defaultConfig {
    applicationId "com.sqisland.android.graphics_demo"
    minSdkVersion 1
    targetSdkVersion 23
    versionCode 2
    versionName "1.1.0"
  }

  buildTypes {
    release {
      minifyEnabled false
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
  }
}

dependencies {
  compile fileTree(dir: 'libs', include: ['*.jar'])
}


================================================
FILE: app/proguard-rules.pro
================================================
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /home/chiuki/dev/android-studio/sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
#   http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
#   public *;
#}


================================================
FILE: app/src/main/AndroidManifest.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="com.sqisland.android.graphics_demo" >

  <application
      android:allowBackup="true"
      android:icon="@drawable/ic_launcher"
      android:label="@string/app_name"
      android:theme="@style/AppTheme" >
    <activity
        android:name=".MainActivity"
        android:label="@string/app_name" >
      <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
      </intent-filter>
    </activity>
    <activity
        android:name=".RainbowGradientActivity"
        android:label="@string/rainbow_gradient"
        android:parentActivityName=".MainActivity" />
    <activity
        android:name=".PatternedTextActivity"
        android:label="@string/patterned_text"
        android:parentActivityName=".MainActivity" />
    <activity
        android:name=".PeekThroughActivity"
        android:label="@string/peek_through"
        android:parentActivityName=".MainActivity" />
    <activity
      android:name=".ClipRectActivity"
      android:label="@string/clip_rect"
      android:parentActivityName=".MainActivity" />
    <activity
        android:name=".ColorMatrixActivity"
        android:label="@string/color_matrix"
        android:parentActivityName=".MainActivity" />
    <activity
        android:name=".FourColorsActivity"
        android:label="@string/four_colors"
        android:parentActivityName=".MainActivity" />
    <activity
        android:name=".PorterDuffActivity"
        android:label="@string/porter_duff"
        android:parentActivityName=".MainActivity" />
    <activity
        android:name=".HollowTextActivity"
        android:label="@string/hollow_text"
        android:parentActivityName=".MainActivity" />
    <activity
        android:name=".EmbossMaskFilterActivity"
        android:label="@string/emboss_mask_filter"
        android:parentActivityName=".MainActivity" />
    <activity
        android:name=".BlurMaskFilterActivity"
        android:label="@string/blur_mask_filter"
        android:parentActivityName=".MainActivity" />
    <activity
        android:name=".RenderscriptBlurActivity"
        android:label="@string/renderscript_blur"
        android:parentActivityName=".MainActivity" />
    <activity
        android:name=".RenderscriptConvolutionActivity"
        android:label="@string/renderscript_convolution"
        android:parentActivityName=".MainActivity" />
    <activity
        android:name=".AboutActivity"
        android:label="@string/about"
        android:parentActivityName=".MainActivity" />
  </application>

</manifest>


================================================
FILE: app/src/main/java/com/sqisland/android/graphics_demo/AboutActivity.java
================================================
package com.sqisland.android.graphics_demo;

import android.app.Activity;
import android.os.Bundle;
import android.text.Html;
import android.text.method.LinkMovementMethod;
import android.widget.TextView;

public class AboutActivity extends Activity {
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_about);

    TextView textView = (TextView) findViewById(R.id.text);
    String html = getString(R.string.about_text);
    textView.setText(Html.fromHtml(html));
    textView.setMovementMethod(LinkMovementMethod.getInstance());
  }
}

================================================
FILE: app/src/main/java/com/sqisland/android/graphics_demo/BlurMaskFilterActivity.java
================================================
package com.sqisland.android.graphics_demo;

import android.app.Activity;
import android.graphics.BlurMaskFilter;
import android.os.Build;
import android.os.Bundle;
import android.view.Gravity;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.sqisland.android.graphics_demo.util.ViewUtil;

public class BlurMaskFilterActivity extends Activity {
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_blur_mask_filter);

    LinearLayout container = (LinearLayout) findViewById(R.id.container);
    for (BlurMaskFilter.Blur style : BlurMaskFilter.Blur.values()) {
      TextView textView = new TextView(this);
      textView.setTextAppearance(this, R.style.TextAppearance_Huge_Green);
      applyFilter(textView, style);

      LinearLayout.LayoutParams params =  new LinearLayout.LayoutParams(
          ViewGroup.LayoutParams.WRAP_CONTENT,
          ViewGroup.LayoutParams.WRAP_CONTENT);
      params.gravity = Gravity.CENTER;
      container.addView(textView, params);
    }
  }

  private void applyFilter(
      TextView textView, BlurMaskFilter.Blur style) {
    if (Build.VERSION.SDK_INT >= 11) {
      ViewUtil.setSoftwareLayerType(textView);
    }
    textView.setText(style.name());
    BlurMaskFilter filter = new BlurMaskFilter(textView.getTextSize() / 10, style);
    textView.getPaint().setMaskFilter(filter);
  }
}

================================================
FILE: app/src/main/java/com/sqisland/android/graphics_demo/ClipRectActivity.java
================================================
package com.sqisland.android.graphics_demo;

import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.RectF;
import android.os.Bundle;
import android.widget.ImageView;

public class ClipRectActivity extends Activity {
  private Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
  private RectF rect = new RectF();

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_clip_rect);

    ImageView imageView = (ImageView) findViewById(R.id.image);
    int width = getResources().getDimensionPixelSize(R.dimen.clip_rect_width);
    int height = getResources().getDimensionPixelSize(R.dimen.clip_rect_height);

    Bitmap bitmap = createClipRect(width, height);
    imageView.setImageBitmap(bitmap);
  }

  // Assumes width > height
  private Bitmap createClipRect(int width, int height) {
    paint.setColor(Color.GREEN);

    Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
    Canvas canvas = new Canvas(bitmap);
    float radius = height / 2;

    canvas.save();
    canvas.clipRect(0, 0, width, height);

    rect.set(0, 0, width + height, height);
    canvas.drawRoundRect(rect, radius, radius, paint);

    canvas.restore();

    return bitmap;
  }
}

================================================
FILE: app/src/main/java/com/sqisland/android/graphics_demo/ColorMatrixActivity.java
================================================
package com.sqisland.android.graphics_demo;

import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.ColorMatrix;
import android.graphics.ColorMatrixColorFilter;
import android.graphics.Paint;

import java.util.Arrays;
import java.util.List;

public class ColorMatrixActivity extends SpinnerImageActivity {
  protected List<Option> getOptions(Bitmap original) {
    return Arrays.asList(
        new Option(getString(R.string.original), original),
        createOption(original, R.string.grayscale, getGrayscaleColorMatrix()),
        createOption(original, R.string.sepia, getSepiaColorMatrix()),
        createOption(original, R.string.binary, getBinaryColorMatrix()),
        createOption(original, R.string.invert, new ColorMatrix(new float[]{
            -1,  0,  0,  0, 255,
             0, -1,  0,  0, 255,
             0,  0, -1,  0, 255,
             0,  0,  0,  1,   0
        })),
        createOption(original, R.string.alpha_blue, new ColorMatrix(new float[]{
               0,    0,    0, 0,   0,
            0.3f,    0,    0, 0,  50,
               0,    0,    0, 0, 255,
            0.2f, 0.4f, 0.4f, 0, -30
        })),
        createOption(original, R.string.alpha_pink, new ColorMatrix(new float[]{
               0,    0,    0, 0, 255,
               0,    0,    0, 0,   0,
            0.2f,    0,    0, 0,  50,
            0.2f, 0.2f, 0.2f, 0, -20
        }))
    );
  }

  private Option createOption(Bitmap original, int titleId, ColorMatrix colorMatrix) {
    String title = getString(titleId);
    Bitmap bitmap = process(original, colorMatrix);
    return new Option(title, bitmap);
  }

  protected Bitmap process(Bitmap original, ColorMatrix colorMatrix) {
    Bitmap bitmap = Bitmap.createBitmap(
        original.getWidth(), original.getHeight(), Bitmap.Config.ARGB_8888);
    Canvas canvas = new Canvas(bitmap);

    Paint paint = new Paint();
    paint.setColorFilter(new ColorMatrixColorFilter(colorMatrix));
    canvas.drawBitmap(original, 0, 0, paint);

    return bitmap;
  }

  private ColorMatrix getGrayscaleColorMatrix() {
    ColorMatrix colorMatrix = new ColorMatrix();
    colorMatrix.setSaturation(0);
    return colorMatrix;
  }

  private ColorMatrix getSepiaColorMatrix() {
    ColorMatrix colorMatrix = new ColorMatrix();
    colorMatrix.setSaturation(0);

    ColorMatrix colorScale = new ColorMatrix();
    colorScale.setScale(1, 1, 0.8f, 1);

    // Convert to grayscale, then apply brown color
    colorMatrix.postConcat(colorScale);

    return colorMatrix;
  }

  private ColorMatrix getBinaryColorMatrix() {
    ColorMatrix colorMatrix = new ColorMatrix();
    colorMatrix.setSaturation(0);

    float m = 255f;
    float t = -255*128f;
    ColorMatrix threshold = new ColorMatrix(new float[] {
        m, 0, 0, 1, t,
        0, m, 0, 1, t,
        0, 0, m, 1, t,
        0, 0, 0, 1, 0
    });

    // Convert to grayscale, then threshold
    colorMatrix.postConcat(threshold);

    return colorMatrix;
  }
}

================================================
FILE: app/src/main/java/com/sqisland/android/graphics_demo/EmbossMaskFilterActivity.java
================================================
package com.sqisland.android.graphics_demo;

import android.app.Activity;
import android.graphics.EmbossMaskFilter;
import android.os.Build;
import android.os.Bundle;
import android.widget.TextView;

import com.sqisland.android.graphics_demo.util.ViewUtil;

public class EmbossMaskFilterActivity extends Activity {
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_emboss_mask_filter);

    TextView emboss = (TextView) findViewById(R.id.emboss);
    applyFilter(emboss, new float[] { 0f, 1f, 0.5f }, 0.8f, 3f, 3f);

    // Deboss parameters from http://wiresareobsolete.com/2012/04/textview-inner-shadows/
    TextView deboss = (TextView) findViewById(R.id.deboss);
    applyFilter(deboss, new float[] { 0f, -1f, 0.5f }, 0.8f, 15f, 1f);
  }

  private void applyFilter(
      TextView textView, float[] direction, float ambient, float specular, float blurRadius) {
    if (Build.VERSION.SDK_INT >= 11) {
      ViewUtil.setSoftwareLayerType(textView);
    }
    EmbossMaskFilter filter = new EmbossMaskFilter(direction, ambient, specular, blurRadius);
    textView.getPaint().setMaskFilter(filter);
  }
}

================================================
FILE: app/src/main/java/com/sqisland/android/graphics_demo/FourColorsActivity.java
================================================
package com.sqisland.android.graphics_demo;

import android.app.Activity;
import android.os.Bundle;

public class FourColorsActivity extends Activity {
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_four_colors);
  }
}

================================================
FILE: app/src/main/java/com/sqisland/android/graphics_demo/HollowTextActivity.java
================================================
package com.sqisland.android.graphics_demo;

import android.app.Activity;
import android.graphics.Canvas;
import android.graphics.ComposePathEffect;
import android.graphics.CornerPathEffect;
import android.graphics.DashPathEffect;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.PathDashPathEffect;
import android.graphics.PathEffect;
import android.os.Bundle;
import android.text.SpannableString;
import android.text.style.ReplacementSpan;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Spinner;
import android.widget.TextView;

import java.util.Arrays;
import java.util.List;

public class HollowTextActivity extends Activity {
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_hollow_text);

    final TextView textView = (TextView) findViewById(R.id.text);

    int strokeWidth =
        getResources().getDimensionPixelSize(R.dimen.dashed_text_stroke_width);
    final HollowSpan span = new HollowSpan(strokeWidth);

    String text = textView.getText().toString();
    final SpannableString spannableString = new SpannableString(text);
    spannableString.setSpan(span, 0, text.length(), 0);

    final Spinner spinner = (Spinner) findViewById(R.id.spinner);
    final List<Option> options = Arrays.asList(
        new Option(getString(R.string.solid), null),
        new Option(getString(R.string.dash), getDashPathEffect(strokeWidth)),
        new Option(getString(R.string.round_dash), getCornerDashPathEffect(strokeWidth)),
        new Option(getString(R.string.triangle), getTrianglePathEffect(strokeWidth))
    );
    ArrayAdapter<Option> adapter = new ArrayAdapter<Option>(
        this, android.R.layout.simple_spinner_item, options);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    spinner.setAdapter(adapter);
    spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
      @Override
      public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
        Option option = options.get(position);
        span.setPathEffect(option.effect);
        textView.setText(spannableString, TextView.BufferType.SPANNABLE);
      }
      @Override
      public void onNothingSelected(AdapterView<?> parent) {
      }
    });
  }

  private PathEffect getDashPathEffect(int strokeWidth) {
    return new DashPathEffect(new float[] { strokeWidth * 3, strokeWidth }, 0);
  }

  private PathEffect getCornerDashPathEffect(int strokeWidth) {
    PathEffect dash = getDashPathEffect(strokeWidth);
    PathEffect corner = new CornerPathEffect(strokeWidth);
    return new ComposePathEffect(dash, corner);
  }

  private PathEffect getTrianglePathEffect(int strokeWidth) {
    return new PathDashPathEffect(
        getTriangle(strokeWidth),
        strokeWidth,
        0.0f,
        PathDashPathEffect.Style.ROTATE);
  }

  private Path getTriangle(float size) {
    Path path = new Path();
    float half = size / 2;
    path.moveTo(-half, -half);
    path.lineTo(half, -half);
    path.lineTo(0, half);
    path.close();
    return path;
  }

  private static class HollowSpan extends ReplacementSpan {
    private final Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
    private final Path path = new Path();
    private int width;

    public HollowSpan(int strokeWidth) {
      paint.setStyle(Paint.Style.STROKE);
      paint.setStrokeWidth(strokeWidth);
    }

    public void setPathEffect(PathEffect effect) {
      paint.setPathEffect(effect);
    }

    @Override
    public int getSize(
        Paint paint, CharSequence text, int start, int end, Paint.FontMetricsInt fm) {
      this.paint.setColor(paint.getColor());

      width = (int) (paint.measureText(text, start, end) + this.paint.getStrokeWidth());
      return width;
    }

    @Override
    public void draw(
        Canvas canvas, CharSequence text, int start, int end,
        float x, int top, int y, int bottom, Paint paint) {
      path.reset();
      paint.getTextPath(text.toString(), start, end, x, y, path);
      path.close();

      canvas.translate(this.paint.getStrokeWidth() / 2, 0);
      canvas.drawPath(path, this.paint);
      canvas.translate(-this.paint.getStrokeWidth() / 2, 0);
    }
  }

  protected static class Option {
    public final String title;
    public final PathEffect effect;

    public Option(String title, PathEffect effect) {
      this.title = title;
      this.effect = effect;
    }

    @Override
    public String toString() {
      return title;
    }
  }
}

================================================
FILE: app/src/main/java/com/sqisland/android/graphics_demo/MainActivity.java
================================================
package com.sqisland.android.graphics_demo;

import android.app.ListActivity;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.TextView;

import java.util.ArrayList;

public class MainActivity extends ListActivity {
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    TextView footer = (TextView) LayoutInflater.from(this).inflate(
        android.R.layout.simple_list_item_1, getListView(), false);
    footer.setText(R.string.about);
    getListView().addFooterView(footer);

    final ArrayList<Demo> demos = new ArrayList<Demo>();
    demos.add(new Demo(this, RainbowGradientActivity.class, R.string.rainbow_gradient));
    demos.add(new Demo(this, PatternedTextActivity.class, R.string.patterned_text));
    demos.add(new Demo(this, PeekThroughActivity.class, R.string.peek_through));
    demos.add(new Demo(this, ClipRectActivity.class, R.string.clip_rect));
    demos.add(new Demo(this, ColorMatrixActivity.class, R.string.color_matrix));
    demos.add(new Demo(this, FourColorsActivity.class, R.string.four_colors));
    demos.add(new Demo(this, PorterDuffActivity.class, R.string.porter_duff));
    demos.add(new Demo(this, HollowTextActivity.class, R.string.hollow_text));
    demos.add(new Demo(this, EmbossMaskFilterActivity.class, R.string.emboss_mask_filter));
    demos.add(new Demo(this, BlurMaskFilterActivity.class, R.string.blur_mask_filter));

    if (Build.VERSION.SDK_INT >= 17) {
      demos.add(new Demo(this,
          RenderscriptBlurActivity.class, R.string.renderscript_blur));
      demos.add(new Demo(this,
          RenderscriptConvolutionActivity.class, R.string.renderscript_convolution));
    }

    ArrayAdapter<Demo> adapter = new ArrayAdapter<Demo>(
        this,
        android.R.layout.simple_list_item_1,
        demos);
    getListView().setAdapter(adapter);

    getListView().setOnItemClickListener(new AdapterView.OnItemClickListener() {
      @Override
      public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
        if (position < demos.size()) {
          Demo demo = demos.get(position);
          startActivity(new Intent(MainActivity.this, demo.activityClass));
        } else {
          startActivity(new Intent(MainActivity.this, AboutActivity.class));
        }
      }
    });
  }

  public static class Demo {
    public final Class<?> activityClass;
    public final String title;

    public Demo(Context context, Class<?> activityClass, int titleId) {
      this.activityClass = activityClass;
      this.title = context.getString(titleId);
    }

    @Override
    public String toString() {
      return this.title;
    }
  }
}


================================================
FILE: app/src/main/java/com/sqisland/android/graphics_demo/PatternedTextActivity.java
================================================
package com.sqisland.android.graphics_demo;

import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.BitmapShader;
import android.graphics.Shader;
import android.os.Bundle;
import android.widget.TextView;

public class PatternedTextActivity extends Activity {
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_patterned_text);
    TextView textView = (TextView) findViewById(R.id.text);

    Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.cheetah_tile);
    Shader shader = new BitmapShader(bitmap, Shader.TileMode.REPEAT, Shader.TileMode.REPEAT);
    textView.getPaint().setShader(shader);
  }
}

================================================
FILE: app/src/main/java/com/sqisland/android/graphics_demo/PeekThroughActivity.java
================================================
package com.sqisland.android.graphics_demo;

import android.app.Activity;
import android.os.Bundle;

public class PeekThroughActivity extends Activity {
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_peek_through);
  }
}

================================================
FILE: app/src/main/java/com/sqisland/android/graphics_demo/PorterDuffActivity.java
================================================
package com.sqisland.android.graphics_demo;

import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.ColorMatrix;
import android.graphics.ColorMatrixColorFilter;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;

import com.sqisland.android.graphics_demo.util.ImageUtil;

import java.util.ArrayList;
import java.util.List;

public class PorterDuffActivity extends SpinnerImageActivity {
  protected List<Option> getOptions(Bitmap original) {
    Bitmap mask = ImageUtil.createCircle(original.getWidth(), original.getHeight());

    ArrayList<Option> options = new ArrayList<Option>();
    options.add(new Option(getString(R.string.original), original));
    options.add(new Option(getString(R.string.mask), mask));
    options.add(new Option(getString(R.string.circle_dim_around), circleDimAround(original, mask)));

    for (PorterDuff.Mode mode : PorterDuff.Mode.values()) {
      options.add(new Option(mode.toString(), drawWithPorterDuff(original, mask, mode)));
    }

    return options;
  }

  protected int getInitialSelection(int size) {
    return 2;
  }

  private Bitmap drawWithPorterDuff(Bitmap original, Bitmap mask, PorterDuff.Mode mode) {
    Bitmap bitmap = Bitmap.createBitmap(
        original.getWidth(), original.getHeight(), Bitmap.Config.ARGB_8888);
    Canvas canvas = new Canvas(bitmap);

    // Draw the original bitmap (DST)
    canvas.drawBitmap(original, 0, 0, null);

    // Draw the mask (SRC) with the specified Porter-Duff mode
    Paint maskPaint = new Paint();
    maskPaint.setXfermode(new PorterDuffXfermode(mode));
    canvas.drawBitmap(mask, 0, 0, maskPaint);

    return bitmap;
  }

  private Bitmap circleDimAround(Bitmap original, Bitmap mask) {
    Bitmap bitmap = Bitmap.createBitmap(
        original.getWidth(), original.getHeight(), Bitmap.Config.ARGB_8888);
    Canvas canvas = new Canvas(bitmap);

    // Draw the original bitmap
    canvas.drawBitmap(original, 0, 0, null);

    // DST_IN = Whatever was there, keep the part that overlaps with what I'm drawing now
    Paint maskPaint = new Paint();
    maskPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_IN));
    canvas.drawBitmap(mask, 0, 0, maskPaint);

    // DST_OVER = Whatever was there, put it over what I'm drawing now
    Paint overPaint = new Paint();
    overPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_OVER));
    overPaint.setColorFilter(createDimFilter());
    canvas.drawBitmap(original, 0, 0, overPaint);

    return bitmap;
  }

  private ColorFilter createDimFilter() {
    ColorMatrix colorMatrix = new ColorMatrix();
    colorMatrix.setSaturation(0f);
    float scale = 0.5f;
    colorMatrix.setScale(scale, scale, scale, 1f);
    return new ColorMatrixColorFilter(colorMatrix);
  }
}

================================================
FILE: app/src/main/java/com/sqisland/android/graphics_demo/RainbowGradientActivity.java
================================================
package com.sqisland.android.graphics_demo;

import android.app.Activity;
import android.os.Bundle;

public class RainbowGradientActivity extends Activity {
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_rainbow_text);
  }
}

================================================
FILE: app/src/main/java/com/sqisland/android/graphics_demo/RenderscriptBlurActivity.java
================================================
package com.sqisland.android.graphics_demo;

import android.annotation.TargetApi;
import android.graphics.Bitmap;
import android.renderscript.Allocation;
import android.renderscript.Element;
import android.renderscript.RenderScript;
import android.renderscript.ScriptIntrinsicBlur;

import java.util.ArrayList;
import java.util.List;

@TargetApi(17)
public class RenderscriptBlurActivity extends SpinnerImageActivity {
  @Override
  protected List<Option> getOptions(Bitmap original) {
    ArrayList<Option> options = new ArrayList<Option>();
    options.add(new Option(getString(R.string.original), original));

    for (float radius : new float[]{1, 4, 9, 16, 25}) {
      options.add(createOption(original, radius));
    }

    return options;
  }

  protected int getInitialSelection(int size) {
    return size - 1;
  }

  private Option createOption(Bitmap original, float radius) {
    String title = getString(R.string.blur_with_radius, radius);
    Bitmap bitmap = blur(original, radius);
    return new Option(title, bitmap);
  }

  private Bitmap blur(Bitmap original, float radius) {
    Bitmap bitmap = Bitmap.createBitmap(
        original.getWidth(), original.getHeight(),
        Bitmap.Config.ARGB_8888);

    RenderScript rs = RenderScript.create(this);

    Allocation allocIn = Allocation.createFromBitmap(rs, original);
    Allocation allocOut = Allocation.createFromBitmap(rs, bitmap);

    ScriptIntrinsicBlur blur = ScriptIntrinsicBlur.create(rs, Element.U8_4(rs));
    blur.setInput(allocIn);
    blur.setRadius(radius);
    blur.forEach(allocOut);

    allocOut.copyTo(bitmap);

    rs.destroy();

    return bitmap;
  }
}

================================================
FILE: app/src/main/java/com/sqisland/android/graphics_demo/RenderscriptConvolutionActivity.java
================================================
package com.sqisland.android.graphics_demo;

import android.annotation.TargetApi;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.os.Bundle;
import android.renderscript.Allocation;
import android.renderscript.Element;
import android.renderscript.RenderScript;
import android.renderscript.ScriptIntrinsicConvolve3x3;

import java.util.Arrays;
import java.util.List;

@TargetApi(17)
public class RenderscriptConvolutionActivity extends SpinnerImageActivity {
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    imageView.setBackgroundColor(Color.BLACK);  // for edge detection
  }

  @Override
  protected List<Option> getOptions(Bitmap original) {
    return Arrays.asList(
        new Option(getString(R.string.original), original),
        createOption(original, R.string.sharpen, new float[] {
            0, -1, 0,
            -1, 5, -1,
            0, -1, 0
        }),
        createOption(original, R.string.edge_detection, new float[] {
            -1, -1, -1,
            -1,  8, -1,
            -1, -1, -1
        }),
        createOption(original, R.string.box_blur, new float[] {
            1, 1, 1,
            1, 1, 1,
            1, 1, 1
        }, 9),
        createOption(original, R.string.fuzzy_glass, new float[] {
            0,  20,  0,
           20, -59, 20,
            1,  13,  0
        }, 7)
    );
  }

  private Option createOption(Bitmap original, int titleId, float[] coefficients) {
    return createOption(original, titleId, coefficients, 1);
  }

  private Option createOption(Bitmap original, int titleId, float[] coefficients, float divisor) {
    if (divisor != 0 && divisor != 1) {
      for (int i = 0; i < coefficients.length; ++i) {
        coefficients[i] = coefficients[i] / divisor;
      }
    }
    String title = getString(titleId);
    Bitmap bitmap = convolve(original, coefficients);
    return new Option(title, bitmap);
  }

  private Bitmap convolve(Bitmap original, float[] coefficients) {
    Bitmap bitmap = Bitmap.createBitmap(
        original.getWidth(), original.getHeight(),
        Bitmap.Config.ARGB_8888);

    RenderScript rs = RenderScript.create(this);

    Allocation allocIn = Allocation.createFromBitmap(rs, original);
    Allocation allocOut = Allocation.createFromBitmap(rs, bitmap);

    ScriptIntrinsicConvolve3x3 convolution
        = ScriptIntrinsicConvolve3x3.create(rs, Element.U8_4(rs));
    convolution.setInput(allocIn);
    convolution.setCoefficients(coefficients);
    convolution.forEach(allocOut);

    allocOut.copyTo(bitmap);

    rs.destroy();

    return bitmap;
  }
}

================================================
FILE: app/src/main/java/com/sqisland/android/graphics_demo/SpinnerImageActivity.java
================================================
package com.sqisland.android.graphics_demo;

import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.Spinner;

import java.util.List;

public abstract class SpinnerImageActivity extends Activity {
  protected ImageView imageView;
  private int lastSelection = 0;
  private Spinner spinner;

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_spinner_image);

    imageView = (ImageView) findViewById(R.id.image);
    Bitmap original = ((BitmapDrawable) imageView.getDrawable()).getBitmap();

    final List<Option> options = getOptions(original);
    spinner = (Spinner) findViewById(R.id.spinner);
    ArrayAdapter<Option> adapter = new ArrayAdapter<Option>(
        this, android.R.layout.simple_spinner_item, options);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    spinner.setAdapter(adapter);
    spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
      @Override
      public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
        Option option = options.get(position);
        imageView.setImageBitmap(option.bitmap);
        if (position != 0) {
          lastSelection = position;
        }
      }
      @Override
      public void onNothingSelected(AdapterView<?> parent) {
      }
    });
    spinner.setSelection(getInitialSelection(options.size()));
    lastSelection = spinner.getSelectedItemPosition();

    imageView.setOnClickListener(new View.OnClickListener() {
      @Override
      public void onClick(View v) {
        if (spinner.getSelectedItemPosition() == 0) {
          spinner.setSelection(lastSelection);
        } else {
          spinner.setSelection(0);
        }
      }
    });
  }

  protected abstract List<Option> getOptions(Bitmap original);
  protected int getInitialSelection(int size) {
    return 1;
  }

  protected static class Option {
    public final String title;
    public final Bitmap bitmap;

    public Option(String title, Bitmap bitmap) {
      this.title = title;
      this.bitmap = bitmap;
    }

    @Override
    public String toString() {
      return title;
    }
  }
}

================================================
FILE: app/src/main/java/com/sqisland/android/graphics_demo/util/ImageUtil.java
================================================
package com.sqisland.android.graphics_demo.util;

import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;

public abstract class ImageUtil {
  public static Bitmap createCircle(int width, int height) {
    Paint paint = new Paint();
    paint.setStyle(Paint.Style.FILL);
    paint.setColor(Color.BLUE);

    Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
    Canvas canvas = new Canvas(bitmap);
    float radius = Math.min(width, height) * 0.45f;
    canvas.drawCircle(width / 2, height / 2, radius, paint);

    return bitmap;
  }
}

================================================
FILE: app/src/main/java/com/sqisland/android/graphics_demo/util/ViewUtil.java
================================================
package com.sqisland.android.graphics_demo.util;

import android.annotation.TargetApi;
import android.view.View;

public abstract class ViewUtil {
  @TargetApi(11)
  public static void setSoftwareLayerType(View view) {
    view.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
  }
}


================================================
FILE: app/src/main/java/com/sqisland/android/graphics_demo/widget/FourColorsImageView.java
================================================
package com.sqisland.android.graphics_demo.widget;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.ColorFilter;
import android.graphics.ColorMatrixColorFilter;
import android.graphics.LightingColorFilter;
import android.graphics.Paint;
import android.util.AttributeSet;
import android.widget.ImageView;

public class FourColorsImageView extends ImageView {
  private Bitmap bitmap = null;

  public FourColorsImageView(Context context) {
    super(context);
  }

  public FourColorsImageView(Context context, AttributeSet attrs) {
    super(context, attrs);
  }

  public FourColorsImageView(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
  }

  @Override
  protected void onDraw(Canvas canvas) {
    if (bitmap == null) {
      Bitmap quarter = Bitmap.createBitmap(getWidth()/2, getHeight()/2, Bitmap.Config.ARGB_8888);
      Canvas quarterCanvas = new Canvas(quarter);
      quarterCanvas.scale(0.5f, 0.5f);
      super.onDraw(quarterCanvas);
      quarterCanvas.scale(2, 2);

      createBitmap(quarter);
      quarter.recycle();
    }
    canvas.drawBitmap(bitmap, 0, 0, null);
  }

  private void createBitmap(Bitmap quarter) {
    bitmap = Bitmap.createBitmap(getWidth(), getHeight(), Bitmap.Config.ARGB_8888);
    Canvas canvas = new Canvas(bitmap);

    Paint paint = new Paint();

    // Top left
    paint.setColorFilter(new LightingColorFilter(Color.RED, 0));
    canvas.drawBitmap(quarter, 0, 0, paint);

    // Top right
    paint.setColorFilter(new LightingColorFilter(Color.YELLOW, 0));
    canvas.drawBitmap(quarter, getWidth() / 2, 0, paint);

    // Bottom left
    paint.setColorFilter(new LightingColorFilter(Color.BLUE, 0));
    canvas.drawBitmap(quarter, 0, getHeight()/2, paint);

    // Bottom right
    paint.setColorFilter(new LightingColorFilter(Color.GREEN, 0));
    canvas.drawBitmap(quarter, getWidth() / 2, getHeight() / 2, paint);
  }

  private ColorFilter createColorFilter(float red, float green, float blue) {
    float alpha = 1f;
    float[] transform =
        { red, 0, 0, 0, 0,
            0, green, 0, 0, 0,
            0, 0, blue, 0, 0,
            0, 0, 0, alpha, 0 };
    return new ColorMatrixColorFilter(transform);
  }
}

================================================
FILE: app/src/main/java/com/sqisland/android/graphics_demo/widget/PeekThroughImageView.java
================================================
package com.sqisland.android.graphics_demo.widget;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapShader;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Shader;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.widget.ImageView;

import com.sqisland.android.graphics_demo.R;

// Inspired by http://www.curious-creature.org/2012/12/13/android-recipe-2-fun-with-shaders/
public class PeekThroughImageView extends ImageView {
  private final float radius;
  private Paint paint = null;

  private float x;
  private float y;
  private boolean shouldDrawOpening = false;

  public PeekThroughImageView(Context context) {
    super(context);
    radius = context.getResources().getDimensionPixelSize(R.dimen.peek_through_radius);
  }

  public PeekThroughImageView(Context context, AttributeSet attrs) {
    super(context, attrs);
    radius = context.getResources().getDimensionPixelSize(R.dimen.peek_through_radius);
  }

  public PeekThroughImageView(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    radius = context.getResources().getDimensionPixelSize(R.dimen.peek_through_radius);
  }

  @Override
  public boolean onTouchEvent(MotionEvent motionEvent) {
    int action = motionEvent.getAction();
    shouldDrawOpening = (action == MotionEvent.ACTION_DOWN || action == MotionEvent.ACTION_MOVE);
    x = motionEvent.getX();
    y = motionEvent.getY();
    invalidate();
    return true;
  }

  @Override
  protected void onDraw(Canvas canvas) {
    if (paint == null) {
      Bitmap original = Bitmap.createBitmap(getWidth(), getHeight(), Bitmap.Config.ARGB_8888);
      Canvas originalCanvas = new Canvas(original);
      super.onDraw(originalCanvas);

      Shader shader = new BitmapShader(original, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP);

      paint = new Paint();
      paint.setShader(shader);
    }

    canvas.drawColor(Color.GRAY);
    if (shouldDrawOpening) {
      canvas.drawCircle(x, y - radius, radius, paint);
    }
  }
}

================================================
FILE: app/src/main/java/com/sqisland/android/graphics_demo/widget/RainbowTextView.java
================================================
package com.sqisland.android.graphics_demo.widget;

import android.content.Context;
import android.graphics.LinearGradient;
import android.graphics.Matrix;
import android.graphics.Shader;
import android.util.AttributeSet;
import android.widget.TextView;

import com.sqisland.android.graphics_demo.R;

public class RainbowTextView extends TextView {
  public RainbowTextView(Context context) {
    super(context);
  }

  public RainbowTextView(Context context, AttributeSet attrs) {
    super(context, attrs);
  }

  public RainbowTextView(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
  }

  @Override
  protected void onSizeChanged(int w, int h, int oldw, int oldh) {
    super.onSizeChanged(w, h, oldw, oldh);

    int[] rainbow = {
        getResources().getColor(R.color.rainbow_red),
        getResources().getColor(R.color.rainbow_yellow),
        getResources().getColor(R.color.rainbow_green),
        getResources().getColor(R.color.rainbow_blue),
        getResources().getColor(R.color.rainbow_purple)
    };
    Shader shader = new LinearGradient(0, 0, 0, w, rainbow, null, Shader.TileMode.MIRROR);

    Matrix matrix = new Matrix();
    matrix.setRotate(90);
    shader.setLocalMatrix(matrix);

    getPaint().setShader(shader);
  }
}

================================================
FILE: app/src/main/res/layout/activity_about.xml
================================================
<TextView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/text"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:textColorLink="@color/dark_green"
    android:textColorHighlight="@color/light_green"
    tools:context=".AboutActivity"/>

================================================
FILE: app/src/main/res/layout/activity_blur_mask_filter.xml
================================================
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/container"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:gravity="center"
    android:orientation="vertical"
    tools:context=".BlurMaskFilterActivity"/>

================================================
FILE: app/src/main/res/layout/activity_clip_rect.xml
================================================
<ImageView
  xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:tools="http://schemas.android.com/tools"
  android:id="@+id/image"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:layout_gravity="center"
  tools:context=".ClipRectActivity"/>

================================================
FILE: app/src/main/res/layout/activity_emboss_mask_filter.xml
================================================
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:gravity="center"
    android:orientation="vertical"
    tools:context=".EmbossMaskFilterActivity">
  <TextView
      android:id="@+id/emboss"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:gravity="center"
      android:text="@string/emboss"
      android:textAppearance="@style/TextAppearance.Huge.Green"/>
  <TextView
      android:id="@+id/deboss"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:gravity="center"
      android:text="@string/deboss"
      android:textAppearance="@style/TextAppearance.Huge.Green"/>
</LinearLayout>

================================================
FILE: app/src/main/res/layout/activity_four_colors.xml
================================================
<com.sqisland.android.graphics_demo.widget.FourColorsImageView
  xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:tools="http://schemas.android.com/tools"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:layout_gravity="center"
  android:src="@drawable/lena"
  tools:context=".FourColorsActivity"/>

================================================
FILE: app/src/main/res/layout/activity_hollow_text.xml
================================================
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:orientation="vertical"
    tools:context=".HollowTextActivity">
  <Spinner
      android:id="@+id/spinner"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_marginBottom="@dimen/activity_vertical_margin"
      android:layout_gravity="center"/>
  <TextView
      android:id="@+id/text"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_gravity="center"
      android:gravity="center"
      android:text="@string/hollow_text_character"
      android:textColor="@android:color/black"
      android:textSize="320sp"
      android:textStyle="bold"
      android:textIsSelectable="true"/>
</LinearLayout>

================================================
FILE: app/src/main/res/layout/activity_patterned_text.xml
================================================
<TextView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/text"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:gravity="center"
    android:text="@string/cheetah"
    android:textAppearance="@style/TextAppearance.Huge"/>


================================================
FILE: app/src/main/res/layout/activity_peek_through.xml
================================================
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:gravity="center"
    android:orientation="vertical"
    tools:context=".PeekThroughActivity">
  <TextView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:text="@string/peek_through_help"
      android:textAppearance="?android:attr/textAppearanceMedium"/>
  <com.sqisland.android.graphics_demo.widget.PeekThroughImageView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:src="@drawable/lena"/>
</LinearLayout>

================================================
FILE: app/src/main/res/layout/activity_rainbow_text.xml
================================================
<com.sqisland.android.graphics_demo.widget.RainbowTextView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/text"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:gravity="center"
    android:text="@string/rainbow"
    android:textColor="@android:color/black"
    android:textSize="@dimen/text_size_huge"
    android:textStyle="bold"
    tools:context=".RainbowGradientActivity"/>

================================================
FILE: app/src/main/res/layout/activity_spinner_image.xml
================================================
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:orientation="vertical">
  <Spinner
      android:id="@+id/spinner"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_marginBottom="@dimen/activity_vertical_margin"
      android:layout_gravity="center"/>
  <ImageView
      android:id="@+id/image"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_gravity="center"
      android:src="@drawable/lena"
      android:scaleType="centerCrop"/>
</LinearLayout>

================================================
FILE: app/src/main/res/values/colors.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<resources>
  <color name="light_green">#c1e25e</color>
  <color name="green">#a3c639</color>
  <color name="dark_green">#85a71d</color>

  <color name="rainbow_red">#bf0c43</color>
  <color name="rainbow_yellow">#f9ba15</color>
  <color name="rainbow_green">#8eac00</color>
  <color name="rainbow_blue">#127a97</color>
  <color name="rainbow_purple">#452b72</color>
</resources>

================================================
FILE: app/src/main/res/values/dimens.xml
================================================
<resources>
  <!-- Default screen margins, per the Android Design guidelines. -->
  <dimen name="activity_horizontal_margin">16dp</dimen>
  <dimen name="activity_vertical_margin">16dp</dimen>

  <dimen name="text_size_huge">80sp</dimen>

  <dimen name="peek_through_radius">40dp</dimen>

  <dimen name="dashed_text_stroke_width">8dp</dimen>

  <dimen name="clip_rect_width">120dp</dimen>
  <dimen name="clip_rect_height">40dp</dimen>
</resources>

================================================
FILE: app/src/main/res/values/strings.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<resources>
  <string name="app_name">Graphics Demo</string>
  <string name="original">Original</string>

  <string name="rainbow_gradient">Rainbow gradient</string>
  <string name="rainbow">Rainbow</string>

  <string name="patterned_text">Patterned text</string>
  <string name="cheetah">Cheetah</string>

  <string name="peek_through">Peek through</string>
  <string name="peek_through_help">Touch the gray area to peek</string>

  <string name="clip_rect">Clip rect</string>

  <string name="color_matrix">ColorMatrix</string>
  <string name="grayscale">Grayscale</string>
  <string name="sepia">Sepia</string>
  <string name="invert">Invert</string>
  <string name="alpha_blue">Alpha blue</string>
  <string name="alpha_pink">Alpha pink</string>
  <string name="binary">Binary</string>

  <string name="four_colors">Four colors</string>

  <string name="circle_dim_around">Circle dim around</string>

  <string name="porter_duff">Porter-Duff</string>
  <string name="mask">Mask</string>

  <string name="hollow_text">Hollow text</string>
  <string name="hollow_text_character">A</string>
  <string name="solid">Solid</string>
  <string name="dash">Dash</string>
  <string name="round_dash">Round dash</string>
  <string name="triangle">Triangle</string>

  <string name="emboss_mask_filter">EmbossMaskFilter</string>
  <string name="emboss">Emboss</string>
  <string name="deboss">Deboss</string>

  <string name="blur_mask_filter">BlurMaskFilter</string>

  <string name="renderscript_blur">RenderScript blur</string>
  <string name="blur_with_radius">Blur with radius %1$.0f</string>

  <string name="renderscript_convolution">RenderScript convolution</string>
  <string name="sharpen">Sharpen</string>
  <string name="edge_detection">Edge detection</string>
  <string name="box_blur">Box blur</string>
  <string name="fuzzy_glass">Fuzzy glass</string>

  <string name="about">About</string>
  <string name="about_text">
    <![CDATA[
    <p>
    Launcher icon modified from
    <a href="http://thenounproject.com/term/bucket/47549/">Bucket by Clovis Lefranc from The Noun Project</a>.
    </p>

    <p>
    <a href="http://www.colourlovers.com/palette/1757442/Rainbow_Connection">Rainbow Connection palette</a>
    by Luna Rosa from COLOURlovers.
    </p>

    <p>
    <a href="http://www.colourlovers.com/pattern/2612403/Leopoard_Skin">Leopard skin pattern</a>
    by Nie Niez 1702 and svartedauden from COLOURlovers.
    </p>

    <p>
    Peek through inspired by
    <a href="http://www.curious-creature.org/2012/12/13/android-recipe-2-fun-with-shaders/">
    Android Recipe #2, fun with shaders by Romain Guy</a>.
    </p>

    <p>
    Debossed text from
    <a href="http://wiresareobsolete.com/2012/04/textview-inner-shadows/">
    TextView Inner Shadows with EmbossMaskFilter by Dave Smith</a>.
    </p>

    <p>
    Image of Lena S&ouml;derberg is a standard image processing test image, originally from the
    November 1972 issue of Playboy magazine.
    </p>
    ]]>
  </string>
</resources>

================================================
FILE: app/src/main/res/values/styles.xml
================================================
<resources>
  <style name="AppBaseTheme" parent="android:Theme.Light">
  </style>
  <style name="AppTheme" parent="AppBaseTheme">
  </style>

  <style name="TextAppearance.Huge" parent="@android:style/TextAppearance">
    <item name="android:textColor">@android:color/black</item>
    <item name="android:textSize">@dimen/text_size_huge</item>
    <item name="android:textStyle">bold</item>
  </style>

  <style name="TextAppearance.Huge.Green">
    <item name="android:textColor">@color/green</item>
  </style>
</resources>

================================================
FILE: app/src/main/res/values-v11/styles.xml
================================================
<resources>
  <style name="AppBaseTheme" parent="android:Theme.Holo.Light">
  </style>
</resources>

================================================
FILE: app/src/main/res/values-v14/styles.xml
================================================
<resources>
  <style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
  </style>
</resources>

================================================
FILE: app/src/main/res/values-v21/styles.xml
================================================
<resources>
  <style name="AppBaseTheme" parent="@android:style/Theme.Material.Light.DarkActionBar">
    <!--   your app branding color for the app bar -->
    <item name="android:colorPrimary">@color/green</item>
    <!--   darker variant for the status bar and contextual app bars -->
    <item name="android:colorPrimaryDark">@color/dark_green</item>
    <!--   theme UI controls like checkboxes and text fields -->
    <item name="android:colorAccent">@color/green</item>
  </style>
</resources>

================================================
FILE: app/src/main/res/values-w820dp/dimens.xml
================================================
<resources>
  <!-- Example customization of dimensions originally defined in res/values/dimens.xml
       (such as screen margins) for screens with more than 820dp of available width. This
       would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). -->
  <dimen name="activity_horizontal_margin">64dp</dimen>
</resources>

================================================
FILE: build.gradle
================================================
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.5.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}


================================================
FILE: gradle/wrapper/gradle-wrapper.properties
================================================
#Fri Dec 12 14:48:02 MST 2014
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.11-all.zip


================================================
FILE: gradle.properties
================================================
# Project-wide Gradle settings.

# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.

# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html

# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx10248m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8

# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true

================================================
FILE: gradlew
================================================
#!/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 "$@"


================================================
FILE: gradlew.bat
================================================
@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


================================================
FILE: settings.gradle
================================================
include ':app'
Download .txt
gitextract_megs46ev/

├── .gitignore
├── LICENSE
├── README.md
├── app/
│   ├── build.gradle
│   ├── proguard-rules.pro
│   └── src/
│       └── main/
│           ├── AndroidManifest.xml
│           ├── java/
│           │   └── com/
│           │       └── sqisland/
│           │           └── android/
│           │               └── graphics_demo/
│           │                   ├── AboutActivity.java
│           │                   ├── BlurMaskFilterActivity.java
│           │                   ├── ClipRectActivity.java
│           │                   ├── ColorMatrixActivity.java
│           │                   ├── EmbossMaskFilterActivity.java
│           │                   ├── FourColorsActivity.java
│           │                   ├── HollowTextActivity.java
│           │                   ├── MainActivity.java
│           │                   ├── PatternedTextActivity.java
│           │                   ├── PeekThroughActivity.java
│           │                   ├── PorterDuffActivity.java
│           │                   ├── RainbowGradientActivity.java
│           │                   ├── RenderscriptBlurActivity.java
│           │                   ├── RenderscriptConvolutionActivity.java
│           │                   ├── SpinnerImageActivity.java
│           │                   ├── util/
│           │                   │   ├── ImageUtil.java
│           │                   │   └── ViewUtil.java
│           │                   └── widget/
│           │                       ├── FourColorsImageView.java
│           │                       ├── PeekThroughImageView.java
│           │                       └── RainbowTextView.java
│           └── res/
│               ├── layout/
│               │   ├── activity_about.xml
│               │   ├── activity_blur_mask_filter.xml
│               │   ├── activity_clip_rect.xml
│               │   ├── activity_emboss_mask_filter.xml
│               │   ├── activity_four_colors.xml
│               │   ├── activity_hollow_text.xml
│               │   ├── activity_patterned_text.xml
│               │   ├── activity_peek_through.xml
│               │   ├── activity_rainbow_text.xml
│               │   └── activity_spinner_image.xml
│               ├── values/
│               │   ├── colors.xml
│               │   ├── dimens.xml
│               │   ├── strings.xml
│               │   └── styles.xml
│               ├── values-v11/
│               │   └── styles.xml
│               ├── values-v14/
│               │   └── styles.xml
│               ├── values-v21/
│               │   └── styles.xml
│               └── values-w820dp/
│                   └── dimens.xml
├── build.gradle
├── gradle/
│   └── wrapper/
│       ├── gradle-wrapper.jar
│       └── gradle-wrapper.properties
├── gradle.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
Download .txt
SYMBOL INDEX (91 symbols across 20 files)

FILE: app/src/main/java/com/sqisland/android/graphics_demo/AboutActivity.java
  class AboutActivity (line 9) | public class AboutActivity extends Activity {
    method onCreate (line 10) | @Override

FILE: app/src/main/java/com/sqisland/android/graphics_demo/BlurMaskFilterActivity.java
  class BlurMaskFilterActivity (line 14) | public class BlurMaskFilterActivity extends Activity {
    method onCreate (line 15) | @Override
    method applyFilter (line 34) | private void applyFilter(

FILE: app/src/main/java/com/sqisland/android/graphics_demo/ClipRectActivity.java
  class ClipRectActivity (line 12) | public class ClipRectActivity extends Activity {
    method onCreate (line 16) | @Override
    method createClipRect (line 30) | private Bitmap createClipRect(int width, int height) {

FILE: app/src/main/java/com/sqisland/android/graphics_demo/ColorMatrixActivity.java
  class ColorMatrixActivity (line 12) | public class ColorMatrixActivity extends SpinnerImageActivity {
    method getOptions (line 13) | protected List<Option> getOptions(Bitmap original) {
    method createOption (line 40) | private Option createOption(Bitmap original, int titleId, ColorMatrix ...
    method process (line 46) | protected Bitmap process(Bitmap original, ColorMatrix colorMatrix) {
    method getGrayscaleColorMatrix (line 58) | private ColorMatrix getGrayscaleColorMatrix() {
    method getSepiaColorMatrix (line 64) | private ColorMatrix getSepiaColorMatrix() {
    method getBinaryColorMatrix (line 77) | private ColorMatrix getBinaryColorMatrix() {

FILE: app/src/main/java/com/sqisland/android/graphics_demo/EmbossMaskFilterActivity.java
  class EmbossMaskFilterActivity (line 11) | public class EmbossMaskFilterActivity extends Activity {
    method onCreate (line 12) | @Override
    method applyFilter (line 25) | private void applyFilter(

FILE: app/src/main/java/com/sqisland/android/graphics_demo/FourColorsActivity.java
  class FourColorsActivity (line 6) | public class FourColorsActivity extends Activity {
    method onCreate (line 7) | @Override

FILE: app/src/main/java/com/sqisland/android/graphics_demo/HollowTextActivity.java
  class HollowTextActivity (line 24) | public class HollowTextActivity extends Activity {
    method onCreate (line 25) | @Override
    method getDashPathEffect (line 64) | private PathEffect getDashPathEffect(int strokeWidth) {
    method getCornerDashPathEffect (line 68) | private PathEffect getCornerDashPathEffect(int strokeWidth) {
    method getTrianglePathEffect (line 74) | private PathEffect getTrianglePathEffect(int strokeWidth) {
    method getTriangle (line 82) | private Path getTriangle(float size) {
    class HollowSpan (line 92) | private static class HollowSpan extends ReplacementSpan {
      method HollowSpan (line 97) | public HollowSpan(int strokeWidth) {
      method setPathEffect (line 102) | public void setPathEffect(PathEffect effect) {
      method getSize (line 106) | @Override
      method draw (line 115) | @Override
    class Option (line 129) | protected static class Option {
      method Option (line 133) | public Option(String title, PathEffect effect) {
      method toString (line 138) | @Override

FILE: app/src/main/java/com/sqisland/android/graphics_demo/MainActivity.java
  class MainActivity (line 16) | public class MainActivity extends ListActivity {
    method onCreate (line 17) | @Override
    class Demo (line 64) | public static class Demo {
      method Demo (line 68) | public Demo(Context context, Class<?> activityClass, int titleId) {
      method toString (line 73) | @Override

FILE: app/src/main/java/com/sqisland/android/graphics_demo/PatternedTextActivity.java
  class PatternedTextActivity (line 11) | public class PatternedTextActivity extends Activity {
    method onCreate (line 12) | @Override

FILE: app/src/main/java/com/sqisland/android/graphics_demo/PeekThroughActivity.java
  class PeekThroughActivity (line 6) | public class PeekThroughActivity extends Activity {
    method onCreate (line 7) | @Override

FILE: app/src/main/java/com/sqisland/android/graphics_demo/PorterDuffActivity.java
  class PorterDuffActivity (line 17) | public class PorterDuffActivity extends SpinnerImageActivity {
    method getOptions (line 18) | protected List<Option> getOptions(Bitmap original) {
    method getInitialSelection (line 33) | protected int getInitialSelection(int size) {
    method drawWithPorterDuff (line 37) | private Bitmap drawWithPorterDuff(Bitmap original, Bitmap mask, Porter...
    method circleDimAround (line 53) | private Bitmap circleDimAround(Bitmap original, Bitmap mask) {
    method createDimFilter (line 75) | private ColorFilter createDimFilter() {

FILE: app/src/main/java/com/sqisland/android/graphics_demo/RainbowGradientActivity.java
  class RainbowGradientActivity (line 6) | public class RainbowGradientActivity extends Activity {
    method onCreate (line 7) | @Override

FILE: app/src/main/java/com/sqisland/android/graphics_demo/RenderscriptBlurActivity.java
  class RenderscriptBlurActivity (line 13) | @TargetApi(17)
    method getOptions (line 15) | @Override
    method getInitialSelection (line 27) | protected int getInitialSelection(int size) {
    method createOption (line 31) | private Option createOption(Bitmap original, float radius) {
    method blur (line 37) | private Bitmap blur(Bitmap original, float radius) {

FILE: app/src/main/java/com/sqisland/android/graphics_demo/RenderscriptConvolutionActivity.java
  class RenderscriptConvolutionActivity (line 15) | @TargetApi(17)
    method onCreate (line 17) | @Override
    method getOptions (line 23) | @Override
    method createOption (line 50) | private Option createOption(Bitmap original, int titleId, float[] coef...
    method createOption (line 54) | private Option createOption(Bitmap original, int titleId, float[] coef...
    method convolve (line 65) | private Bitmap convolve(Bitmap original, float[] coefficients) {

FILE: app/src/main/java/com/sqisland/android/graphics_demo/SpinnerImageActivity.java
  class SpinnerImageActivity (line 15) | public abstract class SpinnerImageActivity extends Activity {
    method onCreate (line 20) | @Override
    method getOptions (line 62) | protected abstract List<Option> getOptions(Bitmap original);
    method getInitialSelection (line 63) | protected int getInitialSelection(int size) {
    class Option (line 67) | protected static class Option {
      method Option (line 71) | public Option(String title, Bitmap bitmap) {
      method toString (line 76) | @Override

FILE: app/src/main/java/com/sqisland/android/graphics_demo/util/ImageUtil.java
  class ImageUtil (line 8) | public abstract class ImageUtil {
    method createCircle (line 9) | public static Bitmap createCircle(int width, int height) {

FILE: app/src/main/java/com/sqisland/android/graphics_demo/util/ViewUtil.java
  class ViewUtil (line 6) | public abstract class ViewUtil {
    method setSoftwareLayerType (line 7) | @TargetApi(11)

FILE: app/src/main/java/com/sqisland/android/graphics_demo/widget/FourColorsImageView.java
  class FourColorsImageView (line 14) | public class FourColorsImageView extends ImageView {
    method FourColorsImageView (line 17) | public FourColorsImageView(Context context) {
    method FourColorsImageView (line 21) | public FourColorsImageView(Context context, AttributeSet attrs) {
    method FourColorsImageView (line 25) | public FourColorsImageView(Context context, AttributeSet attrs, int de...
    method onDraw (line 29) | @Override
    method createBitmap (line 44) | private void createBitmap(Bitmap quarter) {
    method createColorFilter (line 67) | private ColorFilter createColorFilter(float red, float green, float bl...

FILE: app/src/main/java/com/sqisland/android/graphics_demo/widget/PeekThroughImageView.java
  class PeekThroughImageView (line 17) | public class PeekThroughImageView extends ImageView {
    method PeekThroughImageView (line 25) | public PeekThroughImageView(Context context) {
    method PeekThroughImageView (line 30) | public PeekThroughImageView(Context context, AttributeSet attrs) {
    method PeekThroughImageView (line 35) | public PeekThroughImageView(Context context, AttributeSet attrs, int d...
    method onTouchEvent (line 40) | @Override
    method onDraw (line 50) | @Override

FILE: app/src/main/java/com/sqisland/android/graphics_demo/widget/RainbowTextView.java
  class RainbowTextView (line 12) | public class RainbowTextView extends TextView {
    method RainbowTextView (line 13) | public RainbowTextView(Context context) {
    method RainbowTextView (line 17) | public RainbowTextView(Context context, AttributeSet attrs) {
    method RainbowTextView (line 21) | public RainbowTextView(Context context, AttributeSet attrs, int defSty...
    method onSizeChanged (line 25) | @Override
Condensed preview — 51 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (76K chars).
[
  {
    "path": ".gitignore",
    "chars": 92,
    "preview": ".DS_Store\n.idea/*\n.gradle\nlocal.properties\n/*/out\nbuild\n*.iml\n*.iws\n*.ipr\n*.swp\n*.apk\n*.ap_\n"
  },
  {
    "path": "LICENSE",
    "chars": 11310,
    "preview": "Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licens"
  },
  {
    "path": "README.md",
    "chars": 391,
    "preview": "Android Graphics Demo\n---------------------\n\nCompanion app for my [Android Shaders and Filters talk][1], demonstrating:\n"
  },
  {
    "path": "app/build.gradle",
    "chars": 494,
    "preview": "apply plugin: 'com.android.application'\n\nandroid {\n  compileSdkVersion 23\n  buildToolsVersion \"23.0.2\"\n\n  defaultConfig "
  },
  {
    "path": "app/proguard-rules.pro",
    "chars": 666,
    "preview": "# Add project specific ProGuard rules here.\n# By default, the flags in this file are appended to flags specified\n# in /h"
  },
  {
    "path": "app/src/main/AndroidManifest.xml",
    "chars": 2725,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n          pa"
  },
  {
    "path": "app/src/main/java/com/sqisland/android/graphics_demo/AboutActivity.java",
    "chars": 629,
    "preview": "package com.sqisland.android.graphics_demo;\n\nimport android.app.Activity;\nimport android.os.Bundle;\nimport android.text."
  },
  {
    "path": "app/src/main/java/com/sqisland/android/graphics_demo/BlurMaskFilterActivity.java",
    "chars": 1479,
    "preview": "package com.sqisland.android.graphics_demo;\n\nimport android.app.Activity;\nimport android.graphics.BlurMaskFilter;\nimport"
  },
  {
    "path": "app/src/main/java/com/sqisland/android/graphics_demo/ClipRectActivity.java",
    "chars": 1392,
    "preview": "package com.sqisland.android.graphics_demo;\n\nimport android.app.Activity;\nimport android.graphics.Bitmap;\nimport android"
  },
  {
    "path": "app/src/main/java/com/sqisland/android/graphics_demo/ColorMatrixActivity.java",
    "chars": 2995,
    "preview": "package com.sqisland.android.graphics_demo;\n\nimport android.graphics.Bitmap;\nimport android.graphics.Canvas;\nimport andr"
  },
  {
    "path": "app/src/main/java/com/sqisland/android/graphics_demo/EmbossMaskFilterActivity.java",
    "chars": 1198,
    "preview": "package com.sqisland.android.graphics_demo;\n\nimport android.app.Activity;\nimport android.graphics.EmbossMaskFilter;\nimpo"
  },
  {
    "path": "app/src/main/java/com/sqisland/android/graphics_demo/FourColorsActivity.java",
    "chars": 315,
    "preview": "package com.sqisland.android.graphics_demo;\n\nimport android.app.Activity;\nimport android.os.Bundle;\n\npublic class FourCo"
  },
  {
    "path": "app/src/main/java/com/sqisland/android/graphics_demo/HollowTextActivity.java",
    "chars": 4670,
    "preview": "package com.sqisland.android.graphics_demo;\n\nimport android.app.Activity;\nimport android.graphics.Canvas;\nimport android"
  },
  {
    "path": "app/src/main/java/com/sqisland/android/graphics_demo/MainActivity.java",
    "chars": 2908,
    "preview": "package com.sqisland.android.graphics_demo;\n\nimport android.app.ListActivity;\nimport android.content.Context;\nimport and"
  },
  {
    "path": "app/src/main/java/com/sqisland/android/graphics_demo/PatternedTextActivity.java",
    "chars": 783,
    "preview": "package com.sqisland.android.graphics_demo;\n\nimport android.app.Activity;\nimport android.graphics.Bitmap;\nimport android"
  },
  {
    "path": "app/src/main/java/com/sqisland/android/graphics_demo/PeekThroughActivity.java",
    "chars": 317,
    "preview": "package com.sqisland.android.graphics_demo;\n\nimport android.app.Activity;\nimport android.os.Bundle;\n\npublic class PeekTh"
  },
  {
    "path": "app/src/main/java/com/sqisland/android/graphics_demo/PorterDuffActivity.java",
    "chars": 2869,
    "preview": "package com.sqisland.android.graphics_demo;\n\nimport android.graphics.Bitmap;\nimport android.graphics.Canvas;\nimport andr"
  },
  {
    "path": "app/src/main/java/com/sqisland/android/graphics_demo/RainbowGradientActivity.java",
    "chars": 321,
    "preview": "package com.sqisland.android.graphics_demo;\n\nimport android.app.Activity;\nimport android.os.Bundle;\n\npublic class Rainbo"
  },
  {
    "path": "app/src/main/java/com/sqisland/android/graphics_demo/RenderscriptBlurActivity.java",
    "chars": 1648,
    "preview": "package com.sqisland.android.graphics_demo;\n\nimport android.annotation.TargetApi;\nimport android.graphics.Bitmap;\nimport"
  },
  {
    "path": "app/src/main/java/com/sqisland/android/graphics_demo/RenderscriptConvolutionActivity.java",
    "chars": 2648,
    "preview": "package com.sqisland.android.graphics_demo;\n\nimport android.annotation.TargetApi;\nimport android.graphics.Bitmap;\nimport"
  },
  {
    "path": "app/src/main/java/com/sqisland/android/graphics_demo/SpinnerImageActivity.java",
    "chars": 2456,
    "preview": "package com.sqisland.android.graphics_demo;\n\nimport android.app.Activity;\nimport android.graphics.Bitmap;\nimport android"
  },
  {
    "path": "app/src/main/java/com/sqisland/android/graphics_demo/util/ImageUtil.java",
    "chars": 633,
    "preview": "package com.sqisland.android.graphics_demo.util;\n\nimport android.graphics.Bitmap;\nimport android.graphics.Canvas;\nimport"
  },
  {
    "path": "app/src/main/java/com/sqisland/android/graphics_demo/util/ViewUtil.java",
    "chars": 280,
    "preview": "package com.sqisland.android.graphics_demo.util;\n\nimport android.annotation.TargetApi;\nimport android.view.View;\n\npublic"
  },
  {
    "path": "app/src/main/java/com/sqisland/android/graphics_demo/widget/FourColorsImageView.java",
    "chars": 2323,
    "preview": "package com.sqisland.android.graphics_demo.widget;\n\nimport android.content.Context;\nimport android.graphics.Bitmap;\nimpo"
  },
  {
    "path": "app/src/main/java/com/sqisland/android/graphics_demo/widget/PeekThroughImageView.java",
    "chars": 2149,
    "preview": "package com.sqisland.android.graphics_demo.widget;\n\nimport android.content.Context;\nimport android.graphics.Bitmap;\nimpo"
  },
  {
    "path": "app/src/main/java/com/sqisland/android/graphics_demo/widget/RainbowTextView.java",
    "chars": 1299,
    "preview": "package com.sqisland.android.graphics_demo.widget;\n\nimport android.content.Context;\nimport android.graphics.LinearGradie"
  },
  {
    "path": "app/src/main/res/layout/activity_about.xml",
    "chars": 604,
    "preview": "<TextView\n    xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:tools=\"http://schemas.android.com/too"
  },
  {
    "path": "app/src/main/res/layout/activity_blur_mask_filter.xml",
    "chars": 386,
    "preview": "<LinearLayout\n    xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:tools=\"http://schemas.android.com"
  },
  {
    "path": "app/src/main/res/layout/activity_clip_rect.xml",
    "chars": 295,
    "preview": "<ImageView\n  xmlns:android=\"http://schemas.android.com/apk/res/android\"\n  xmlns:tools=\"http://schemas.android.com/tools\""
  },
  {
    "path": "app/src/main/res/layout/activity_emboss_mask_filter.xml",
    "chars": 893,
    "preview": "<LinearLayout\n    xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:tools=\"http://schemas.android.com"
  },
  {
    "path": "app/src/main/res/layout/activity_four_colors.xml",
    "chars": 354,
    "preview": "<com.sqisland.android.graphics_demo.widget.FourColorsImageView\n  xmlns:android=\"http://schemas.android.com/apk/res/andro"
  },
  {
    "path": "app/src/main/res/layout/activity_hollow_text.xml",
    "chars": 967,
    "preview": "<LinearLayout\n    xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:tools=\"http://schemas.android.com"
  },
  {
    "path": "app/src/main/res/layout/activity_patterned_text.xml",
    "chars": 339,
    "preview": "<TextView\n    xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:id=\"@+id/text\"\n    android:layout_w"
  },
  {
    "path": "app/src/main/res/layout/activity_peek_through.xml",
    "chars": 766,
    "preview": "<LinearLayout\n    xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:tools=\"http://schemas.android.com"
  },
  {
    "path": "app/src/main/res/layout/activity_rainbow_text.xml",
    "chars": 546,
    "preview": "<com.sqisland.android.graphics_demo.widget.RainbowTextView\n    xmlns:android=\"http://schemas.android.com/apk/res/android"
  },
  {
    "path": "app/src/main/res/layout/activity_spinner_image.xml",
    "chars": 721,
    "preview": "<LinearLayout\n    xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:layout_width=\"wrap_content\"\n   "
  },
  {
    "path": "app/src/main/res/values/colors.xml",
    "chars": 418,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n  <color name=\"light_green\">#c1e25e</color>\n  <color name=\"green\">#a3"
  },
  {
    "path": "app/src/main/res/values/dimens.xml",
    "chars": 446,
    "preview": "<resources>\n  <!-- Default screen margins, per the Android Design guidelines. -->\n  <dimen name=\"activity_horizontal_mar"
  },
  {
    "path": "app/src/main/res/values/strings.xml",
    "chars": 3049,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n  <string name=\"app_name\">Graphics Demo</string>\n  <string name=\"orig"
  },
  {
    "path": "app/src/main/res/values/styles.xml",
    "chars": 524,
    "preview": "<resources>\n  <style name=\"AppBaseTheme\" parent=\"android:Theme.Light\">\n  </style>\n  <style name=\"AppTheme\" parent=\"AppBa"
  },
  {
    "path": "app/src/main/res/values-v11/styles.xml",
    "chars": 99,
    "preview": "<resources>\n  <style name=\"AppBaseTheme\" parent=\"android:Theme.Holo.Light\">\n  </style>\n</resources>"
  },
  {
    "path": "app/src/main/res/values-v14/styles.xml",
    "chars": 113,
    "preview": "<resources>\n  <style name=\"AppBaseTheme\" parent=\"android:Theme.Holo.Light.DarkActionBar\">\n  </style>\n</resources>"
  },
  {
    "path": "app/src/main/res/values-v21/styles.xml",
    "chars": 499,
    "preview": "<resources>\n  <style name=\"AppBaseTheme\" parent=\"@android:style/Theme.Material.Light.DarkActionBar\">\n    <!--   your app"
  },
  {
    "path": "app/src/main/res/values-w820dp/dimens.xml",
    "chars": 349,
    "preview": "<resources>\n  <!-- Example customization of dimensions originally defined in res/values/dimens.xml\n       (such as scree"
  },
  {
    "path": "build.gradle",
    "chars": 436,
    "preview": "// Top-level build file where you can add configuration options common to all sub-projects/modules.\n\nbuildscript {\n    r"
  },
  {
    "path": "gradle/wrapper/gradle-wrapper.properties",
    "chars": 231,
    "preview": "#Fri Dec 12 14:48:02 MST 2014\ndistributionBase=GRADLE_USER_HOME\ndistributionPath=wrapper/dists\nzipStoreBase=GRADLE_USER_"
  },
  {
    "path": "gradle.properties",
    "chars": 855,
    "preview": "# Project-wide Gradle settings.\n\n# IDE (e.g. Android Studio) users:\n# Gradle settings configured through the IDE *will o"
  },
  {
    "path": "gradlew",
    "chars": 5080,
    "preview": "#!/usr/bin/env bash\n\n##############################################################################\n##\n##  Gradle start "
  },
  {
    "path": "gradlew.bat",
    "chars": 2404,
    "preview": "@if \"%DEBUG%\" == \"\" @echo off\r\n@rem ##########################################################################\r\n@rem\r\n@r"
  },
  {
    "path": "settings.gradle",
    "chars": 15,
    "preview": "include ':app'\n"
  }
]

// ... and 1 more files (download for full content)

About this extraction

This page contains the full source code of the chiuki/android-graphics-demo GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 51 files (67.8 KB), approximately 18.2k tokens, and a symbol index with 91 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!