[
  {
    "path": ".gitignore",
    "content": "*.iml\n.gradle\n/local.properties\n/.idea/workspace.xml\n/.idea/libraries\n.DS_Store\n/build\n/captures\nMagicShow/.externalNativeBuild\n.idea/*\n"
  },
  {
    "path": "MagicShow/.gitignore",
    "content": "/build\n"
  },
  {
    "path": "MagicShow/CMakeLists.txt",
    "content": "# For more information about using CMake with Android Studio, read the\n# documentation: https://d.android.com/studio/projects/add-native-code.html\n\n# Sets the minimum version of CMake required to build the native library.\n\ncmake_minimum_required(VERSION 3.4.1)\n\n#C 的编译选项是 CMAKE_C_FLAGS\n# 指定编译参数，可选\n\n# SET(CMAKE_CXX_FLAGS \"-Wno-error=format-security -Wno-error=pointer-sign\")\n\n# Creates and names a library, sets it as either STATIC\n# or SHARED, and provides the relative paths to its source code.\n# You can define multiple libraries, and CMake builds them for you.\n# Gradle automatically packages shared libraries with your APK.\n\nadd_library( # Sets the name of the library.\n             MagicJni\n\n             # Sets the library as a shared library.\n             SHARED\n\n             # Provides a relative path to your source file(s).\n              src/main/cpp/beautify/MagicBeautify.cpp\n              src/main/cpp/bitmap/BitmapOperation.cpp\n              src/main/cpp/bitmap/Conversion.cpp\n              src/main/cpp/MagicJni.cpp\n             )\n\ntarget_link_libraries( MagicJni\n                       log )\n\n# Searches for a specified prebuilt library and stores the path as a\n# variable. Because CMake includes system libraries in the search path by\n# default, you only need to specify the name of the public NDK library\n# you want to add. CMake verifies that the library exists before\n# completing its build.\n\nfind_library( # Sets the name of the path variable.\n              log-lib\n\n              # Specifies the name of the NDK library that\n              # you want CMake to locate.\n              log )\n\n# Specifies libraries CMake should link to your target library. You\n# can link multiple libraries, such as libraries you define in this\n# build script, prebuilt third-party libraries, or system libraries.\n# 设置生成的so动态库最后输出的路径\n\nset(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/../jniLibs/${ANDROID_ABI})\n\ntarget_link_libraries( # Specifies the target library.\n                       MagicJni\n                       # Links the target library to the log library\n                       # included in the NDK.\n                       #加入该依赖库\n                       jnigraphics\n                       ${log-lib} )"
  },
  {
    "path": "MagicShow/build.gradle",
    "content": "apply plugin: 'com.android.library'\n//apply from: \"$project.rootDir/tools/versions_configuration.gradle\"\n// JitPack Maven\napply plugin: 'com.github.dcendents.android-maven'\n// Your Group\ngroup='com.github.zerochl'\nandroid {\n    compileSdkVersion 28\n    buildToolsVersion \"28.0.0\"\n\n    defaultConfig {\n        minSdkVersion 18\n        targetSdkVersion 28\n        versionCode 1\n        versionName \"1.0\"\n        externalNativeBuild {\n            cmake {\n                cppFlags \"-std=c++11\"\n//                cppFlags \"-DANDROID_NDK\",\"-D_DEBUG\"\n            }\n        }\n        ndk{\n            moduleName \"MagicJni\"\n            abiFilters \"armeabi-v7a\",\"arm64-v8a\",\"x86\",\"x86_64\"\n//            stl = \"stlport_static\"\n        }\n    }\n\n    lintOptions {\n        abortOnError false\n    }\n    externalNativeBuild {\n        cmake {\n            path \"CMakeLists.txt\"\n        }\n    }\n    sourceSets{\n        main{\n            jniLibs.srcDirs = ['src/main/jniLibs']\n        }\n    }\n\n    buildTypes {\n        release {\n            minifyEnabled = false\n            proguardFiles.add(file('proguard-rules.txt'))\n        }\n    }\n}\n\n\ndependencies {\n    api fileTree(include: ['*.jar'], dir: 'libs')\n    testImplementation 'junit:junit:4.12'\n    api files('src/main/libs/zero.jar')\n    api \"com.android.support:design:27.1.1\"\n    api \"com.android.support:appcompat-v7:27.1.1\"\n    api 'io.reactivex:rxjava:latest.integration'\n    api 'io.reactivex:rxandroid:latest.integration'\n\n}\n"
  },
  {
    "path": "MagicShow/proguard-rules.pro",
    "content": "# Add project specific ProGuard rules here.\n# By default, the flags in this file are appended to flags specified\n# in D:\\android-sdk-windows/tools/proguard/proguard-android.txt\n# You can edit the include path and order by changing the proguardFiles\n# directive in build.gradle.\n#\n# For more details, see\n#   http://developer.android.com/guide/developing/tools/proguard.html\n\n# Add any project specific keep options here:\n\n# If your project uses WebView with JS, uncomment the following\n# and specify the fully qualified class name to the JavaScript interface\n# class:\n#-keepclassmembers class fqcn.of.javascript.interface.for.webview {\n#   public *;\n#}\n"
  },
  {
    "path": "MagicShow/src/androidTest/java/com/zero/magicshow/core/ApplicationTest.java",
    "content": "package com.zero.magicshow.core;\n\nimport android.app.Application;\nimport android.test.ApplicationTestCase;\n\n/**\n * <a href=\"http://d.android.com/tools/testing/testing_android.html\">Testing Fundamentals</a>\n */\npublic class ApplicationTest extends ApplicationTestCase<Application> {\n    public ApplicationTest() {\n        super(Application.class);\n    }\n}"
  },
  {
    "path": "MagicShow/src/main/AndroidManifest.xml",
    "content": "<manifest package=\"com.zero.magicshow\">\n\n\n\n</manifest>\n"
  },
  {
    "path": "MagicShow/src/main/cpp/MagicJni.cpp",
    "content": "#include <jni.h>\n#include <android/log.h>\n#include <stdio.h>\n#include \"bitmap/BitmapOperation.h\"\n#include \"beautify/MagicBeautify.h\"\n\n#define  LOG_TAG    \"MagicJni\"\n#define  LOGD(...)  __android_log_print(ANDROID_LOG_DEBUG,LOG_TAG,__VA_ARGS__)\n#define  LOGE(...)  __android_log_print(ANDROID_LOG_ERROR,LOG_TAG,__VA_ARGS__)\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\nJNIEXPORT void JNICALL\nJava_com_zero_magicshow_core_beautify_MagicJni_jniInitMagicBeautify(JNIEnv *env, jobject instance,\n                                                                jobject handler) {\n    //LOGE(\"in jniInitMagicBeautify\");\n    JniBitmap* jniBitmap = (JniBitmap*) env->GetDirectBufferAddress(handler);\n    if (jniBitmap->_storedBitmapPixels == NULL){\n        LOGE(\"no bitmap data was stored. returning null...\");\n        return;\n    }\n    MagicBeautify::getInstance()->initMagicBeautify(jniBitmap);\n}\n\nJNIEXPORT void JNICALL\nJava_com_zero_magicshow_core_beautify_MagicJni_jniStartWhiteSkin(JNIEnv *env, jobject instance,\n                                                             jfloat whiteLevel){\n    MagicBeautify::getInstance()->startWhiteSkin(whiteLevel);\n}\n\nJNIEXPORT void JNICALL\nJava_com_zero_magicshow_core_beautify_MagicJni_jniStartSkinSmooth(JNIEnv *env, jobject instance,\n                                                              jobject obj, jfloat DenoiseLevel){\n    float sigema = 10 + DenoiseLevel * DenoiseLevel * 5;\n    MagicBeautify::getInstance()->startSkinSmooth(sigema);\n}\n\nJNIEXPORT void JNICALL\nJava_com_zero_magicshow_core_beautify_MagicJni_jniUnInitMagicBeautify(JNIEnv *env, jobject instance){\n    MagicBeautify::getInstance()->unInitMagicBeautify();\n}\n\nJNIEXPORT jobject JNICALL\nJava_com_zero_magicshow_core_beautify_MagicJni_jniStoreBitmapData(JNIEnv *env, jobject instance,\n                                                              jobject bitmap){\n    //LOGE(\"in jniStoreBitmapData\");\n    return BitmapOperation::jniStoreBitmapData(env, instance, bitmap);\n}\n\nJNIEXPORT void JNICALL\nJava_com_zero_magicshow_core_beautify_MagicJni_jniFreeBitmapData(JNIEnv *env, jobject instance,\n                                                             jobject handle){\n    BitmapOperation::jniFreeBitmapData(env, instance, handle);\n}\n\nJNIEXPORT jobject JNICALL\nJava_com_zero_magicshow_core_beautify_MagicJni_jniGetBitmapFromStoredBitmapData(JNIEnv *env, jobject instance,\n                                                                            jobject handle){\n    return BitmapOperation::jniGetBitmapFromStoredBitmapData(env, instance, handle);\n}\n#ifdef __cplusplus\n}\n#endif\n"
  },
  {
    "path": "MagicShow/src/main/cpp/beautify/MagicBeautify.cpp",
    "content": "#include \"MagicBeautify.h\"\n#include \"Math.h\"\n#include \"../bitmap/BitmapOperation.h\"\n#include \"../bitmap/Conversion.h\"\n#include <pthread.h> //多线程相关操作头文件，可移植众多平台\n\n#define  LOG_TAG    \"MagicBeautify\"\n#define  LOGD(...)  __android_log_print(ANDROID_LOG_DEBUG,LOG_TAG,__VA_ARGS__)\n#define  LOGE(...)  __android_log_print(ANDROID_LOG_ERROR,LOG_TAG,__VA_ARGS__)\n\n#define div255(x) (x * 0.003921F)\n#define abs(x) (x>=0 ? x:(-x))\n\nMagicBeautify* MagicBeautify::instance;\n\nMagicBeautify* MagicBeautify::getInstance()\n{\n\tif (instance == NULL)\n\t\tinstance = new MagicBeautify();\n\treturn instance;\n}\n\nMagicBeautify::MagicBeautify()\n{\n\tLOGE(\"MagicBeautify\");\n\tmIntegralMatrix = NULL;\n\tmIntegralMatrixSqr = NULL;\n\tmImageData_yuv = NULL;\n\tmSkinMatrix = NULL;\n\tmImageData_rgb = NULL;\n\tmSmoothLevel = 0.0;\n\tmWhitenLevel = 0.0;\n}\n\nMagicBeautify::~MagicBeautify()\n{\n\tLOGE(\"~MagicBeautify\");\n\tif(mIntegralMatrix != NULL)\n\t\tdelete[] mIntegralMatrix;\n\tif(mIntegralMatrixSqr != NULL)\n\t\tdelete[] mIntegralMatrixSqr;\n\tif(mImageData_yuv != NULL)\n\t\tdelete[] mImageData_yuv;\n\tif(mSkinMatrix != NULL)\n\t\tdelete[] mSkinMatrix;\n\tif(mImageData_rgb != NULL)\n\t\tdelete[] mImageData_rgb;\n}\n\nvoid MagicBeautify::initMagicBeautify(JniBitmap* jniBitmap){\n\tLOGE(\"initMagicBeautify\");\n\tstoredBitmapPixels = jniBitmap->_storedBitmapPixels;\n\tmImageWidth = jniBitmap->_bitmapInfo.width;\n\tmImageHeight = jniBitmap->_bitmapInfo.height;\n\n\tif(mImageData_rgb == NULL)\n\t\tmImageData_rgb = new uint32_t[mImageWidth*mImageHeight];\n\tmemcpy(mImageData_rgb, jniBitmap->_storedBitmapPixels, sizeof(uint32_t) * mImageWidth * mImageHeight);\n\tif(mImageData_yuv == NULL)\n\t\tmImageData_yuv = new uint8_t[mImageWidth * mImageHeight * 3];\n\tConversion::RGBToYCbCr((uint8_t*)mImageData_rgb, mImageData_yuv, mImageWidth * mImageHeight);\n\tinitSkinMatrix();\n\tinitIntegral();\n}\n\nvoid MagicBeautify::unInitMagicBeautify(){\n\tif(instance != NULL)\n\t\tdelete instance;\n\tinstance = NULL;\n}\n\nvoid MagicBeautify::startSkinSmooth(float smoothlevel){\n\t_startBeauty(smoothlevel,mWhitenLevel);\n}\n\nvoid MagicBeautify::startWhiteSkin(float whitenlevel){\n\t_startBeauty(mSmoothLevel,whitenlevel);\n}\n\nvoid MagicBeautify::_startBeauty(float smoothlevel, float whitenlevel){\n\tLOGE(\"smoothlevel=%f---whitenlevel=%f\",smoothlevel,whitenlevel);\n\tif(smoothlevel >= 10.0 && smoothlevel <= 510.0 && mSmoothLevel != smoothlevel){\n\t\tmSmoothLevel = smoothlevel;\n\t\t_startSkinSmooth(mSmoothLevel);\n\t}\n\tif(whitenlevel >= 1.0 && whitenlevel <= 5.0 && whitenlevel != mWhitenLevel){\n\t\tmWhitenLevel = whitenlevel;\n\t\t_startWhiteSkin(mWhitenLevel);\n\t}\n}\n\nvoid MagicBeautify::_startWhiteSkin(float whitenlevel){\n\tfloat a = log(whitenlevel);\n    pthread_t tids[4]; //线程id\n    float threadFirstParams[2] = {whitenlevel,1};\n//    LOGE(\"_FirstPart=%f---second part=%f\",threadFirstParams[0],threadFirstParams[1]);\n    pthread_create(&tids[0], NULL, _startWhiteSkinAsync, (void*)&threadFirstParams); //参数：创建的线程id，线程参数，线程运行函数的起始地址，运行函数的参数\n    float threadSecondParams[2] = {whitenlevel,2};\n    pthread_create(&tids[1], NULL, _startWhiteSkinAsync, (void*)&threadSecondParams);\n    float threadThirdParams[2] = {whitenlevel,3};\n    pthread_create(&tids[2], NULL, _startWhiteSkinAsync, (void*)&threadThirdParams);\n    float threadFourthParams[2] = {whitenlevel,4};\n    pthread_create(&tids[3], NULL, _startWhiteSkinAsync, (void*)&threadFourthParams);\n    pthread_join (tids[0], NULL);\n    pthread_join (tids[1], NULL);\n    pthread_join (tids[2], NULL);\n    pthread_join (tids[3], NULL);\n}\n\nvoid* MagicBeautify::_startWhiteSkinAsync( void* args )\n{\n    float *p=(float *)args;\n    float whitenlevel= p[0];\n    int partSecion = (int)p[1];\n    int startHeight = partSecion == 1 ? 0 : partSecion == 2 ?\n                      getInstance()->mImageHeight / 4 : partSecion == 3 ?\n                      getInstance()->mImageHeight / 2 : partSecion == 4 ?\n                      getInstance()->mImageHeight / 4 * 3 : 0;\n    int endHeight = partSecion == 1 ? getInstance()->mImageHeight / 4 :\n                      partSecion == 2 ? getInstance()->mImageHeight / 2 :\n                      partSecion == 3 ? getInstance()->mImageHeight / 4 * 3 :\n                      partSecion == 4 ? getInstance()->mImageHeight : 0;\n//    float whitenlevel = *( (float*)args );\n    float a = log(whitenlevel);\n    for(int i = startHeight; i < endHeight; i++){\n        for(int j = 0; j < getInstance()->mImageWidth; j++){\n            //calculate the point location\n            int offset = i*getInstance()->mImageWidth+j;\n            ARGB RGB;\n            BitmapOperation::convertIntToArgb(getInstance()->mImageData_rgb[offset],&RGB);\n            if(a != 0){\n                RGB.red = 255 * (log(div255(RGB.red) * (whitenlevel - 1) + 1) / a);\n                RGB.green = 255 * (log(div255(RGB.green) * (whitenlevel - 1) + 1) / a);\n                RGB.blue = 255 * (log(div255(RGB.blue) * (whitenlevel - 1) + 1) / a);\n            }\n            getInstance()->storedBitmapPixels[offset] = BitmapOperation::convertArgbToInt(RGB);\n        }\n    }\n    pthread_exit(nullptr);\n} //函数返回的是函数指针，便于后面作为参数\n\nvoid MagicBeautify::_startSkinSmooth(float smoothlevel){\n\tif(mIntegralMatrix == NULL || mIntegralMatrixSqr == NULL || mSkinMatrix == NULL){\n\t\tLOGE(\"not init correctly\");\n\t\treturn;\n\t}\n\tConversion::RGBToYCbCr((uint8_t*)mImageData_rgb, mImageData_yuv, mImageWidth * mImageHeight);\n\n\tint radius = mImageWidth > mImageHeight ? mImageWidth * 0.02 : mImageHeight * 0.02;\n\n\tfor(int i = 1; i < mImageHeight; i++){\n\t\tfor(int j = 1; j < mImageWidth; j++){\n\t\t\tint offset = i * mImageWidth + j;\n\t\t\tif(mSkinMatrix[offset] == 255){\n\t\t\t\tint iMax = i + radius >= mImageHeight-1 ? mImageHeight-1 : i + radius;\n\t\t\t\tint jMax = j + radius >= mImageWidth-1 ? mImageWidth-1 :j + radius;\n\t\t\t\tint iMin = i - radius <= 1 ? 1 : i - radius;\n\t\t\t\tint jMin = j - radius <= 1 ? 1 : j - radius;\n\n\t\t\t\tint squar = (iMax - iMin + 1)*(jMax - jMin + 1);\n\t\t\t\tint i4 = iMax*mImageWidth+jMax;\n\t\t\t\tint i3 = (iMin-1)*mImageWidth+(jMin-1);\n\t\t\t\tint i2 = iMax*mImageWidth+(jMin-1);\n\t\t\t\tint i1 = (iMin-1)*mImageWidth+jMax;\n\n\t\t\t\tfloat m = (mIntegralMatrix[i4]\n\t\t\t\t\t\t+ mIntegralMatrix[i3]\n\t\t\t\t\t\t- mIntegralMatrix[i2]\n\t\t\t\t\t\t- mIntegralMatrix[i1]) / squar;\n\n\t\t\t\tfloat v = (mIntegralMatrixSqr[i4]\n\t\t\t\t\t\t+ mIntegralMatrixSqr[i3]\n\t\t\t\t\t\t- mIntegralMatrixSqr[i2]\n\t\t\t\t\t\t- mIntegralMatrixSqr[i1]) / squar - m*m;\n\t\t\t\tfloat k = v / (v + smoothlevel);\n\n\t\t\t\tmImageData_yuv[offset * 3] = ceil(m - k * m + k * mImageData_yuv[offset * 3]);\n\t\t\t}\n\t\t}\n\t}\n\tConversion::YCbCrToRGB(mImageData_yuv, (uint8_t*)storedBitmapPixels,\n\t\tmImageWidth * mImageHeight);\n}\n\nvoid MagicBeautify::initSkinMatrix(){\n\tLOGE(\"initSkinMatrix\");\n\tif(mSkinMatrix == NULL)\n\t\tmSkinMatrix = new uint8_t[mImageWidth * mImageHeight];\n\tfor(int i = 0; i < mImageHeight; i++){\n\t\tfor(int j = 0; j < mImageWidth; j++){\n\t\t\tint offset = i*mImageWidth+j;\n\t\t\tARGB RGB;\n\t\t\tBitmapOperation::convertIntToArgb(mImageData_rgb[offset],&RGB);\n\t\t\tif ((RGB.blue>95 && RGB.green>40 && RGB.red>20 &&\n\t\t\t\t\tRGB.blue-RGB.red>15 && RGB.blue-RGB.green>15)||\n\t\t\t\t\t(RGB.blue>200 && RGB.green>210 && RGB.red>170 &&\n\t\t\t\t\tabs(RGB.blue-RGB.red)<=15 && RGB.blue>RGB.red&& RGB.green>RGB.red))\n\t\t\t\tmSkinMatrix[offset] = 255;\n\t\t\telse\n\t\t\t\tmSkinMatrix[offset] = 0;\n\t\t}\n\t}\n}\n\nvoid MagicBeautify::initIntegral(){\n\tLOGE(\"initIntegral\");\n\tif(mIntegralMatrix == NULL)\n\t\tmIntegralMatrix = new uint64_t[mImageWidth * mImageHeight];\n\tif(mIntegralMatrixSqr == NULL)\n\t\tmIntegralMatrixSqr = new uint64_t[mImageWidth * mImageHeight];\n\n\tuint64_t *columnSum = new uint64_t[mImageWidth];\n\tuint64_t *columnSumSqr = new uint64_t[mImageWidth];\n\n\tcolumnSum[0] = mImageData_yuv[0];\n\tcolumnSumSqr[0] = mImageData_yuv[0] * mImageData_yuv[0];\n\n\tmIntegralMatrix[0] = columnSum[0];\n\tmIntegralMatrixSqr[0] = columnSumSqr[0];\n\n    for(int i = 1;i < mImageWidth;i++){\n\n    \tcolumnSum[i] = mImageData_yuv[3*i];\n    \tcolumnSumSqr[i] = mImageData_yuv[3*i] * mImageData_yuv[3*i];\n\n    \tmIntegralMatrix[i] = columnSum[i];\n    \tmIntegralMatrix[i] += mIntegralMatrix[i-1];\n    \tmIntegralMatrixSqr[i] = columnSumSqr[i];\n    \tmIntegralMatrixSqr[i] += mIntegralMatrixSqr[i-1];\n    }\n    for (int i = 1;i < mImageHeight; i++){\n        int offset = i * mImageWidth;\n\n        columnSum[0] += mImageData_yuv[3*offset];\n        columnSumSqr[0] += mImageData_yuv[3*offset] * mImageData_yuv[3*offset];\n\n        mIntegralMatrix[offset] = columnSum[0];\n        mIntegralMatrixSqr[offset] = columnSumSqr[0];\n\n        for(int j = 1; j < mImageWidth; j++){\n        \tcolumnSum[j] += mImageData_yuv[3*(offset+j)];\n        \tcolumnSumSqr[j] += mImageData_yuv[3*(offset+j)] * mImageData_yuv[3*(offset+j)];\n\n        \tmIntegralMatrix[offset+j] = mIntegralMatrix[offset+j-1] + columnSum[j];\n        \tmIntegralMatrixSqr[offset+j] = mIntegralMatrixSqr[offset+j-1] + columnSumSqr[j];\n        }\n    }\n    delete[] columnSum;\n    delete[] columnSumSqr;\n    LOGE(\"initIntegral~end\");\n}\n\n"
  },
  {
    "path": "MagicShow/src/main/cpp/beautify/MagicBeautify.h",
    "content": "#ifndef _MAGIC_BEAUTIFY_H_\n#define _MAGIC_BEAUTIFY_H_\n\n#include \"../bitmap/JniBitmap.h\"\n\nclass MagicBeautify\n{\npublic:\n\tvoid initMagicBeautify(JniBitmap* jniBitmap);\n\tvoid unInitMagicBeautify();\n\n    void startSkinSmooth(float smoothlevel);\n    void startWhiteSkin(float whitenlevel);\n\n    static MagicBeautify* getInstance();\n    ~MagicBeautify();\n\n    static void* _startWhiteSkinAsync(void* args);\nprivate:\n    static MagicBeautify * instance;\n    MagicBeautify();\n\n    uint64_t *mIntegralMatrix;\n\tuint64_t *mIntegralMatrixSqr;\n\n\tuint32_t *storedBitmapPixels;\n\tuint32_t *mImageData_rgb;\n\n\tuint8_t *mImageData_yuv;\n\tuint8_t *mSkinMatrix;\n\n    int mImageWidth;\n    int mImageHeight;\n\tfloat mSmoothLevel;\n\tfloat mWhitenLevel;\n\t\n\tvoid initIntegral();\n\t\n\tvoid initSkinMatrix();\n\n\tvoid _startBeauty(float smoothlevel, float whitenlevel);\n\tvoid _startSkinSmooth(float smoothlevel);\n\tvoid _startWhiteSkin(float whitenlevel);\n};\n#endif\n"
  },
  {
    "path": "MagicShow/src/main/cpp/bitmap/BitmapOperation.cpp",
    "content": "#include \"BitmapOperation.h\"\n#include \"Conversion.h\"\n#define  LOG_TAG    \"BitmapOperation\"\n#define  LOGD(...)  __android_log_print(ANDROID_LOG_DEBUG,LOG_TAG,__VA_ARGS__)\n#define  LOGE(...)  __android_log_print(ANDROID_LOG_ERROR,LOG_TAG,__VA_ARGS__)\n\nint32_t BitmapOperation::convertArgbToInt(ARGB argb)\n{\n\treturn (argb.alpha << 24) | (argb.red << 16) | (argb.green << 8) | argb.blue;\n}\n\nvoid BitmapOperation::convertIntToArgb(uint32_t pixel, ARGB* argb)\n{\n\targb->red = ((pixel >> 16) & 0xff);\n\targb->green = ((pixel >> 8) & 0xff);\n\targb->blue = (pixel & 0xff);\n\targb->alpha = (pixel >> 24);\n}\n\n/**store java bitmap as JNI data*/ //\njobject BitmapOperation::jniStoreBitmapData(\n\tJNIEnv * env, jobject obj, jobject bitmap)\n{\n\t//LOGE(\"reading bitmap info...\");\n    AndroidBitmapInfo bitmapInfo;\n    uint32_t* storedBitmapPixels = NULL;\n    int ret;\n    if ((ret = AndroidBitmap_getInfo(env, bitmap, &bitmapInfo)) < 0)\n\t{\n    \tLOGE(\"AndroidBitmap_getInfo() failed ! error=%d\", ret);\n    \treturn NULL;\n\t}\n    //LOGE(\"width:%d height:%d stride:%d\", bitmapInfo.width, bitmapInfo.height, bitmapInfo.stride);\n    if (bitmapInfo.format != ANDROID_BITMAP_FORMAT_RGBA_8888)\n\t{\n    \tLOGE(\"Bitmap format is not RGBA_8888!\");\n    \treturn NULL;\n\t}\n    //\n    //read pixels of bitmap into native memory :\n    //\n    void* bitmapPixels;\n\tif ((ret = AndroidBitmap_lockPixels(env, bitmap, &bitmapPixels)) < 0)\n\t{\n\t\tLOGE(\"AndroidBitmap_lockPixels() failed ! error=%d\", ret);\n\t\treturn NULL;\n\t}\n\tuint32_t* src = (uint32_t*) bitmapPixels;\n    storedBitmapPixels = new uint32_t[bitmapInfo.height * bitmapInfo.width];\n    int pixelsCount = bitmapInfo.height * bitmapInfo.width;\n    memcpy(storedBitmapPixels, src, sizeof(uint32_t) * pixelsCount);\n    AndroidBitmap_unlockPixels(env, bitmap);\n    JniBitmap *jniBitmap = new JniBitmap();\n    jniBitmap->_bitmapInfo = bitmapInfo;\n    jniBitmap->_storedBitmapPixels = storedBitmapPixels;\n    //LOGE(\"return NewDirectByteBuffer\");\n    return env->NewDirectByteBuffer(jniBitmap, 0);\n}\n\n/**free bitmap*/ //\nvoid BitmapOperation::jniFreeBitmapData(\n\tJNIEnv * env, jobject obj, jobject handle)\n{\n    JniBitmap* jniBitmap = (JniBitmap*) env->GetDirectBufferAddress(handle);\n    if (jniBitmap->_storedBitmapPixels == NULL)\n    \treturn;\n    delete[] jniBitmap->_storedBitmapPixels;\n    jniBitmap->_storedBitmapPixels = NULL;\n    delete jniBitmap;\n}\n\n/**restore java bitmap (from JNI data)*/ //\njobject BitmapOperation::jniGetBitmapFromStoredBitmapData(\n\tJNIEnv * env, jobject obj, jobject handle)\n{\n    JniBitmap* jniBitmap = (JniBitmap*) env->GetDirectBufferAddress(handle);\n    if (jniBitmap->_storedBitmapPixels == NULL)\n\t{\n    \tLOGD(\"no bitmap data was stored. returning null...\");\n    \treturn NULL;\n\t}\n    //\n    //creating a new bitmap to put the pixels into it - using Bitmap Bitmap.createBitmap (int width, int height, Bitmap.Config config) :\n    //\n    jclass bitmapCls = env->FindClass(\"android/graphics/Bitmap\");\n    jmethodID createBitmapFunction = env->GetStaticMethodID(bitmapCls,\n\t    \"createBitmap\",\n\t    \"(IILandroid/graphics/Bitmap$Config;)Landroid/graphics/Bitmap;\");\n    jstring configName = env->NewStringUTF(\"ARGB_8888\");\n    jclass bitmapConfigClass = env->FindClass(\"android/graphics/Bitmap$Config\");\n    jmethodID valueOfBitmapConfigFunction = env->GetStaticMethodID(\n\t    bitmapConfigClass, \"valueOf\",\n\t    \"(Ljava/lang/String;)Landroid/graphics/Bitmap$Config;\");\n    jobject bitmapConfig = env->CallStaticObjectMethod(bitmapConfigClass,\n\t    valueOfBitmapConfigFunction, configName);\n    jobject newBitmap = env->CallStaticObjectMethod(bitmapCls,\n\t    createBitmapFunction, jniBitmap->_bitmapInfo.width,\n\t    jniBitmap->_bitmapInfo.height, bitmapConfig);\n    //\n    // putting the pixels into the new bitmap:\n    //\n    int ret;\n    void* bitmapPixels;\n    if ((ret = AndroidBitmap_lockPixels(env, newBitmap, &bitmapPixels)) < 0)\n\t{\n    \tLOGE(\"AndroidBitmap_lockPixels() failed ! error=%d\", ret);\n    \treturn NULL;\n\t}\n    uint32_t* newBitmapPixels = (uint32_t*) bitmapPixels;\n    int pixelsCount = jniBitmap->_bitmapInfo.height\n\t    * jniBitmap->_bitmapInfo.width;\n    memcpy(newBitmapPixels, jniBitmap->_storedBitmapPixels,\n\t    sizeof(uint32_t) * pixelsCount);\n    AndroidBitmap_unlockPixels(env, newBitmap);\n    //LOGD(\"returning the new bitmap\");\n    return newBitmap;\n}\n"
  },
  {
    "path": "MagicShow/src/main/cpp/bitmap/BitmapOperation.h",
    "content": "#ifndef _BITMAP_OPERATION_H_\n#define _BITMAP_OPERATION_H_\n\n#include <jni.h>\n#include <android/log.h>\n#include <stdio.h>\n#include <android/bitmap.h>\n#include <cstring>\n#include <unistd.h>\n#include \"JniBitmap.h\"\n\nclass BitmapOperation\n{\npublic:\n\n\tstatic int32_t convertArgbToInt(ARGB argb);\n\tstatic void convertIntToArgb(uint32_t pixel, ARGB* argb);\n\n\tstatic jobject jniStoreBitmapData(\n\t\tJNIEnv * env, jobject obj, jobject bitmap);\n\tstatic void jniFreeBitmapData(\n\t\tJNIEnv * env, jobject obj, jobject handle);\n\tstatic jobject jniGetBitmapFromStoredBitmapData(\n\t\tJNIEnv * env, jobject obj, jobject handle);\n};\n#endif\n"
  },
  {
    "path": "MagicShow/src/main/cpp/bitmap/Conversion.cpp",
    "content": "#include \"Conversion.h\"\n\nvoid Conversion::YCbCrToRGB(uint8_t* From, uint8_t* To, int length)\n{\n\tif (length < 1) return;\n\tint Red, Green, Blue;\n\tint Y, Cb, Cr;\n\tint i,offset;\n\tfor(i = 0; i < length; i++)\n\t{\n\t\toffset = (i << 1) + i;\n\t\tY = From[offset]; Cb = From[offset+1] - 128; Cr = From[offset+2] - 128;\n\t\tRed = Y + ((RGBRCrI * Cr + HalfShiftValue) >> Shift);\n\t\tGreen = Y + ((RGBGCbI * Cb + RGBGCrI * Cr + HalfShiftValue) >> Shift);\n\t\tBlue = Y + ((RGBBCbI * Cb + HalfShiftValue) >> Shift);\n\t\tif (Red > 255) Red = 255; else if (Red < 0) Red = 0;\n\t\tif (Green > 255) Green = 255; else if (Green < 0) Green = 0;\n\t\tif (Blue > 255) Blue = 255; else if (Blue < 0) Blue = 0;\n\t\toffset = i << 2;\n\t\tTo[offset] = (uint8_t)Blue;\n\t\tTo[offset+1] = (uint8_t)Green;\n\t\tTo[offset+2] = (uint8_t)Red;\n\t\tTo[offset+3] = 0xff;\n\t}\n}\n\nvoid Conversion::RGBToYCbCr(uint8_t* From, uint8_t* To, int length)\n{\n\tif (length < 1) return;\n\tint Red, Green, Blue;\n\tint i,offset;\n\tfor(i = 0; i < length; i++)\n\t{\n\t\toffset = i << 2;\n\t\tBlue = From[offset]; Green = From[offset+1]; Red = From[offset+2];\n\t\toffset = (i << 1) + i;\n\t\tTo[offset] = (uint8_t)((YCbCrYRI * Red + YCbCrYGI * Green + YCbCrYBI * Blue + HalfShiftValue) >> Shift);\n\t\tTo[offset+1] = (uint8_t)(128 + ((YCbCrCbRI * Red + YCbCrCbGI * Green + YCbCrCbBI * Blue + HalfShiftValue) >> Shift));\n\t\tTo[offset+2] = (uint8_t)(128 + ((YCbCrCrRI * Red + YCbCrCrGI * Green + YCbCrCrBI * Blue + HalfShiftValue) >> Shift));\n\t}\n}\n"
  },
  {
    "path": "MagicShow/src/main/cpp/bitmap/Conversion.h",
    "content": "#ifndef _CONVERSION_H_\n#define _CONVERSION_H_\n\n#include <stdio.h>\n#include <android/log.h>\n\nconst float YCbCrYRF = 0.299F;\nconst float YCbCrYGF = 0.587F;\nconst float YCbCrYBF = 0.114F;\nconst float YCbCrCbRF = -0.168736F;\nconst float YCbCrCbGF = -0.331264F;\nconst float YCbCrCbBF = 0.500000F;\nconst float YCbCrCrRF = 0.500000F;\nconst float YCbCrCrGF = -0.418688F;\nconst float YCbCrCrBF = -0.081312F;\n\nconst float RGBRYF = 1.00000F;\nconst float RGBRCbF = 0.0000F;\nconst float RGBRCrF = 1.40200F;\nconst float RGBGYF = 1.00000F;\nconst float RGBGCbF = -0.34414F;\nconst float RGBGCrF = -0.71414F;\nconst float RGBBYF = 1.00000F;\nconst float RGBBCbF = 1.77200F;\nconst float RGBBCrF = 0.00000F;\n\nconst int Shift = 20;\nconst int HalfShiftValue = 1 << (Shift - 1);\n\nconst int YCbCrYRI = (int)(YCbCrYRF * (1 << Shift) + 0.5);\nconst int YCbCrYGI = (int)(YCbCrYGF * (1 << Shift) + 0.5);\nconst int YCbCrYBI = (int)(YCbCrYBF * (1 << Shift) + 0.5);\nconst int YCbCrCbRI = (int)(YCbCrCbRF * (1 << Shift) + 0.5);\nconst int YCbCrCbGI = (int)(YCbCrCbGF * (1 << Shift) + 0.5);\nconst int YCbCrCbBI = (int)(YCbCrCbBF * (1 << Shift) + 0.5);\nconst int YCbCrCrRI = (int)(YCbCrCrRF * (1 << Shift) + 0.5);\nconst int YCbCrCrGI = (int)(YCbCrCrGF * (1 << Shift) + 0.5);\nconst int YCbCrCrBI = (int)(YCbCrCrBF * (1 << Shift) + 0.5);\n\nconst int RGBRYI = (int)(RGBRYF * (1 << Shift) + 0.5);\nconst int RGBRCbI = (int)(RGBRCbF * (1 << Shift) + 0.5);\nconst int RGBRCrI = (int)(RGBRCrF * (1 << Shift) + 0.5);\nconst int RGBGYI = (int)(RGBGYF * (1 << Shift) + 0.5);\nconst int RGBGCbI = (int)(RGBGCbF * (1 << Shift) + 0.5);\nconst int RGBGCrI = (int)(RGBGCrF * (1 << Shift) + 0.5);\nconst int RGBBYI = (int)(RGBBYF * (1 << Shift) + 0.5);\nconst int RGBBCbI = (int)(RGBBCbF * (1 << Shift) + 0.5);\nconst int RGBBCrI = (int)(RGBBCrF * (1 << Shift) + 0.5);\n\nclass Conversion\n{\npublic:\n\tstatic void YCbCrToRGB(uint8_t* From, uint8_t* To, int Length);\n\tstatic void RGBToYCbCr(uint8_t* From, uint8_t* To, int Length);\nprivate:\n\n};\n#endif\n"
  },
  {
    "path": "MagicShow/src/main/cpp/bitmap/JniBitmap.h",
    "content": "#ifndef _JNI_BITMAP_H_\n#define _JNI_BITMAP_H_\n#include <android/bitmap.h>\n\ntypedef struct\n{\n\tuint8_t alpha, red, green, blue;\n} ARGB;\n\nclass JniBitmap\n{\npublic:\n    uint32_t* _storedBitmapPixels;\n    AndroidBitmapInfo _bitmapInfo;\n    JniBitmap()\n\t{\n    \t_storedBitmapPixels = NULL;\n\t}\n};\n#endif\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/MagicShowManager.java",
    "content": "package com.zero.magicshow;\n\nimport android.Manifest;\nimport android.app.Activity;\nimport android.content.Context;\nimport android.content.Intent;\nimport android.content.pm.PackageManager;\nimport android.support.v4.app.ActivityCompat;\nimport android.support.v4.content.PermissionChecker;\nimport android.text.TextUtils;\nimport android.util.Log;\n\nimport com.zero.magicshow.activity.AlbumActivity;\nimport com.zero.magicshow.activity.CameraActivity;\nimport com.zero.magicshow.common.entity.MagicShowResultEntity;\nimport com.zero.magicshow.common.iface.CameraShootCallBack;\nimport com.zero.magicshow.common.iface.ImageEditCallBack;\nimport com.zero.magicshow.common.utils.Constants;\nimport com.zero.magicshow.common.utils.RxBus;\nimport com.zero.magicshow.common.config.PathConfig;\nimport com.zero.zerolib.util.FileUtil;\n\nimport rx.functions.Action1;\n\n/**\n * Created by hongli on 2017/8/31.\n */\n\npublic class MagicShowManager {\n    private static final String TAG = \"MagicShowManager\";\n    private static final MagicShowManager magicShowManager = new MagicShowManager();\n    private MagicShowManager(){}\n    public static MagicShowManager getInstance(){\n        return magicShowManager;\n    }\n\n    public void setCachePath(String cachePath){\n        PathConfig.setTempCache(cachePath);\n    }\n\n    /**\n     * 执行照片编辑\n     * @param context\n     * @param imagePath\n     * @param imageEditCallBack\n     */\n    public void openEdit(Context context,String imagePath, final ImageEditCallBack imageEditCallBack){\n        if(null == context || TextUtils.isEmpty(imagePath) || !FileUtil.isExist(imagePath)){\n            Log.e(TAG,\"in open edit data error.\");\n            return;\n        }\n        RxBus.getInstance().unregisterMain(Constants.RX_JAVA_TYPE_IMAGE_EDIT);\n        RxBus.getInstance().registerMain(Constants.RX_JAVA_TYPE_IMAGE_EDIT, new Action1<MagicShowResultEntity>() {\n            @Override\n            public void call(MagicShowResultEntity magicShowResultEntity) {\n                imageEditCallBack.onCompentFinished(magicShowResultEntity);\n                RxBus.getInstance().unregisterMain(Constants.RX_JAVA_TYPE_IMAGE_EDIT);\n            }\n        });\n        Intent intent = new Intent(context, AlbumActivity.class);\n        intent.putExtra(Constants.TRANSMIT_IMAGE_URL,imagePath);\n        context.startActivity(intent);\n    }\n\n    /**\n     * 执行拍照\n     * @param context\n     * @param cameraShootCallBack\n     */\n    public void openCamera(Activity context,final CameraShootCallBack cameraShootCallBack){\n        if(null == context){\n            Log.e(TAG,\"in open edit data error.\");\n            return;\n        }\n        if (PermissionChecker.checkSelfPermission(context, Manifest.permission.CAMERA)\n                == PackageManager.PERMISSION_DENIED) {\n            ActivityCompat.requestPermissions(context, new String[] { Manifest.permission.CAMERA },1);\n            return;\n        }\n        RxBus.getInstance().unregisterMain(Constants.RX_JAVA_TYPE_CAMERA_SHOOT);\n        RxBus.getInstance().registerMain(Constants.RX_JAVA_TYPE_CAMERA_SHOOT, new Action1<MagicShowResultEntity>() {\n            @Override\n            public void call(MagicShowResultEntity magicShowResultEntity) {\n                cameraShootCallBack.onCompentFinished(magicShowResultEntity);\n                RxBus.getInstance().unregisterMain(Constants.RX_JAVA_TYPE_CAMERA_SHOOT);\n            }\n        });\n        Intent intent = new Intent(context, CameraActivity.class);\n        context.startActivity(intent);\n    }\n\n    /**\n     * 打开拍照，然后直接对拍照图片进行编辑\n     * @param context\n     * @param imageEditCallBack\n     */\n    public void openCameraAndEdit(final Activity context, final ImageEditCallBack imageEditCallBack){\n        openCamera(context, new CameraShootCallBack() {\n            @Override\n            public void onCompentFinished(MagicShowResultEntity magicShowResultEntity) {\n                openEdit(context,magicShowResultEntity.getFilePath(),imageEditCallBack);\n            }\n        });\n    }\n\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/activity/AlbumActivity.java",
    "content": "package com.zero.magicshow.activity;\n\nimport android.content.Context;\nimport android.os.Bundle;\nimport android.support.v4.app.Fragment;\nimport android.support.v4.app.FragmentTransaction;\nimport android.util.Log;\nimport android.view.View;\nimport android.view.animation.Animation;\nimport android.widget.ImageView;\nimport android.widget.LinearLayout;\nimport android.widget.TextView;\n\nimport com.zero.magicshow.R;\nimport com.zero.magicshow.common.base.BaseActivity;\nimport com.zero.magicshow.common.base.MagicBaseView;\nimport com.zero.magicshow.common.entity.MagicShowResultEntity;\nimport com.zero.magicshow.common.utils.BaseUtil;\nimport com.zero.magicshow.common.utils.Constants;\nimport com.zero.magicshow.common.utils.RxBus;\nimport com.zero.magicshow.common.utils.SavePictureTask;\nimport com.zero.magicshow.core.MagicEngine;\nimport com.zero.magicshow.core.widget.MagicImageView;\nimport com.zero.magicshow.view.edit.ImageEditFragment;\nimport com.zero.magicshow.view.edit.ImageEditManager;\nimport com.zero.magicshow.view.edit.iface.ImageEditNavListener;\nimport com.zero.zerolib.util.AnimationUtils;\nimport com.zero.zerolib.util.StringUtil;\n\nimport java.util.HashMap;\nimport java.util.Iterator;\nimport java.util.Map;\n\n/**\n * Created by zero on 2016/3/18.\n */\npublic class AlbumActivity extends BaseActivity{\n    private ImageView btnBack, btnNext,btnModifyClose,btnModifySave;\n    private TextView tvTitle;\n    private MagicImageView magicImageView;\n    private LinearLayout blockNavigation;\n    private View blockModifyController,blockTopBar;\n\n    private HashMap<String,Fragment> fragmentHashMap = new HashMap<>();\n    public static final String IMAGE_EDIT_TYPE_BEAUTY = \"beauty\";//美颜\n    public static final String IMAGE_EDIT_TYPE_ADJUST = \"adjust\";//编辑\n    public static final String IMAGE_EDIT_TYPE_FILTER = \"filter\";//滤镜\n    private Context context;\n    private MagicEngine magicEngine;\n    private String imageUrl;\n\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        context = this;\n        setContentView(R.layout.activity_image);\n        init();\n    }\n\n    private void init(){\n        initView();\n        initData();\n        initListener();\n    }\n\n    private void initView(){\n        btnBack                 = (ImageView)findViewById(R.id.image_edit_back);\n        btnNext                 = (ImageView)findViewById(R.id.image_edit_save);\n        tvTitle                 = (TextView)findViewById(R.id.image_edit_title);\n        magicImageView          = (MagicImageView)findViewById(R.id.image_edit_magicimageview);\n        blockNavigation         = (LinearLayout)findViewById(R.id.image_edit_navigation);\n        blockModifyController   = findViewById(R.id.image_edit_modify_controller_block);\n        blockTopBar             = findViewById(R.id.image_edit_topbar);\n        btnModifyClose          = (ImageView)findViewById(R.id.image_edit_modify_controller_close);\n        btnModifySave           = (ImageView)findViewById(R.id.image_edit_modify_controller_save);\n    }\n\n    private void initData(){\n        imageUrl = getIntent().getStringExtra(Constants.TRANSMIT_IMAGE_URL);\n//        MagicEngine.Builder builder = new MagicEngine.Builder();\n        magicEngine = new MagicEngine.Builder().build(magicImageView);\n        initFragments();\n        magicImageView.setGLScaleType(MagicBaseView.ScaleType.CENTER_INSIDE);\n        if(StringUtil.isEmpty(imageUrl)){\n            magicImageView.setImageBitmap(BaseUtil.getImageFromAssetsFile(context,\"dark.jpg\"));\n        }else{\n            magicImageView.setImageBitmap(BaseUtil.getBitmapBySimpleSize(imageUrl,BaseUtil.dipToPix(context,640),BaseUtil.dipToPix(context,640)));\n        }\n    }\n\n    private void initListener(){\n        btnBack.setOnClickListener(onClickListener);\n        btnNext.setOnClickListener(onClickListener);\n        btnModifyClose.setOnClickListener(onClickListener);\n        btnModifySave.setOnClickListener(onClickListener);\n    }\n\n    private void initFragments(){\n        ImageEditManager.initAdjustView(context,fragmentHashMap,blockNavigation,onHideListener,imageEditNavListener);\n        ImageEditManager.initBeautyView(context,fragmentHashMap,blockNavigation,onHideListener,imageEditNavListener);\n        ImageEditManager.initFilterView(context,fragmentHashMap,blockNavigation,onHideListener,imageEditNavListener);\n    }\n\n    @Override\n    protected void doFinishAction() {\n        Fragment showFragment = getShowFragment();\n        if(null != showFragment){\n            ((ImageEditFragment)showFragment).doFinishAction();\n            return;\n        }\n        super.doFinishAction();\n    }\n\n    private Fragment getShowFragment(){\n        Iterator<Map.Entry<String,Fragment>> iterator = fragmentHashMap.entrySet().iterator();\n        while (iterator.hasNext()){\n            Map.Entry<String,Fragment> item = iterator.next();\n            if(item.getValue().isVisible()){\n                return item.getValue();\n            }\n        }\n        return null;\n    }\n\n    private void doClickModifyCloseAction(){\n        Fragment showFragment = getShowFragment();\n        if(null != showFragment){\n            ((ImageEditFragment)showFragment).doFinishAction();\n        }\n    }\n\n    private void doClickModifySaveAction(){\n        Fragment showFragment = getShowFragment();\n        if(null != showFragment){\n            ((ImageEditFragment)showFragment).doSaveConfigeAction();\n        }\n    }\n\n    private void doBackAction(){\n        doFinishAction();\n    }\n\n    private void doNextAction(){\n        MagicEngine.getInstance().savePicture(BaseUtil.getRandomTempImageFile(), new SavePictureTask.OnPictureSaveListener() {\n            @Override\n            public void onSaved(MagicShowResultEntity resultEntity) {\n                RxBus.getInstance().post(resultEntity,Constants.RX_JAVA_TYPE_IMAGE_EDIT);\n                doFinishAction();\n            }\n        });\n    }\n\n    private View.OnClickListener onClickListener = new View.OnClickListener() {\n        @Override\n        public void onClick(View v) {\n            if(v == btnModifyClose){\n                doClickModifyCloseAction();\n            }else if(v == btnModifySave){\n                doClickModifySaveAction();\n            }else if(v == btnBack){\n                doBackAction();\n            }else if(v == btnNext){\n                doNextAction();\n            }\n        }\n    };\n\n    private ImageEditFragment.onHideListener onHideListener = new ImageEditFragment.onHideListener() {\n\n        @Override\n        public void onAfterHide() {\n            Log.e(\"HongLi\",\"in onAfterHide\");\n            Fragment showFragment = getShowFragment();\n            if(null != showFragment){\n                hiddenFragment(showFragment);\n            }\n        }\n    };\n\n    private ImageEditNavListener imageEditNavListener = new ImageEditNavListener() {\n        @Override\n        public void onClick(View view, String type) {\n            showFragment(fragmentHashMap.get(type));\n        }\n    };\n\n    private void showFragment(Fragment fragment){\n        FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();\n        fragmentTransaction.setCustomAnimations(R.anim.bottom_sliding_in,R.anim.bottom_sliding_out);\n        if(!fragment.isAdded()){\n            fragmentTransaction.add(R.id.image_edit_fragment_container, fragment).show(fragment).commit();\n        }else{\n            fragmentTransaction.show(fragment).commit();\n        }\n        blockModifyController.setVisibility(View.VISIBLE);\n        AnimationUtils.doSlidingInFromBottom(blockModifyController,blockModifyController.getHeight(),false);\n        com.zero.magicshow.common.utils.BaseUtil.fadeOutView(blockTopBar);\n    }\n\n    private void hiddenFragment(Fragment fragment){\n        FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();\n        fragmentTransaction.setCustomAnimations(R.anim.bottom_sliding_in,R.anim.bottom_sliding_out);\n        fragmentTransaction.hide(fragment).commit();\n        AnimationUtils.doSlidingOutFromBottom(blockModifyController, blockModifyController.getHeight(), false, new Animation.AnimationListener() {\n            @Override\n            public void onAnimationStart(Animation animation) {}\n            @Override\n            public void onAnimationEnd(Animation animation) {\n                blockModifyController.setVisibility(View.GONE);\n            }\n            @Override\n            public void onAnimationRepeat(Animation animation) {}\n        });\n        com.zero.magicshow.common.utils.BaseUtil.fadeInView(blockTopBar);\n    }\n\n    @Override\n    protected void onDestroy() {\n        super.onDestroy();\n        RxBus.getInstance().unregisterMain(Constants.RX_JAVA_TYPE_IMAGE_EDIT);\n    }\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/activity/CameraActivity.java",
    "content": "package com.zero.magicshow.activity;\n\nimport android.Manifest;\nimport android.animation.ObjectAnimator;\nimport android.app.AlertDialog;\nimport android.content.DialogInterface;\nimport android.content.pm.PackageManager;\nimport android.os.Bundle;\nimport android.support.v4.app.ActivityCompat;\nimport android.support.v4.content.PermissionChecker;\nimport android.support.v7.widget.LinearLayoutManager;\nimport android.support.v7.widget.RecyclerView;\nimport android.view.View;\nimport android.view.animation.Animation;\nimport android.widget.ImageView;\nimport android.widget.LinearLayout;\n\nimport com.zero.magicshow.R;\nimport com.zero.magicshow.adapter.FilterAdapter;\nimport com.zero.magicshow.common.base.BaseActivity;\nimport com.zero.magicshow.common.entity.MagicShowResultEntity;\nimport com.zero.magicshow.common.utils.BaseUtil;\nimport com.zero.magicshow.common.utils.Constants;\nimport com.zero.magicshow.common.utils.GravityUtil;\nimport com.zero.magicshow.common.utils.MagicParams;\nimport com.zero.magicshow.common.utils.RxBus;\nimport com.zero.magicshow.common.utils.SavePictureTask;\nimport com.zero.magicshow.core.MagicEngine;\nimport com.zero.magicshow.core.camera.CameraEngine;\nimport com.zero.magicshow.core.filter.utils.MagicFilterType;\nimport com.zero.magicshow.core.widget.MagicCameraView;\nimport com.zero.magicshow.viewmanager.CameraManager;\nimport com.zero.zerolib.util.AnimationUtils;\n\n/**\n * Created by zero on 2016/3/17.\n */\npublic class CameraActivity extends BaseActivity{\n    private LinearLayout filterLayout;\n    private RecyclerView filterListView;\n    private MagicCameraView magicCameraView;\n\n    private FilterAdapter filterAdapter;\n    private MagicEngine magicEngine;\n    private boolean isRecording = false;\n    private final int MODE_PIC = 1;\n    private final int MODE_VIDEO = 2;\n    private int mode = MODE_PIC;\n\n    private ImageView btnShutter,btnMode,btnFilter,btnFilterClose,btnCameraSwitch;//,btnBeauty;\n\n    private ObjectAnimator animator;\n\n    private final static int PERMISSION_REQUEST_WRITE = 1001;\n\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.activity_camera);\n        init();\n    }\n\n    private void init(){\n        initView();\n        initData();\n        initListener();\n    }\n\n    private void initView(){\n        filterLayout = (LinearLayout)findViewById(R.id.layout_filter);\n        filterListView          = (RecyclerView) findViewById(R.id.filter_listView);\n\n        btnShutter              = (ImageView)findViewById(R.id.camera_shutter);\n        btnMode                 = (ImageView)findViewById(R.id.camera_mode);\n        btnFilter               = (ImageView)findViewById(R.id.camera_filter);\n        btnFilterClose          = (ImageView)findViewById(R.id.camera_closefilter);\n        btnCameraSwitch         = (ImageView)findViewById(R.id.camera_switch);\n//        btnBeauty               = (ImageView)findViewById(R.id.camera_beauty);\n        magicCameraView         = (MagicCameraView)findViewById(R.id.camera_camera_view);\n    }\n\n    private void initData(){\n        magicEngine = new MagicEngine.Builder().build(magicCameraView);\n        initFilterView();\n        animator = CameraManager.getShutterAnim(btnShutter);\n    }\n\n    private void initListener(){\n        btnFilter.setOnClickListener(btn_listener);\n        btnFilterClose.setOnClickListener(btn_listener);\n        btnShutter.setOnClickListener(btn_listener);\n        btnCameraSwitch.setOnClickListener(btn_listener);\n        btnMode.setOnClickListener(btn_listener);\n//        btnBeauty.setOnClickListener(btn_listener);\n    }\n\n    private void initFilterView(){\n        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);\n        linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);\n        filterListView.setLayoutManager(linearLayoutManager);\n\n        filterAdapter = new FilterAdapter(this, Constants.FILTER_TYPES);\n        filterListView.setAdapter(filterAdapter);\n        filterAdapter.setOnFilterChangeListener(onFilterChangeListener);\n    }\n\n    private FilterAdapter.onFilterChangeListener onFilterChangeListener = new FilterAdapter.onFilterChangeListener(){\n        @Override\n        public void onFilterChanged(MagicFilterType filterType) {\n            magicEngine.setFilter(filterType);\n        }\n    };\n\n//    @Override\n//    public void onRequestPermissionsResult(int requestCode, String[] permissions,int[] grantResults) {\n//        if (grantResults.length != 1 || grantResults[0] == PackageManager.PERMISSION_GRANTED) {\n//            if(mode == MODE_PIC){\n//                takePhoto();\n//            }else{\n//                takeVideo();\n//            }\n//        } else {\n//            super.onRequestPermissionsResult(requestCode, permissions, grantResults);\n//        }\n//    }\n\n    private void doClickShutterAction(View view){\n        if (PermissionChecker.checkSelfPermission(CameraActivity.this, Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_DENIED) {\n            ActivityCompat.requestPermissions(CameraActivity.this,\n                    new String[] { Manifest.permission.WRITE_EXTERNAL_STORAGE },\n                    PERMISSION_REQUEST_WRITE);\n        } else {\n            if(mode == MODE_PIC){\n                takePhoto();\n            }else{\n                takeVideo();\n            }\n        }\n    }\n\n    private void doClickBeautyAction(){\n        new AlertDialog.Builder(CameraActivity.this)\n                .setSingleChoiceItems(new String[] { \"关闭\", \"1\", \"2\", \"3\", \"4\", \"5\"}, MagicParams.beautyLevel,\n                        new DialogInterface.OnClickListener() {\n                            public void onClick(DialogInterface dialog, int which) {\n                                magicEngine.setBeautyLevel(which);\n                                dialog.dismiss();\n                            }\n                        })\n                .setNegativeButton(\"取消\", null)\n                .show();\n    }\n\n    private View.OnClickListener btn_listener = new View.OnClickListener() {\n        @Override\n        public void onClick(View v) {\n            if(v == btnMode){\n                switchMode();\n            }else if(v == btnShutter){\n                doClickShutterAction(v);\n            }else if(v == btnFilter){\n                showFilters();\n            }else if(v == btnCameraSwitch){\n                magicEngine.switchCamera();\n            }\n//            else if(v == btnBeauty){\n//                doClickBeautyAction();\n//            }\n            else if(v == btnFilterClose){\n                hideFilters();\n            }\n        }\n    };\n\n    private void switchMode(){\n        if(mode == MODE_PIC){\n            mode = MODE_VIDEO;\n            btnMode.setImageResource(R.drawable.icon_camera);\n        }else{\n            mode = MODE_PIC;\n            btnMode.setImageResource(R.drawable.icon_video);\n        }\n    }\n\n    private void takePhoto(){\n//        final long startTime = System.nanoTime() / 1000000;\n        magicEngine.savePicture(BaseUtil.getRandomTempImageFile(), new SavePictureTask.OnPictureSaveListener() {\n            @Override\n            public void onSaved(MagicShowResultEntity resultEntity) {\n//                Log.e(\"HongLi\",\"保存成功:\" + (System.nanoTime() / 1000000 - startTime));\n                RxBus.getInstance().post(resultEntity,Constants.RX_JAVA_TYPE_CAMERA_SHOOT);\n                doFinishAction();\n            }\n        });\n    }\n\n    private void takeVideo(){\n        if(isRecording) {\n            animator.end();\n            magicEngine.stopRecord();\n        }else {\n            animator.start();\n            magicEngine.startRecord();\n        }\n        isRecording = !isRecording;\n    }\n\n    @Override\n    protected void doFinishAction() {\n        if(filterLayout.getVisibility() == View.VISIBLE){\n            hideFilters();\n            return;\n        }\n        super.doFinishAction();\n    }\n\n    private void showFilters(){\n        btnShutter.setClickable(false);\n        filterLayout.setVisibility(View.VISIBLE);\n        AnimationUtils.doSlidingInFromBottom(filterLayout, filterLayout.getHeight(),false);\n    }\n\n    private void hideFilters(){\n        AnimationUtils.doSlidingOutFromBottom(filterLayout, filterLayout.getHeight(), false, new Animation.AnimationListener() {\n            @Override\n            public void onAnimationStart(Animation animation) {}\n            @Override\n            public void onAnimationEnd(Animation animation) {\n                filterLayout.setVisibility(View.INVISIBLE);\n                btnShutter.setClickable(true);\n            }\n            @Override\n            public void onAnimationRepeat(Animation animation) {}\n        });\n    }\n\n    @Override\n    protected void onDestroy() {\n        super.onDestroy();\n        CameraEngine.releaseCamera(true);\n        GravityUtil.getInstance().stop();\n        RxBus.getInstance().unregisterMain(Constants.RX_JAVA_TYPE_CAMERA_SHOOT);\n    }\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/adapter/FilterAdapter.java",
    "content": "package com.zero.magicshow.adapter;\n\nimport android.content.Context;\nimport android.support.v7.widget.RecyclerView;\nimport android.view.LayoutInflater;\nimport android.view.View;\nimport android.view.ViewGroup;\nimport android.widget.FrameLayout;\nimport android.widget.ImageView;\nimport android.widget.TextView;\n\nimport com.zero.magicshow.R;\nimport com.zero.magicshow.common.utils.FilterTypeHelper;\nimport com.zero.magicshow.core.filter.utils.MagicFilterType;\n\n/**\n * Created by why8222 on 2016/3/17.\n */\npublic class FilterAdapter extends RecyclerView.Adapter<FilterAdapter.FilterHolder>{\n    \n    private MagicFilterType[] filters;\n    private Context context;\n    private int selected = 0;\n\n    public FilterAdapter(Context context, MagicFilterType[] filters) {\n        this.filters = filters;\n        this.context = context;\n    }\n\n    @Override\n    public FilterHolder onCreateViewHolder(ViewGroup parent, int viewType) {\n        View view = LayoutInflater.from(context).inflate(R.layout.filter_item_layout,\n                parent, false);\n        FilterHolder viewHolder = new FilterHolder(view);\n        viewHolder.thumbImage = (ImageView) view\n                .findViewById(R.id.filter_thumb_image);\n        viewHolder.filterName = (TextView) view\n                .findViewById(R.id.filter_thumb_name);\n        viewHolder.filterRoot = (FrameLayout)view\n                .findViewById(R.id.filter_root);\n        viewHolder.thumbSelected = (FrameLayout) view\n                .findViewById(R.id.filter_thumb_selected);\n        viewHolder.thumbSelected_bg = view.\n                findViewById(R.id.filter_thumb_selected_bg);\n        return viewHolder;\n    }\n\n    @Override\n    public void onBindViewHolder(FilterHolder holder,final int position) {\n        holder.thumbImage.setImageResource(FilterTypeHelper.FilterType2Thumb(filters[position]));\n        holder.filterName.setText(FilterTypeHelper.FilterType2Name(filters[position]));\n        holder.filterName.setBackgroundColor(context.getResources().getColor(\n                FilterTypeHelper.FilterType2Color(filters[position])));\n        if(position == selected){\n            holder.thumbSelected.setVisibility(View.VISIBLE);\n            holder.thumbSelected_bg.setBackgroundColor(context.getResources().getColor(\n                    FilterTypeHelper.FilterType2Color(filters[position])));\n            holder.thumbSelected_bg.setAlpha(0.7f);\n        }else {\n            holder.thumbSelected.setVisibility(View.GONE);\n        }\n\n        holder.filterRoot.setOnClickListener(new View.OnClickListener() {\n\n            @Override\n            public void onClick(View v) {\n                if(selected == position)\n                    return;\n                int lastSelected = selected;\n                selected = position;\n                notifyItemChanged(lastSelected);\n                notifyItemChanged(position);\n                onFilterChangeListener.onFilterChanged(filters[position]);\n            }\n        });\n    }\n\n    public void refreshList(){\n        selected = 0;\n        notifyDataSetChanged();\n    }\n\n    @Override\n    public int getItemCount() {\n        return filters == null ? 0 : filters.length;\n    }\n\n    class FilterHolder extends RecyclerView.ViewHolder {\n        ImageView thumbImage;\n        TextView filterName;\n        FrameLayout thumbSelected;\n        FrameLayout filterRoot;\n        View thumbSelected_bg;\n\n        public FilterHolder(View itemView) {\n            super(itemView);\n        }\n    }\n\n    public interface onFilterChangeListener{\n        void onFilterChanged(MagicFilterType filterType);\n    }\n\n    private onFilterChangeListener onFilterChangeListener;\n\n    public void setOnFilterChangeListener(onFilterChangeListener onFilterChangeListener){\n        this.onFilterChangeListener = onFilterChangeListener;\n    }\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/common/base/BaseActivity.java",
    "content": "package com.zero.magicshow.common.base;\n\nimport android.support.v4.app.FragmentActivity;\nimport android.view.KeyEvent;\n\n/**\n * Created by hongli on 2017/8/22.\n */\n\npublic abstract class BaseActivity extends FragmentActivity{\n    protected void doFinishAction(){\n        finish();\n    }\n    @Override\n    public boolean onKeyDown(int keyCode, KeyEvent event) {\n        if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0) {\n            doFinishAction();\n            return true;\n        }\n        return super.onKeyDown(keyCode, event);\n    }\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/common/base/MagicBaseView.java",
    "content": "package com.zero.magicshow.common.base;\n\nimport android.content.Context;\nimport android.graphics.Bitmap;\nimport android.opengl.GLES20;\nimport android.opengl.GLSurfaceView;\nimport android.util.AttributeSet;\nimport android.util.Log;\n\nimport com.zero.magicshow.common.iface.MagicListener;\nimport com.zero.magicshow.common.utils.OpenGlUtils;\nimport com.zero.magicshow.common.utils.Rotation;\nimport com.zero.magicshow.common.utils.SavePictureTask;\nimport com.zero.magicshow.common.utils.TextureRotationUtil;\nimport com.zero.magicshow.core.filter.base.gpuimage.GPUImageFilter;\nimport com.zero.magicshow.core.filter.utils.MagicFilterFactory;\nimport com.zero.magicshow.core.filter.utils.MagicFilterType;\n\nimport java.nio.ByteBuffer;\nimport java.nio.ByteOrder;\nimport java.nio.FloatBuffer;\nimport java.nio.IntBuffer;\n\nimport javax.microedition.khronos.egl.EGLConfig;\nimport javax.microedition.khronos.opengles.GL10;\n\n/**\n * Created by why8222 on 2016/2/25.\n */\npublic abstract class MagicBaseView extends GLSurfaceView implements GLSurfaceView.Renderer{\n    /**\n     * 所选择的滤镜，类型为MagicBaseGroupFilter\n     * 1.mCameraInputFilter将SurfaceTexture中YUV数据绘制到FrameBuffer\n     * 2.filter将FrameBuffer中的纹理绘制到屏幕中\n     */\n    protected GPUImageFilter filter;\n\n    /**\n     * SurfaceTexure纹理id\n     */\n    protected int textureId = OpenGlUtils.NO_TEXTURE;\n\n    /**\n     * 顶点坐标\n     */\n    protected final FloatBuffer gLCubeBuffer;\n\n    /**\n     * 纹理坐标\n     */\n    protected final FloatBuffer gLTextureBuffer;\n\n    /**\n     * GLSurfaceView的宽高\n     */\n    protected int surfaceWidth, surfaceHeight;\n\n    /**\n     * 图像宽高\n     */\n    protected int imageWidth, imageHeight;\n\n    protected ScaleType scaleType = ScaleType.FIT_XY;\n\n    protected MagicListener magicListener;\n\n    public MagicBaseView(Context context) {\n        this(context, null);\n    }\n\n    public MagicBaseView(Context context, AttributeSet attrs) {\n        super(context, attrs);\n        gLCubeBuffer = ByteBuffer.allocateDirect(TextureRotationUtil.CUBE.length * 4)\n                .order(ByteOrder.nativeOrder())\n                .asFloatBuffer();\n        gLCubeBuffer.put(TextureRotationUtil.CUBE).position(0);\n\n        gLTextureBuffer = ByteBuffer.allocateDirect(TextureRotationUtil.TEXTURE_NO_ROTATION.length * 4)\n                .order(ByteOrder.nativeOrder())\n                .asFloatBuffer();\n        gLTextureBuffer.put(TextureRotationUtil.TEXTURE_NO_ROTATION).position(0);\n\n        setEGLContextClientVersion(2);\n        setRenderer(this);\n        setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);\n    }\n\n    @Override\n    public void onSurfaceCreated(GL10 gl, EGLConfig config) {\n        GLES20.glDisable(GL10.GL_DITHER);\n        GLES20.glClearColor(0,0, 0, 0);\n        GLES20.glEnable(GL10.GL_CULL_FACE);\n        GLES20.glEnable(GL10.GL_DEPTH_TEST);\n    }\n\n    @Override\n    public void onSurfaceChanged(GL10 gl, int width, int height) {\n        GLES20.glViewport(0,0,width, height);\n        surfaceWidth = width;\n        surfaceHeight = height;\n        Log.e(\"HongLi\",\"surfaceWidth:\" + surfaceWidth + \";surfaceHeight:\" + surfaceHeight);\n        onFilterChanged();\n    }\n\n    @Override\n    public void onDrawFrame(GL10 gl) {\n        GLES20.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);\n        GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_DEPTH_BUFFER_BIT);\n    }\n\n    protected void setMagicListener(MagicListener magicListener){\n        this.magicListener = magicListener;\n    }\n\n    protected void onFilterChanged(){\n        if(filter != null) {\n            filter.onDisplaySizeChanged(surfaceWidth, surfaceHeight);\n            filter.onInputSizeChanged(imageWidth, imageHeight);\n        }\n    }\n\n    public void setGLScaleType(ScaleType scaleType){\n        this.scaleType = scaleType;\n    }\n\n    public void setFilter(final MagicFilterType type){\n        queueEvent(new Runnable() {\n            @Override\n            public void run() {\n                if (filter != null)\n                    filter.destroy();\n                filter = null;\n                filter = MagicFilterFactory.initFilters(type);\n                if (filter != null)\n                    filter.init();\n                onFilterChanged();\n            }\n        });\n        requestRender();\n    }\n\n    public MagicFilterType getFilterType(){\n        if(null == filter){\n            return MagicFilterType.NONE;\n        }\n        return MagicFilterFactory.getCurrentFilterType();\n    }\n\n    public void reftreshDisplay(){\n        deleteTextures();\n        requestRender();\n    }\n\n    protected void deleteTextures() {\n        if(textureId != OpenGlUtils.NO_TEXTURE){\n            queueEvent(new Runnable() {\n                @Override\n                public void run() {\n                    GLES20.glDeleteTextures(1, new int[]{\n                            textureId\n                    }, 0);\n                    textureId = OpenGlUtils.NO_TEXTURE;\n                }\n            });\n        }\n    }\n\n    public abstract void savePicture(SavePictureTask savePictureTask);\n\n    protected void adjustSize(int rotation, boolean flipHorizontal, boolean flipVertical){\n        float[] textureCords = TextureRotationUtil.getRotation(Rotation.fromInt(rotation),\n                flipHorizontal, flipVertical);\n        float[] cube = TextureRotationUtil.CUBE;\n        float ratio1 = (float)surfaceWidth / imageWidth;\n        float ratio2 = (float)surfaceHeight / imageHeight;\n        float ratioMax = Math.max(ratio1, ratio2);\n        int imageWidthNew = Math.round(imageWidth * ratioMax);\n        int imageHeightNew = Math.round(imageHeight * ratioMax);\n\n        float ratioWidth = imageWidthNew / (float)surfaceWidth;\n        float ratioHeight = imageHeightNew / (float)surfaceHeight;\n\n        if(scaleType == ScaleType.CENTER_INSIDE){\n            cube = new float[]{\n                    TextureRotationUtil.CUBE[0] / ratioHeight, TextureRotationUtil.CUBE[1] / ratioWidth,\n                    TextureRotationUtil.CUBE[2] / ratioHeight, TextureRotationUtil.CUBE[3] / ratioWidth,\n                    TextureRotationUtil.CUBE[4] / ratioHeight, TextureRotationUtil.CUBE[5] / ratioWidth,\n                    TextureRotationUtil.CUBE[6] / ratioHeight, TextureRotationUtil.CUBE[7] / ratioWidth,\n            };\n        }else if(scaleType == ScaleType.FIT_XY){\n\n        }else if(scaleType == ScaleType.CENTER_CROP){\n            float distHorizontal = (1 - 1 / ratioWidth) / 2;\n            float distVertical = (1 - 1 / ratioHeight) / 2;\n            textureCords = new float[]{\n                    addDistance(textureCords[0], distVertical), addDistance(textureCords[1], distHorizontal),\n                    addDistance(textureCords[2], distVertical), addDistance(textureCords[3], distHorizontal),\n                    addDistance(textureCords[4], distVertical), addDistance(textureCords[5], distHorizontal),\n                    addDistance(textureCords[6], distVertical), addDistance(textureCords[7], distHorizontal),\n            };\n        }\n        gLCubeBuffer.clear();\n        gLCubeBuffer.put(cube).position(0);\n        gLTextureBuffer.clear();\n        gLTextureBuffer.put(textureCords).position(0);\n    }\n\n    protected void getBitmapFromGL(final Bitmap bitmap, final boolean newTexture){\n        queueEvent(new Runnable() {\n            @Override\n            public void run() {\n                int width = bitmap.getWidth();\n                int height = bitmap.getHeight();\n                int[] mFrameBuffers = new int[1];\n                int[] mFrameBufferTextures = new int[1];\n                GLES20.glGenFramebuffers(1, mFrameBuffers, 0);\n                GLES20.glGenTextures(1, mFrameBufferTextures, 0);\n                GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mFrameBufferTextures[0]);\n                GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, width, height, 0,\n                        GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, null);\n                GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n                        GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);\n                GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n                        GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);\n                GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n                        GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);\n                GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n                        GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);\n                GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, mFrameBuffers[0]);\n                GLES20.glFramebufferTexture2D(GLES20.GL_FRAMEBUFFER, GLES20.GL_COLOR_ATTACHMENT0,\n                        GLES20.GL_TEXTURE_2D, mFrameBufferTextures[0], 0);\n                GLES20.glViewport(0, 0, width, height);\n                filter.onInputSizeChanged(width, height);\n//                filter.onOutputSizeChanged(width,height);\n                filter.onDisplaySizeChanged(imageWidth, imageHeight);\n//                filter.onDisplaySizeChanged(surfaceWidth, surfaceHeight);\n                int textureId;\n                if(newTexture){\n                    textureId = OpenGlUtils.loadTexture(bitmap, OpenGlUtils.NO_TEXTURE, true);\n                }else{\n                    textureId = MagicBaseView.this.textureId;\n                }\n                GLES20.glViewport(0, 0, width, height);\n                long startTime = System.nanoTime() / 1000000;\n                filter.onDrawFrame(textureId);\n//                filter.onDrawFrameNormal(textureId,width, height);\n                IntBuffer ib = IntBuffer.allocate(width * height);\n                GLES20.glReadPixels(0, 0, width, height, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, ib);\n                Bitmap mBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);\n                mBitmap.copyPixelsFromBuffer(IntBuffer.wrap(ib.array()));\n                Log.e(\"HongLi\",\"消耗的时间:\" + (System.nanoTime() / 1000000 - startTime));\n//                BaseUtil.saveBitmap(mBitmap,\"/sdcard/DCIM/test2.jpg\");\n                if(newTexture)\n                    GLES20.glDeleteTextures(1, new int[]{textureId}, 0);\n                GLES20.glDeleteFramebuffers(1, mFrameBuffers, 0);\n                GLES20.glDeleteTextures(1, mFrameBufferTextures, 0);\n                GLES20.glViewport(0, 0, surfaceWidth, surfaceHeight);\n\n                filter.destroy();\n                filter.init();\n                filter.onInputSizeChanged(imageWidth, imageHeight);\n                onGetBitmapFromGL(mBitmap);\n            }\n        });\n    }\n    protected void onGetBitmapFromGL(Bitmap bitmap){\n\n    }\n    private float addDistance(float coordinate, float distance) {\n        return coordinate == 0.0f ? distance : 1 - distance;\n    }\n\n    public enum  ScaleType{\n        CENTER_INSIDE,\n        CENTER_CROP,\n        FIT_XY;\n    }\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/common/config/CameraConfig.java",
    "content": "package com.zero.magicshow.common.config;\n\n/**\n * Created by hongli on 2017/9/1.\n */\n\npublic class CameraConfig {\n\n    public static int orientation;\n\n    public static int pictureWidth = 1280;\n\n    public static int pictureHeight = 720;\n\n    public static void setCameraConfig(int pictureWidth,int pictureHeight){\n        CameraConfig.pictureWidth = pictureWidth;\n        CameraConfig.pictureHeight = pictureHeight;\n    }\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/common/config/PathConfig.java",
    "content": "package com.zero.magicshow.common.config;\n\nimport android.os.Environment;\n\n/**\n * Created by hongli on 2017/8/30.\n */\n\npublic class PathConfig {\n    private static String SD_DIRECTORY = \"/Android/data/com.zero.lib/cache\";\n    private static String tempCache = Environment.getExternalStorageDirectory().getAbsolutePath() + SD_DIRECTORY;\n    public static void setTempCache(String path){\n        tempCache = path;\n    }\n\n    public static String getTempPath(){\n        return tempCache;\n    }\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/common/entity/MagicShowResultEntity.java",
    "content": "package com.zero.magicshow.common.entity;\n\n/**\n * Created by hongli on 2017/8/31.\n */\n\npublic class MagicShowResultEntity {\n    private int resultCode;\n    private String resultMsg;\n    private String filePath;\n    private int imageWidth;\n    private int imageHeight;\n    private int angle;\n\n    public int getAngle() {\n        return angle;\n    }\n\n    public void setAngle(int angle) {\n        this.angle = angle;\n    }\n\n    public int getResultCode() {\n        return resultCode;\n    }\n\n    public void setResultCode(int resultCode) {\n        this.resultCode = resultCode;\n    }\n\n    public String getResultMsg() {\n        return resultMsg;\n    }\n\n    public void setResultMsg(String resultMsg) {\n        this.resultMsg = resultMsg;\n    }\n\n    public String getFilePath() {\n        return filePath;\n    }\n\n    public void setFilePath(String filePath) {\n        this.filePath = filePath;\n    }\n\n    public int getImageWidth() {\n        return imageWidth;\n    }\n\n    public void setImageWidth(int imageWidth) {\n        this.imageWidth = imageWidth;\n    }\n\n    public int getImageHeight() {\n        return imageHeight;\n    }\n\n    public void setImageHeight(int imageHeight) {\n        this.imageHeight = imageHeight;\n    }\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/common/iface/CameraShootCallBack.java",
    "content": "package com.zero.magicshow.common.iface;\n\nimport com.zero.magicshow.common.entity.MagicShowResultEntity;\n\n/**\n * Created by hongli on 2017/9/1.\n */\n\npublic interface CameraShootCallBack {\n    public abstract void onCompentFinished(MagicShowResultEntity magicShowResultEntity);\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/common/iface/DialogYesOrNoCallBack.java",
    "content": "package com.zero.magicshow.common.iface;\n\n/**\n * Created by hongli on 2017/8/30.\n */\n\npublic interface DialogYesOrNoCallBack {\n    public void onYesClick();\n    public void onNoClick();\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/common/iface/GravityCallBack.java",
    "content": "package com.zero.magicshow.common.iface;\n\n/**\n * Created by hongli on 2017/9/1.\n */\n\npublic interface GravityCallBack {\n    public void onGravityChange(int direction);\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/common/iface/ImageEditCallBack.java",
    "content": "package com.zero.magicshow.common.iface;\n\nimport com.zero.magicshow.common.entity.MagicShowResultEntity;\n\n/**\n * Created by hongli on 2017/8/31.\n */\n\npublic interface ImageEditCallBack {\n    public abstract void onCompentFinished(MagicShowResultEntity magicShowResultEntity);\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/common/iface/MagicListener.java",
    "content": "package com.zero.magicshow.common.iface;\n\n/**\n * Created by hongli on 2017/8/23.\n */\n\npublic interface MagicListener {\n    public void onEnd();\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/common/utils/BaseUtil.java",
    "content": "package com.zero.magicshow.common.utils;\n\nimport android.app.Activity;\nimport android.app.Dialog;\nimport android.content.Context;\nimport android.content.DialogInterface;\nimport android.content.res.AssetManager;\nimport android.graphics.Bitmap;\nimport android.graphics.BitmapFactory;\nimport android.graphics.Matrix;\nimport android.media.ExifInterface;\nimport android.text.TextUtils;\nimport android.util.DisplayMetrics;\nimport android.util.Log;\nimport android.view.LayoutInflater;\nimport android.view.View;\nimport android.view.ViewGroup;\nimport android.view.animation.Animation;\nimport android.widget.ImageView;\nimport android.widget.TextView;\n\nimport com.zero.magicshow.R;\nimport com.zero.magicshow.common.config.PathConfig;\nimport com.zero.magicshow.common.iface.DialogYesOrNoCallBack;\nimport com.zero.zerolib.util.AnimationUtils;\n\nimport java.io.File;\nimport java.io.FileNotFoundException;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\n\n/**\n * Created by hongli on 2017/8/30.\n */\n\npublic class BaseUtil extends com.zero.zerolib.util.BaseUtil {\n    //    public static void scanFile(String filePath){\n//        MediaScannerConnection.scanFile(MagicParams.context,\n//                new String[] {filePath}, null,\n//                new MediaScannerConnection.OnScanCompletedListener() {\n//                    @Override\n//                    public void onScanCompleted(final String path, final Uri uri) {\n//\n//                    }\n//                });\n//    }\n    public static Bitmap rotateBitmapByDegree(Bitmap bm, int degree) {\n        Bitmap returnBm = null;\n\n        // 根据旋转角度，生成旋转矩阵\n        Matrix matrix = new Matrix();\n        matrix.postRotate(degree);\n        try {\n            // 将原始图片按照旋转矩阵进行旋转，并得到新的图片\n            returnBm = Bitmap.createBitmap(bm, 0, 0, bm.getWidth(), bm.getHeight(), matrix, true);\n        } catch (OutOfMemoryError e) {\n        }\n        if (returnBm == null) {\n            returnBm = bm;\n        }\n        if (bm != returnBm) {\n            bm.recycle();\n        }\n        return returnBm;\n    }\n\n    public static boolean isPortrait(Activity activity) {\n        DisplayMetrics dm = new DisplayMetrics();\n        activity.getWindowManager().getDefaultDisplay().getMetrics(dm);\n        return dm.widthPixels < dm.heightPixels;\n    }\n\n    /**\n     * 读取照片exif信息中的旋转角度\n     *\n     * @param path 照片路径\n     * @return角度\n     */\n    public static int readPictureDegree(String path) {\n        int degree = 0;\n        try {\n            ExifInterface exifInterface = new ExifInterface(path);\n            int orientation =\n                    exifInterface.getAttributeInt(ExifInterface.TAG_ORIENTATION,\n                            ExifInterface.ORIENTATION_NORMAL);\n            switch (orientation) {\n                case ExifInterface.ORIENTATION_ROTATE_90:\n                    degree = 90;\n                    break;\n                case ExifInterface.ORIENTATION_ROTATE_180:\n                    degree = 180;\n                    break;\n                case ExifInterface.ORIENTATION_ROTATE_270:\n                    degree = 270;\n                    break;\n            }\n        } catch (IOException e) {\n            e.printStackTrace();\n        }\n        return degree;\n    }\n\n    public static void fadeOutView(final View view) {\n        if (view.getVisibility() != View.VISIBLE) {\n            return;\n        }\n        AnimationUtils.doFadeOut(view, new Animation.AnimationListener() {\n            @Override\n            public void onAnimationStart(Animation animation) {\n            }\n\n            @Override\n            public void onAnimationEnd(Animation animation) {\n                view.setVisibility(View.GONE);\n            }\n\n            @Override\n            public void onAnimationRepeat(Animation animation) {\n            }\n        });\n    }\n\n    public static void fadeInView(View view) {\n        if (view.getVisibility() == View.VISIBLE) {\n            return;\n        }\n        view.setVisibility(View.VISIBLE);\n        AnimationUtils.doFadeIn(view);\n    }\n\n    public static void openYesOrNoDialog(final Activity activity, String title, String content, String yesText, String noText, final DialogYesOrNoCallBack yesOrNoCallBack) {\n        final Dialog shopTipDialog = new Dialog(activity, R.style.loading_dialog);\n        View view = LayoutInflater.from(activity).inflate(R.layout.dialog_yes_or_no, null);\n        final ImageView btnClose = (ImageView) view.findViewById(R.id.gift_balance_lack_close);\n        final TextView btnYes = (TextView) view.findViewById(R.id.dialog_yes_or_no_btnyes);\n        final TextView tvTitle = (TextView) view.findViewById(R.id.dialog_yes_or_no_title);\n        final TextView tvCon = (TextView) view.findViewById(R.id.dialog_yes_or_no_con);\n        final TextView btnNo = (TextView) view.findViewById(R.id.dialog_yes_or_no_btnno);\n        tvTitle.setText(title);\n        if (TextUtils.isEmpty(title)) {\n            tvTitle.setVisibility(View.GONE);\n        }\n        tvCon.setText(content);\n        if (TextUtils.isEmpty(content)) {\n            tvCon.setVisibility(View.GONE);\n        }\n        if (!TextUtils.isEmpty(yesText)) {\n            btnYes.setText(yesText);\n        }\n        if (!TextUtils.isEmpty(noText)) {\n            btnNo.setText(noText);\n        }\n        View.OnClickListener onClickListener = new View.OnClickListener() {\n            @Override\n            public void onClick(View v) {\n                if (v == btnClose) {\n                    shopTipDialog.dismiss();\n                } else if (v == btnYes) {\n                    yesOrNoCallBack.onYesClick();\n                    shopTipDialog.dismiss();\n                } else if (v == btnNo) {\n                    yesOrNoCallBack.onNoClick();\n                    shopTipDialog.dismiss();\n                }\n            }\n        };\n        shopTipDialog.setOnCancelListener(new DialogInterface.OnCancelListener() {\n            @Override\n            public void onCancel(DialogInterface dialog) {\n                yesOrNoCallBack.onNoClick();\n            }\n        });\n        btnClose.setOnClickListener(onClickListener);\n        btnYes.setOnClickListener(onClickListener);\n        btnNo.setOnClickListener(onClickListener);\n//\t\tshopTipDialog.setCanceledOnTouchOutside(true);\n        shopTipDialog.setContentView(view, new ViewGroup.LayoutParams(dipToPix(activity, 267), dipToPix(activity, 100)));\n        //try catch防止activity已经销毁\n        try {\n            shopTipDialog.show();\n        } catch (Exception e) {\n            e.printStackTrace();\n        }\n    }\n\n    public static File getRandomTempImageFile() {\n        return new File(getRandomTempImagePath());\n    }\n\n    public static String getRandomTempImagePath() {\n        return PathConfig.getTempPath() + \"/\" + getRandomStr() + \".jpg\";\n    }\n\n    public static String getRandomStr() {\n        int randInt = (int) (Math.random() * 100000);\n        if (randInt < 10000) {\n            randInt = randInt + 10000;\n        }\n        return DateUtils.getTimeStamp() + randInt;\n    }\n\n    /**\n     * 保存bitmap到本地\n     *\n     * @param bitmap\n     * @param distancePath\n     */\n    public static void saveBitmap(Bitmap bitmap, String distancePath) {\n        if (TextUtils.isEmpty(distancePath) || null == bitmap || bitmap.isRecycled()) {\n            Log.e(\"BaseUtil\", \"in saveBitmap bitmap is null or recycles or distancePath is empty.\");\n            return;\n        }\n        File file = new File(distancePath);\n        if (file.exists()) {\n            file.delete();\n        }\n        try {\n            FileOutputStream out = new FileOutputStream(file);\n            //压缩20%，否则保存的文件会变大\n            bitmap.compress(Bitmap.CompressFormat.JPEG, 75, out);\n            out.flush();\n            out.close();\n        } catch (FileNotFoundException e) {\n            e.printStackTrace();\n        } catch (IOException e) {\n            e.printStackTrace();\n        }\n    }\n\n    public static Bitmap getImageFromAssetsFile(Context context, String fileName) {\n        Bitmap image = null;\n        AssetManager am = context.getResources().getAssets();\n        try {\n            InputStream is = am.open(fileName);\n            image = BitmapFactory.decodeStream(is);\n            is.close();\n        } catch (IOException e) {\n            e.printStackTrace();\n        }\n        return image;\n    }\n\n    /**\n     * according to the width to get bitmap,if image's width more than width,\n     * than compress the image's width and height\n     *\n     * @param path\n     * @param width  the width which need to be\n     * @param height\n     */\n    public static Bitmap getBitmapBySimpleSize(\n            String path,\n            float width,\n            float height) {\n        if (TextUtils.isEmpty(path)) {\n            return null;\n        }\n        BitmapFactory.Options options = new BitmapFactory.Options();\n        options.inJustDecodeBounds = true;\n        // 通过这个bitmap获取图片的宽和高\n        Bitmap bitmap = BitmapFactory.decodeFile(path, options);\n        setBitmapNormalOptions(options, width, height);\n        // 注意这次要把options.inJustDecodeBounds 设为 false,这次图片是要读取出来的。\n//\t\tMyLogUtil.e(\"HongLi\", \"path:\" + path);\n        bitmap = BitmapFactory.decodeFile(path, options);\n//\t\tMyLogUtil.e(\"HongLi\", \"image width:\" + bitmap.getWidth() + \";height:\" + bitmap.getHeight());\n        return bitmap;\n    }\n\n    /**\n     * 设置bitmap的缩放比\n     *\n     * @param options\n     * @param width\n     * @param height\n     */\n    private static void setBitmapNormalOptions(\n            BitmapFactory.Options options, float width, float height) {\n        if (null == options) {\n            return;\n        }\n        if (options.outWidth > width) {\n            float scale = (options.outWidth / width);\n            //如果按照宽度缩放比例导致高度小于原定高度，则按照高度的缩放比例来缩放\n            if (options.outHeight / scale < height) {\n                scale = (options.outHeight / height);\n            }\n            int realScale = scale - (int) scale >= 0.2 ? (int) scale + 1 : (int) scale;\n            realScale = realScale <= 0 ? 1 : realScale;\n            options.inSampleSize = realScale;\n            options.outWidth = options.outWidth / options.inSampleSize;\n            options.outHeight = options.outHeight / options.inSampleSize;\n        } else {\n            options.inSampleSize = 1;\n        }\n        if (options.outHeight > 3500) {\n            int realScale = options.outHeight / 3500;\n            options.inSampleSize = options.inSampleSize < realScale ? realScale : options.inSampleSize;\n        }\n        if (options.outWidth > 3500) {\n            int realScale = options.outWidth / 3500;\n            options.inSampleSize = options.inSampleSize < realScale ? realScale : options.inSampleSize;\n        }\n        options.inJustDecodeBounds = false;\n        options.inPurgeable = true;\n        options.inInputShareable = true;\n        //RGB会造成透明PNG显示黑色背景\n        options.inPreferredConfig = Bitmap.Config.ARGB_8888;\n    }\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/common/utils/CameraBitmapUtil.java",
    "content": "package com.zero.magicshow.common.utils;\n\nimport android.app.Activity;\nimport android.graphics.Bitmap;\nimport android.graphics.Matrix;\nimport android.hardware.Camera;\nimport android.view.Surface;\n\n/**\n * Created by hongli on 2017/12/14.\n */\n\npublic class CameraBitmapUtil {\n\n    public static Bitmap handlerCameraBitmap(Activity activity, Bitmap takeBitmap,int cameraId) {\n        Matrix matrix = new Matrix();\n        matrix.postRotate(getCameraDisplayOrientation(activity, cameraId));\n        matrix.postScale(1, cameraId == 1 ? -1 : 1);\n        Bitmap cropRotateScaled = Bitmap.createBitmap(takeBitmap, 0, 0, takeBitmap.getWidth(), takeBitmap.getHeight(), matrix, true);\n        if (cropRotateScaled != takeBitmap) {\n            takeBitmap.recycle();\n        }\n        return cropRotateScaled;\n    }\n\n    public static int getCameraDisplayOrientation(Activity activity,int cameraId) {\n        int result = 90;\n        try {\n            android.hardware.Camera.CameraInfo info = new android.hardware.Camera.CameraInfo();\n            android.hardware.Camera.getCameraInfo(cameraId, info);\n            int rotation = activity.getWindowManager().getDefaultDisplay().getRotation();\n            int degrees = 0;\n            switch (rotation) {\n                case Surface.ROTATION_0:\n                    degrees = 0;\n                    break;\n                case Surface.ROTATION_90:\n                    degrees = 90;\n                    break;\n                case Surface.ROTATION_180:\n                    degrees = 180;\n                    break;\n                case Surface.ROTATION_270:\n                    degrees = 270;\n                    break;\n            }\n\n            if (info.facing == Camera.CameraInfo.CAMERA_FACING_FRONT) {\n                result = (info.orientation + degrees) % 360;\n                result = (360 - result) % 360;  // compensate the mirror\n            } else {  // back-facing\n                result = (info.orientation - degrees + 360) % 360;\n            }\n        } catch (Exception e) {\n            e.printStackTrace();\n        }\n        return result;\n\n    }\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/common/utils/CameraParamUtil.java",
    "content": "package com.zero.magicshow.common.utils;\n\nimport android.hardware.Camera;\nimport android.util.Log;\n\nimport java.util.Collections;\nimport java.util.Comparator;\nimport java.util.List;\n\n/**\n * Created by hongli on 2017/9/1.\n */\n\npublic class CameraParamUtil {\n    private static final String TAG = \"JCameraView\";\n    private CameraSizeComparator sizeComparator = new CameraSizeComparator();\n    private static CameraParamUtil cameraParamUtil = null;\n\n    private CameraParamUtil() {\n\n    }\n\n    public static CameraParamUtil getInstance() {\n        if (cameraParamUtil == null) {\n            cameraParamUtil = new CameraParamUtil();\n            return cameraParamUtil;\n        } else {\n            return cameraParamUtil;\n        }\n    }\n\n    public Camera.Size getPreviewSize(List<Camera.Size> list, int th, float rate) {\n        Collections.sort(list, sizeComparator);\n        int i = 0;\n        for (Camera.Size s : list) {\n            if ((s.width > th) && equalRate(s, rate)) {\n                Log.i(TAG, \"MakeSure Preview :w = \" + s.width + \" h = \" + s.height);\n                break;\n            }\n            i++;\n        }\n        if (i == list.size()) {\n            return getBestSize(list, rate);\n        } else {\n            return list.get(i);\n        }\n    }\n\n    public Camera.Size getPictureSize(List<Camera.Size> list, int th, float rate) {\n        Collections.sort(list, sizeComparator);\n\n        int i = 0;\n        for (Camera.Size s : list) {\n            if ((s.width > th) && equalRate(s, rate)) {\n                Log.i(TAG, \"MakeSure Picture :w = \" + s.width + \" h = \" + s.height);\n                break;\n            }\n            i++;\n        }\n        if (i == list.size()) {\n            return getBestSize(list, rate);\n        } else {\n            return list.get(i);\n        }\n    }\n\n    public Camera.Size getBestSize(List<Camera.Size> list, float rate) {\n        float previewDisparity = 100;\n        int index = 0;\n        for (int i = 0; i < list.size(); i++) {\n            Camera.Size cur = list.get(i);\n            float prop = (float) cur.width / (float) cur.height;\n            if (Math.abs(rate - prop) < previewDisparity) {\n                previewDisparity = Math.abs(rate - prop);\n                index = i;\n            }\n        }\n        return list.get(index);\n    }\n\n\n    public boolean equalRate(Camera.Size s, float rate) {\n        float r = (float) (s.width) / (float) (s.height);\n        if (Math.abs(r - rate) <= 0.2) {\n            return true;\n        } else {\n            return false;\n        }\n    }\n\n    public boolean isSupportedFocusMode(List<String> focusList, String focusMode) {\n        for (int i = 0; i < focusList.size(); i++) {\n            if (focusMode.equals(focusList.get(i))) {\n                Log.i(TAG, \"FocusMode supported \" + focusMode);\n                return true;\n            }\n        }\n        Log.i(TAG, \"FocusMode not supported \" + focusMode);\n        return false;\n    }\n\n    public boolean isSupportedPictureFormats(List<Integer> supportedPictureFormats, int jpeg) {\n        for (int i = 0; i < supportedPictureFormats.size(); i++) {\n            if (jpeg == supportedPictureFormats.get(i)) {\n                Log.i(TAG, \"Formats supported \" + jpeg);\n                return true;\n            }\n        }\n        Log.i(TAG, \"Formats not supported \" + jpeg);\n        return false;\n    }\n\n    public class CameraSizeComparator implements Comparator<Camera.Size> {\n        public int compare(Camera.Size lhs, Camera.Size rhs) {\n            if (lhs.width == rhs.width) {\n                return 0;\n            } else if (lhs.width > rhs.width) {\n                return 1;\n            } else {\n                return -1;\n            }\n        }\n\n    }\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/common/utils/Constants.java",
    "content": "package com.zero.magicshow.common.utils;\n\nimport android.os.Environment;\nimport android.util.Log;\n\nimport com.zero.magicshow.core.filter.utils.MagicFilterType;\n\nimport java.io.File;\nimport java.text.SimpleDateFormat;\nimport java.util.Date;\nimport java.util.Locale;\n\n/**\n * Created by hongli on 2017/8/22.\n */\n\npublic class Constants {\n    public static final String TRANSMIT_IMAGE_URL = \"imageUrl\";\n    public static final MagicFilterType[] FILTER_TYPES = new MagicFilterType[]{\n            MagicFilterType.NONE,\n            MagicFilterType.FAIRYTALE,\n            MagicFilterType.SUNRISE,\n            MagicFilterType.SUNSET,\n            MagicFilterType.WHITECAT,\n            MagicFilterType.BLACKCAT,\n            MagicFilterType.SKINWHITEN,\n            MagicFilterType.HEALTHY,\n            MagicFilterType.SWEETS,\n            MagicFilterType.ROMANCE,\n            MagicFilterType.SAKURA,\n            MagicFilterType.WARM,\n            MagicFilterType.ANTIQUE,\n            MagicFilterType.NOSTALGIA,\n            MagicFilterType.CALM,\n            MagicFilterType.LATTE,\n            MagicFilterType.TENDER,\n            MagicFilterType.COOL,\n            MagicFilterType.EMERALD,\n            MagicFilterType.EVERGREEN,\n            MagicFilterType.CRAYON,\n            MagicFilterType.SKETCH,\n            MagicFilterType.AMARO,\n            MagicFilterType.BRANNAN,\n            MagicFilterType.BROOKLYN,\n            MagicFilterType.EARLYBIRD,\n            MagicFilterType.FREUD,\n            MagicFilterType.HEFE,\n            MagicFilterType.HUDSON,\n            MagicFilterType.INKWELL,\n            MagicFilterType.KEVIN,\n//            MagicFilterType.LOMO,\n            MagicFilterType.N1977,\n            MagicFilterType.NASHVILLE,\n            MagicFilterType.PIXAR,\n            MagicFilterType.RISE,\n            MagicFilterType.SIERRA,\n            MagicFilterType.SUTRO,\n            MagicFilterType.TOASTER2,\n            MagicFilterType.VALENCIA,\n            MagicFilterType.WALDEN,\n            MagicFilterType.XPROII\n    };\n    public static int mScreenWidth;\n    public static int mScreenHeight;\n\n    public static File getOutputMediaFile() {\n        // To be safe, you should check that the SDCard is mounted\n        // using Environment.getExternalStorageState() before doing this.\n\n        File mediaStorageDir = new File(Environment.getExternalStoragePublicDirectory(\n                Environment.DIRECTORY_PICTURES), \"MagicCamera\");\n        // This location works best if you want the created images to be shared\n        // between applications and persist after your app has been uninstalled.\n\n        // Create the storage directory if it does not exist\n        if (!mediaStorageDir.exists()) {\n            if (!mediaStorageDir.mkdirs()) {\n                Log.d(\"MyCameraApp\", \"failed to create directory\");\n                return null;\n            }\n        }\n\n        // Create a media file name\n        String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\",Locale.CHINESE).format(new Date());\n        File mediaFile = new File(mediaStorageDir.getPath() + File.separator +\n                \"IMG_\" + timeStamp + \".jpg\");\n\n        return mediaFile;\n    }\n    public static final int RX_JAVA_TYPE_IMAGE_EDIT = 10001;//图片编译\n    public static final int RX_JAVA_TYPE_CAMERA_SHOOT = 10002;//照片拍摄\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/common/utils/DateUtils.java",
    "content": "package com.zero.magicshow.common.utils;\n\nimport com.zero.zerolib.util.DateUtil;\n\nimport java.text.SimpleDateFormat;\nimport java.util.Date;\n\n/**\n * Created by hongli on 2017/8/30.\n */\n\npublic class DateUtils extends DateUtil{\n    /**\n     * 获取时间戳\n     * @return 20180521172011\n     */\n    public static String getTimeStamp(){\n        SimpleDateFormat sim = new SimpleDateFormat(\"yyyyMMddHHmmss\");\n        try {\n            return sim.format(new Date());\n        }catch(Exception e){\n            e.printStackTrace();\n        }\n        return \"\";\n    }\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/common/utils/FilterTypeHelper.java",
    "content": "package com.zero.magicshow.common.utils;\n\nimport com.zero.magicshow.R;\nimport com.zero.magicshow.core.filter.utils.MagicFilterType;\n\n\npublic class FilterTypeHelper {\n\t\n\tpublic static int FilterType2Color(MagicFilterType filterType){\n\t\tswitch (filterType) {\n\t\t\tcase NONE:\n\t\t\t\treturn R.color.filter_color_grey_light;\n\t\t\tcase WHITECAT:\n\t\t\tcase BLACKCAT:\n\t\t\tcase SUNRISE:\n\t\t\tcase SUNSET:\n\t\t\t\treturn R.color.filter_color_brown_light;\n\t\t\tcase COOL:\n\t\t\t\treturn R.color.filter_color_blue_dark;\n\t\t\tcase EMERALD:\n\t\t\tcase EVERGREEN:\n\t\t\t\treturn R.color.filter_color_blue_dark_dark;\n\t\t\tcase FAIRYTALE:\n\t\t\t\treturn R.color.filter_color_blue;\n\t\t\tcase ROMANCE:\n\t\t\tcase SAKURA:\n\t\t\tcase WARM:\n\t\t\t\treturn R.color.filter_color_pink;\n\t\t\tcase AMARO:\n\t\t\tcase BRANNAN:\n\t\t\tcase BROOKLYN:\n\t\t\tcase EARLYBIRD:\n\t\t\tcase FREUD:\n\t\t\tcase HEFE:\n\t\t\tcase HUDSON:\n\t\t\tcase INKWELL:\n\t\t\tcase KEVIN:\n\t\t\tcase LOMO:\n\t\t\tcase N1977:\n\t\t\tcase NASHVILLE:\n\t\t\tcase PIXAR:\n\t\t\tcase RISE:\n\t\t\tcase SIERRA:\n\t\t\tcase SUTRO:\n\t\t\tcase TOASTER2:\n\t\t\tcase VALENCIA:\n\t\t\tcase WALDEN:\n\t\t\tcase XPROII:\n\t\t\t\treturn R.color.filter_color_brown_dark;\n\t\t\tcase ANTIQUE:\n\t\t\tcase NOSTALGIA:\n\t\t\t\treturn R.color.filter_color_green_dark;\n\t\t\tcase SKINWHITEN:\n\t\t\tcase HEALTHY:\n\t\t\t\treturn R.color.filter_color_red;\n\t\t\tcase SWEETS:\n\t\t\t\treturn R.color.filter_color_red_dark;\n\t\t\tcase CALM:\n\t\t\tcase LATTE:\n\t\t\tcase TENDER:\n\t\t\t\treturn R.color.filter_color_brown;\n\t\t\tdefault:\n\t\t\t\treturn R.color.filter_color_grey_light;\n\t\t}\n\t}\n\t\n\tpublic static int FilterType2Thumb(MagicFilterType filterType){\n\t\tswitch (filterType) {\n\t\tcase NONE:\n\t\t\treturn R.drawable.filter_thumb_original;\n\t\tcase WHITECAT:\n\t\t\treturn R.drawable.filter_thumb_whitecat;\n\t\tcase BLACKCAT:\n\t\t\treturn R.drawable.filter_thumb_blackcat;\n\t\tcase ROMANCE:\n\t\t\treturn R.drawable.filter_thumb_romance;\n\t\tcase SAKURA:\n\t\t\treturn R.drawable.filter_thumb_sakura;\n\t\tcase AMARO:\n\t\t\treturn R.drawable.filter_thumb_amoro;\n\t\tcase BRANNAN:\n\t\t\treturn R.drawable.filter_thumb_brannan;\n\t\tcase BROOKLYN:\n\t\t\treturn R.drawable.filter_thumb_brooklyn;\n\t\tcase EARLYBIRD:\n\t\t\treturn R.drawable.filter_thumb_earlybird;\n\t\tcase FREUD:\n\t\t\treturn R.drawable.filter_thumb_freud;\n\t\tcase HEFE:\n\t\t\treturn R.drawable.filter_thumb_hefe;\n\t\tcase HUDSON:\n\t\t\treturn R.drawable.filter_thumb_hudson;\n\t\tcase INKWELL:\n\t\t\treturn R.drawable.filter_thumb_inkwell;\n\t\tcase KEVIN:\n\t\t\treturn R.drawable.filter_thumb_kevin;\n\t\tcase LOMO:\n\t\t\treturn R.drawable.filter_thumb_lomo;\n\t\tcase N1977:\n\t\t\treturn R.drawable.filter_thumb_1977;\n\t\tcase NASHVILLE:\n\t\t\treturn R.drawable.filter_thumb_nashville;\n\t\tcase PIXAR:\n\t\t\treturn R.drawable.filter_thumb_piaxr;\n\t\tcase RISE:\n\t\t\treturn R.drawable.filter_thumb_rise;\n\t\tcase SIERRA:\n\t\t\treturn R.drawable.filter_thumb_sierra;\n\t\tcase SUTRO:\n\t\t\treturn R.drawable.filter_thumb_sutro;\n\t\tcase TOASTER2:\n\t\t\treturn R.drawable.filter_thumb_toastero;\n\t\tcase VALENCIA:\n\t\t\treturn R.drawable.filter_thumb_valencia;\n\t\tcase WALDEN:\n\t\t\treturn R.drawable.filter_thumb_walden;\n\t\tcase XPROII:\n\t\t\treturn R.drawable.filter_thumb_xpro;\n\t\tcase ANTIQUE:\n\t\t\treturn R.drawable.filter_thumb_antique;\n\t\tcase SKINWHITEN:\n\t\t\treturn R.drawable.filter_thumb_beauty;\n\t\tcase CALM:\n\t\t\treturn R.drawable.filter_thumb_calm;\n\t\tcase COOL:\n\t\t\treturn R.drawable.filter_thumb_cool;\n\t\tcase EMERALD:\n\t\t\treturn R.drawable.filter_thumb_emerald;\n\t\tcase EVERGREEN:\n\t\t\treturn R.drawable.filter_thumb_evergreen;\n\t\tcase FAIRYTALE:\n\t\t\treturn R.drawable.filter_thumb_fairytale;\n\t\tcase HEALTHY:\n\t\t\treturn R.drawable.filter_thumb_healthy;\n\t\tcase NOSTALGIA:\n\t\t\treturn R.drawable.filter_thumb_nostalgia;\n\t\tcase TENDER:\n\t\t\treturn R.drawable.filter_thumb_tender;\n\t\tcase SWEETS:\n\t\t\treturn R.drawable.filter_thumb_sweets;\n\t\tcase LATTE:\n\t\t\treturn R.drawable.filter_thumb_latte;\n\t\tcase WARM:\n\t\t\treturn R.drawable.filter_thumb_warm;\n\t\tcase SUNRISE:\n\t\t\treturn R.drawable.filter_thumb_sunrise;\n\t\tcase SUNSET:\n\t\t\treturn R.drawable.filter_thumb_sunset;\n\t\tcase CRAYON:\n\t\t\treturn R.drawable.filter_thumb_crayon;\n\t\tcase SKETCH:\n\t\t\treturn R.drawable.filter_thumb_sketch;\n\t\tdefault:\n\t\t\treturn R.drawable.filter_thumb_original;\n\t\t}\n\t}\n\t\n\tpublic static int FilterType2Name(MagicFilterType filterType){\n\t\tswitch (filterType) {\n\t\tcase NONE:\n\t\t\treturn R.string.filter_none;\n\t\tcase WHITECAT:\n\t\t\treturn R.string.filter_whitecat;\n\t\tcase BLACKCAT:\n\t\t\treturn R.string.filter_blackcat;\n\t\tcase ROMANCE:\n\t\t\treturn R.string.filter_romance;\n\t\tcase SAKURA:\n\t\t\treturn R.string.filter_sakura;\n\t\tcase AMARO:\n\t\t\treturn R.string.filter_amaro;\n\t\tcase BRANNAN:\n\t\t\treturn R.string.filter_brannan;\n\t\tcase BROOKLYN:\n\t\t\treturn R.string.filter_brooklyn;\n\t\tcase EARLYBIRD:\n\t\t\treturn R.string.filter_Earlybird;\n\t\tcase FREUD:\n\t\t\treturn R.string.filter_freud;\n\t\tcase HEFE:\n\t\t\treturn R.string.filter_hefe;\n\t\tcase HUDSON:\n\t\t\treturn R.string.filter_hudson;\n\t\tcase INKWELL:\n\t\t\treturn R.string.filter_inkwell;\n\t\tcase KEVIN:\n\t\t\treturn R.string.filter_kevin;\n\t\tcase LOMO:\n\t\t\treturn R.string.filter_lomo;\n\t\tcase N1977:\n\t\t\treturn R.string.filter_n1977;\n\t\tcase NASHVILLE:\n\t\t\treturn R.string.filter_nashville;\n\t\tcase PIXAR:\n\t\t\treturn R.string.filter_pixar;\n\t\tcase RISE:\n\t\t\treturn R.string.filter_rise;\n\t\tcase SIERRA:\n\t\t\treturn R.string.filter_sierra;\n\t\tcase SUTRO:\n\t\t\treturn R.string.filter_sutro;\n\t\tcase TOASTER2:\n\t\t\treturn R.string.filter_toastero;\n\t\tcase VALENCIA:\n\t\t\treturn R.string.filter_valencia;\n\t\tcase WALDEN:\n\t\t\treturn R.string.filter_walden;\n\t\tcase XPROII:\n\t\t\treturn R.string.filter_xproii;\n\t\tcase ANTIQUE:\n\t\t\treturn R.string.filter_antique;\n\t\tcase CALM:\n\t\t\treturn R.string.filter_calm;\n\t\tcase COOL:\n\t\t\treturn R.string.filter_cool;\n\t\tcase EMERALD:\n\t\t\treturn R.string.filter_emerald;\n\t\tcase EVERGREEN:\n\t\t\treturn R.string.filter_evergreen;\n\t\tcase FAIRYTALE:\n\t\t\treturn R.string.filter_fairytale;\n\t\tcase HEALTHY:\n\t\t\treturn R.string.filter_healthy;\n\t\tcase NOSTALGIA:\n\t\t\treturn R.string.filter_nostalgia;\n\t\tcase TENDER:\n\t\t\treturn R.string.filter_tender;\n\t\tcase SWEETS:\n\t\t\treturn R.string.filter_sweets;\n\t\tcase LATTE:\n\t\t\treturn R.string.filter_latte;\n\t\tcase WARM:\n\t\t\treturn R.string.filter_warm;\n\t\tcase SUNRISE:\n\t\t\treturn R.string.filter_sunrise;\n\t\tcase SUNSET:\n\t\t\treturn R.string.filter_sunset;\n\t\tcase SKINWHITEN:\n\t\t\treturn R.string.filter_skinwhiten;\n\t\tcase CRAYON:\n\t\t\treturn R.string.filter_crayon;\n\t\tcase SKETCH:\n\t\t\treturn R.string.filter_sketch;\n\t\tdefault:\n\t\t\treturn R.string.filter_none;\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/common/utils/GravityUtil.java",
    "content": "package com.zero.magicshow.common.utils;\n\nimport android.app.Activity;\nimport android.content.Context;\nimport android.hardware.Sensor;\nimport android.hardware.SensorEvent;\nimport android.hardware.SensorEventListener;\nimport android.hardware.SensorManager;\nimport android.os.Handler;\nimport android.os.Message;\nimport android.util.Log;\n\nimport com.zero.magicshow.common.iface.GravityCallBack;\n\n/**\n * Created by hongli on 2017/9/1.\n */\n\npublic class GravityUtil {\n    private static final String TAG = GravityUtil.class.getSimpleName();\n    public static final int DIRECTION_LAND_LEFT = 1;\n    public static final int DIRECTION_PORTRAIT_POSITIVE = 2;\n    public static final int DIRECTION_LAND_RIGHT = 3;\n    public static final int DIRECTION_PORTRAIT_NEGATIVE = 4;\n    public static final int DIRECTION_LAND = 5;//手动选择横屏\n    public static final int DIRECTION_PORTRAIT = 6;//手动选择竖屏\n\n    private volatile static GravityUtil gravityUtil = new GravityUtil();\n    private GravityCallBack gravityCallBack;\n\n    private Activity mActivity;\n\n    // 是否是竖屏\n    private boolean isPortrait = true;\n    //是否是左面倾斜横屏还是右面倾斜\n    private boolean isLeftCrossScreen = true;\n\n    private SensorManager sm;\n    private GravityUtil.OrientationSensorListener listener;\n    private Sensor sensor;\n\n    private SensorManager sm1;\n    private Sensor sensor1;\n    private GravityUtil.OrientationSensorListener1 listener1;\n\n    private final int MAX_RETRY_COUNT = 10;\n    private int retryLandLeftCount = 0;//并非已判断是横或者竖就立即发送消息，持续MAX_RETRY_COUNT次之后才会发送\n    private int retryLandRightCount = 0;\n    private int retryPorPositiveCount = 0;\n    private int retryPorNegtiveCount = 0;\n\n    public static GravityUtil getInstance(){\n        return gravityUtil;\n    }\n\n    private GravityUtil(){\n\n    }\n    /**\n     * 返回ScreenSwitchUtils单例\n     **/\n    public void init(Context context, GravityCallBack gravityCallBack) {\n        Log.d(TAG, \"init orientation listener.\");\n        if(null == sm){\n            // 注册重力感应器,监听屏幕旋转\n            sm = (SensorManager) context.getSystemService(Context.SENSOR_SERVICE);\n            sensor = sm.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);\n            listener = new GravityUtil.OrientationSensorListener(mHandler);\n\n            // 根据 旋转之后/点击全屏之后 两者方向一致,激活sm.\n            sm1 = (SensorManager) context.getSystemService(Context.SENSOR_SERVICE);\n            sensor1 = sm1.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);\n            listener1 = new GravityUtil.OrientationSensorListener1();\n        }\n        this.gravityCallBack = gravityCallBack;\n    }\n\n    private Handler mHandler = new Handler() {\n        public void handleMessage(Message msg) {\n            switch (msg.what) {\n                case 888:\n                    int orientation = msg.arg1;\n                    if (orientation > 45 && orientation < 135) {\n                        if (isPortrait && retryLandRightCount >= MAX_RETRY_COUNT) {\n                            Log.e(\"test\", \"切换成右横屏\");\n                            isLeftCrossScreen = false;\n                            gravityCallBack.onGravityChange(DIRECTION_LAND_RIGHT);\n//                            mActivity.setRequestedOrientation(0);\n                            isPortrait = false;\n                            retryLandRightCount = 0;\n                        }else{\n                            retryLandRightCount++;\n                            retryLandLeftCount = 0;\n                            retryPorNegtiveCount = 0;\n                            retryPorPositiveCount = 0;\n                        }\n                    } else if (orientation > 135 && orientation < 225) {\n                        if (!isPortrait && retryPorNegtiveCount >= MAX_RETRY_COUNT) {\n                            Log.e(\"test\", \"切换成反竖屏\");\n//                            mActivity.setRequestedOrientation(1);\n                            gravityCallBack.onGravityChange(DIRECTION_PORTRAIT_NEGATIVE);\n                            isPortrait = true;\n                            retryPorNegtiveCount = 0;\n                        }else{\n                            retryPorNegtiveCount++;\n                            retryLandRightCount = 0;\n                            retryLandLeftCount = 0;\n                            retryPorPositiveCount = 0;\n                        }\n                    } else if (orientation > 225 && orientation < 315) {\n                        if (isPortrait && retryLandLeftCount >= MAX_RETRY_COUNT) {\n                            Log.e(\"test\", \"切换成左横屏\");\n                            isLeftCrossScreen = true;\n                            gravityCallBack.onGravityChange(DIRECTION_LAND_LEFT);\n//                            mActivity.setRequestedOrientation(0);\n                            isPortrait = false;\n                            retryLandLeftCount = 0;\n                        }else{\n                            retryLandLeftCount++;\n                            retryPorNegtiveCount = 0;\n                            retryLandRightCount = 0;\n                            retryPorPositiveCount = 0;\n                        }\n                    } else if ((orientation > 315 && orientation < 360) || (orientation > 0 && orientation < 45)) {\n                        if (!isPortrait && retryPorPositiveCount >+MAX_RETRY_COUNT) {\n                            Log.e(\"test\", \"切换成竖屏\");\n//                            mActivity.setRequestedOrientation(1);\n                            gravityCallBack.onGravityChange(DIRECTION_PORTRAIT_POSITIVE);\n                            isPortrait = true;\n                            retryPorPositiveCount = 0;\n                        }else{\n                            retryPorPositiveCount++;\n                            retryPorNegtiveCount = 0;\n                            retryLandRightCount = 0;\n                            retryLandLeftCount = 0;\n                        }\n                    }\n                    break;\n                default:\n                    break;\n            }\n\n        }\n    };\n\n\n    /**\n     * 开始监听\n     */\n    public void start(Activity activity) {\n        Log.d(TAG, \"start orientation listener.\");\n        mActivity = activity;\n        sm.registerListener(listener, sensor, SensorManager.SENSOR_DELAY_UI);\n    }\n\n    /**\n     * 停止监听\n     */\n    public void stop() {\n        Log.d(TAG, \"stop orientation listener.\");\n        sm.unregisterListener(listener);\n        sm1.unregisterListener(listener1);\n    }\n\n    /**\n     * 手动横竖屏切换方向\n     */\n    public void toggleScreen() {\n//        sm.unregisterListener(listener);\n//        sm1.registerListener(listener1, sensor1,SensorManager.SENSOR_DELAY_UI);\n//        if (isPortrait) {\n//            isPortrait = false;\n//            // 切换成横屏\n//            mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);\n//        } else {\n//            isPortrait = true;\n//            // 切换成竖屏\n//            mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);\n//        }\n    }\n\n    public boolean isPortrait() {\n        return this.isPortrait;\n    }\n\n    public boolean isLeftCrossScreen() {\n        return this.isLeftCrossScreen;\n    }\n\n    /**\n     * 重力感应监听者\n     */\n    public class OrientationSensorListener implements SensorEventListener {\n        private static final int _DATA_X = 0;\n        private static final int _DATA_Y = 1;\n        private static final int _DATA_Z = 2;\n\n        public static final int ORIENTATION_UNKNOWN = -1;\n\n        private Handler rotateHandler;\n\n        public OrientationSensorListener(Handler handler) {\n            rotateHandler = handler;\n        }\n\n        public void onAccuracyChanged(Sensor arg0, int arg1) {\n        }\n\n        public void onSensorChanged(SensorEvent event) {\n            float[] values = event.values;\n            int orientation = ORIENTATION_UNKNOWN;\n            float X = -values[_DATA_X];\n            float Y = -values[_DATA_Y];\n            float Z = -values[_DATA_Z];\n            float magnitude = X * X + Y * Y;\n            // Don't trust the angle if the magnitude is small compared to the y\n            // value\n            if (magnitude * 4 >= Z * Z) {\n                // 屏幕旋转时\n                float OneEightyOverPi = 57.29577957855f;\n                float angle = (float) Math.atan2(-Y, X) * OneEightyOverPi;\n                orientation = 90 - (int) Math.round(angle);\n                // normalize to 0 - 359 range\n                while (orientation >= 360) {\n                    orientation -= 360;\n                }\n                while (orientation < 0) {\n                    orientation += 360;\n                }\n            }\n            if (rotateHandler != null) {\n                rotateHandler.obtainMessage(888, orientation, 0).sendToTarget();\n            }\n        }\n    }\n\n    public class OrientationSensorListener1 implements SensorEventListener {\n        private static final int _DATA_X = 0;\n        private static final int _DATA_Y = 1;\n        private static final int _DATA_Z = 2;\n\n        public static final int ORIENTATION_UNKNOWN = -1;\n\n        public OrientationSensorListener1() {\n        }\n\n        public void onAccuracyChanged(Sensor arg0, int arg1) {\n        }\n\n        public void onSensorChanged(SensorEvent event) {\n            float[] values = event.values;\n            int orientation = ORIENTATION_UNKNOWN;\n            float X = -values[_DATA_X];\n            float Y = -values[_DATA_Y];\n            float Z = -values[_DATA_Z];\n            float magnitude = X * X + Y * Y;\n            // Don't trust the angle if the magnitude is small compared to the y\n            // value\n            if (magnitude * 4 >= Z * Z) {\n                // 屏幕旋转时\n                float OneEightyOverPi = 57.29577957855f;\n                float angle = (float) Math.atan2(-Y, X) * OneEightyOverPi;\n                orientation = 90 - (int) Math.round(angle);\n                // normalize to 0 - 359 range\n                while (orientation >= 360) {\n                    orientation -= 360;\n                }\n                while (orientation < 0) {\n                    orientation += 360;\n                }\n            }\n            if (orientation > 225 && orientation < 315) {// 检测到当前实际是横屏\n                if (!isPortrait) {\n                    sm.registerListener(listener, sensor, SensorManager.SENSOR_DELAY_UI);\n                    sm1.unregisterListener(listener1);\n                }\n            } else if ((orientation > 315 && orientation < 360) || (orientation > 0 && orientation < 45)) {// 检测到当前实际是竖屏\n                if (isPortrait) {\n                    sm.registerListener(listener, sensor, SensorManager.SENSOR_DELAY_UI);\n                    sm1.unregisterListener(listener1);\n                }\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/common/utils/MagicParams.java",
    "content": "package com.zero.magicshow.common.utils;\n\nimport android.content.Context;\nimport android.os.Environment;\n\nimport com.zero.magicshow.common.base.MagicBaseView;\n\n/**\n * Created by why8222 on 2016/2/26.\n */\npublic class MagicParams {\n    public static Context context;\n    public static MagicBaseView magicBaseView;\n\n    public static String videoPath = Environment.getExternalStorageDirectory().getPath();\n    public static String videoName = \"MagicCamera_test.mp4\";\n\n    public static int beautyLevel = 0;\n\n    public MagicParams() {\n\n    }\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/common/utils/OpenGlUtils.java",
    "content": "package com.zero.magicshow.common.utils;\n\nimport android.content.Context;\nimport android.content.res.AssetManager;\nimport android.graphics.Bitmap;\nimport android.graphics.BitmapFactory;\nimport android.opengl.GLES11Ext;\nimport android.opengl.GLES20;\nimport android.opengl.GLUtils;\nimport android.util.Log;\n\nimport com.zero.magicshow.core.filter.base.gpuimage.GPUImageFilter;\n\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.nio.Buffer;\nimport java.nio.ByteBuffer;\nimport java.nio.ByteOrder;\nimport java.nio.FloatBuffer;\nimport java.nio.IntBuffer;\n\nimport javax.microedition.khronos.opengles.GL10;\n\npublic class OpenGlUtils {\n\tpublic static final int NO_TEXTURE = -1;\n\tpublic static final int NOT_INIT = -1;\t\n\tpublic static final int ON_DRAWN = 1;\n\t\n\tpublic static int loadTexture(final Bitmap img, final int usedTexId) {\n\t\treturn loadTexture(img, usedTexId, false);\n    }\n\t\n\tpublic static int loadTexture(final Bitmap img, final int usedTexId, boolean recyled) {\n\t\tif(img == null)\n\t\t\treturn NO_TEXTURE; \n        int textures[] = new int[1];\n        if (usedTexId == NO_TEXTURE) {\n            GLES20.glGenTextures(1, textures, 0);\n            GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textures[0]);\n            GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n                    GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);\n            GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n                    GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);\n            GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n                    GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);\n            GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n                    GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);\n\n            GLUtils.texImage2D(GLES20.GL_TEXTURE_2D, 0, img, 0);\n        } else {\n            GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, usedTexId);\n            GLUtils.texSubImage2D(GLES20.GL_TEXTURE_2D, 0, 0, 0, img);\n            textures[0] = usedTexId;\n        }\n        if(recyled)\n        \timg.recycle();\n        return textures[0];\n    }\n\t\n\tpublic static int loadTexture(final Buffer data, final int width,final int height, final int usedTexId) {\n\t\tif(data == null)\n\t\t\treturn NO_TEXTURE;\n\t    int textures[] = new int[1];\n\t    if (usedTexId == NO_TEXTURE) {\n\t        GLES20.glGenTextures(1, textures, 0);\n\t        GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textures[0]);\n\t        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t                GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);\n\t        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t                GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);\n\t        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t                GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);\n\t        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t                GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);\n\t        GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, width, height,\n\t                0, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, data);\n\t    } else {\n\t        GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, usedTexId);\n\t        GLES20.glTexSubImage2D(GLES20.GL_TEXTURE_2D, 0, 0, 0, width,\n\t                height, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, data);\n\t        textures[0] = usedTexId;\n\t    }\n\t    return textures[0];\n    }\n    \n\tpublic static int loadTexture(final Buffer data, final int width,final int height, final int usedTexId,final int type) {\n\t\tif(data == null)\n\t\t\treturn NO_TEXTURE;\n\t    int textures[] = new int[1];\n\t    if (usedTexId == NO_TEXTURE) {\n\t        GLES20.glGenTextures(1, textures, 0);\n\t        GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textures[0]);\n\t        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t                GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);\n\t        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t                GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);\n\t        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t                GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);\n\t        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t                GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);\n\t        GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, width, height,\n\t                0, GLES20.GL_RGBA, type, data);\n\t    } else {\n\t        GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, usedTexId);\n\t        GLES20.glTexSubImage2D(GLES20.GL_TEXTURE_2D, 0, 0, 0, width,\n\t                height, GLES20.GL_RGBA, type, data);\n\t        textures[0] = usedTexId;\n\t    }\n\t    return textures[0];\n    }\n    \n    public static int loadTexture(final Context context, final String name){\n\t\tfinal int[] textureHandle = new int[1];\n\t\t\n\t\tGLES20.glGenTextures(1, textureHandle, 0);\n\t\t\n\t\tif (textureHandle[0] != 0){\n\n\t\t\t// Read in the resource\n\t\t\tfinal Bitmap bitmap = getImageFromAssetsFile(context,name);\n\t\t\t\t\t\t\n\t\t\t// Bind to the texture in OpenGL\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textureHandle[0]);\n\t\t\t\n\t\t\t// Set filtering\n\t\t\tGLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);\n\t\t\tGLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);\n\t\t\tGLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);\n\t\t\tGLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);\n\t\t\t// Load the bitmap into the bound texture.\n\t\t\tGLUtils.texImage2D(GLES20.GL_TEXTURE_2D, 0, bitmap, 0);\n\t\t\t\n\t\t\t// Recycle the bitmap, since its data has been loaded into OpenGL.\n\t\t\tbitmap.recycle();\t\t\t\t\t\t\n\t\t}\n\t\t\n\t\tif (textureHandle[0] == 0){\n\t\t\tthrow new RuntimeException(\"Error loading texture.\");\n\t\t}\n\t\t\n\t\treturn textureHandle[0];\n\t}\n\t\n\tprivate static Bitmap getImageFromAssetsFile(Context context,String fileName){  \n\t\tBitmap image = null;  \n\t    AssetManager am = context.getResources().getAssets();\n\t    try{  \n\t\t\tInputStream is = am.open(fileName);\n\t\t\timage = BitmapFactory.decodeStream(is);\n\t\t\tis.close();\n          \t}catch (IOException e){  \n\t          e.printStackTrace();  \n\t      }  \t  \n\t      return image;  \t  \n\t}  \n    \n\tpublic static int loadProgram(final String strVSource, final String strFSource) {\n        int iVShader;\n        int iFShader;\n        int iProgId;\n        int[] link = new int[1];\n        iVShader = loadShader(strVSource, GLES20.GL_VERTEX_SHADER);\n        if (iVShader == 0) {\n            Log.d(\"Load Program\", \"Vertex Shader Failed\");\n            return 0;\n        }\n        iFShader = loadShader(strFSource, GLES20.GL_FRAGMENT_SHADER);\n        if (iFShader == 0) {\n            Log.d(\"Load Program\", \"Fragment Shader Failed\");\n            return 0;\n        }\n\n        iProgId = GLES20.glCreateProgram();\n        GLES20.glAttachShader(iProgId, iVShader);\n        GLES20.glAttachShader(iProgId, iFShader);\n        GLES20.glLinkProgram(iProgId);\n        GLES20.glGetProgramiv(iProgId, GLES20.GL_LINK_STATUS, link, 0);\n        if (link[0] <= 0) {\n            Log.d(\"Load Program\", \"Linking Failed\");\n            return 0;\n        }\n        GLES20.glDeleteShader(iVShader);\n        GLES20.glDeleteShader(iFShader);\n        return iProgId;\n    }\n\t\n\tprivate static int loadShader(final String strSource, final int iType) {\n        int[] compiled = new int[1];\n        int iShader = GLES20.glCreateShader(iType);\n        GLES20.glShaderSource(iShader, strSource);\n        GLES20.glCompileShader(iShader);\n        GLES20.glGetShaderiv(iShader, GLES20.GL_COMPILE_STATUS, compiled, 0);\n        if (compiled[0] == 0) {\n            Log.e(\"Load Shader Failed\", \"Compilation\\n\" + GLES20.glGetShaderInfoLog(iShader));\n            return 0;\n        }\n        return iShader;\n    }\n\t\n\tpublic static int getExternalOESTextureID(){\t\t\n\t\tint[] texture = new int[1];\n\t\tGLES20.glGenTextures(1, texture, 0);\n\t\tGLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, texture[0]);\n\t\tGLES20.glTexParameterf(GLES11Ext.GL_TEXTURE_EXTERNAL_OES,\n\t\t\t\tGL10.GL_TEXTURE_MIN_FILTER,GL10.GL_LINEAR);        \n\t\tGLES20.glTexParameterf(GLES11Ext.GL_TEXTURE_EXTERNAL_OES,\n                GL10.GL_TEXTURE_MAG_FILTER, GL10.GL_LINEAR);\n\t\tGLES20.glTexParameteri(GLES11Ext.GL_TEXTURE_EXTERNAL_OES,\n                GL10.GL_TEXTURE_WRAP_S, GL10.GL_CLAMP_TO_EDGE);\n\t\tGLES20.glTexParameteri(GLES11Ext.GL_TEXTURE_EXTERNAL_OES,\n                GL10.GL_TEXTURE_WRAP_T, GL10.GL_CLAMP_TO_EDGE);\n\t\treturn texture[0];\n\t}\n\t\n\tpublic static String readShaderFromRawResource(final int resourceId){\n\t\tfinal InputStream inputStream = MagicParams.context.getResources().openRawResource(\n\t\t\t\tresourceId);\n\t\tfinal InputStreamReader inputStreamReader = new InputStreamReader(\n\t\t\t\tinputStream);\n\t\tfinal BufferedReader bufferedReader = new BufferedReader(\n\t\t\t\tinputStreamReader);\n\n\t\tString nextLine;\n\t\tfinal StringBuilder body = new StringBuilder();\n\n\t\ttry{\n\t\t\twhile ((nextLine = bufferedReader.readLine()) != null){\n\t\t\t\tbody.append(nextLine);\n\t\t\t\tbody.append('\\n');\n\t\t\t}\n\t\t}\n\t\tcatch (IOException e){\n\t\t\treturn null;\n\t\t}\n\t\treturn body.toString();\n\t}\n\n    public static Bitmap drawToBitmapByFilter(Bitmap bitmap, GPUImageFilter filter,\n                                              int displayWidth, int displayHeight, boolean rotate){\n        if(filter == null)\n            return null;\n        int width = bitmap.getWidth();\n        int height = bitmap.getHeight();\n        int[] mFrameBuffers = new int[1];\n        int[] mFrameBufferTextures = new int[1];\n        GLES20.glGenFramebuffers(1, mFrameBuffers, 0);\n        GLES20.glGenTextures(1, mFrameBufferTextures, 0);\n        GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mFrameBufferTextures[0]);\n        GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, width, height, 0,\n                GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, null);\n        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n                GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);\n        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n                GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);\n        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n                GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);\n        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n                GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);\n        GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, mFrameBuffers[0]);\n        GLES20.glFramebufferTexture2D(GLES20.GL_FRAMEBUFFER, GLES20.GL_COLOR_ATTACHMENT0,\n                GLES20.GL_TEXTURE_2D, mFrameBufferTextures[0], 0);\n        GLES20.glViewport(0, 0, width, height);\n        filter.onInputSizeChanged(width, height);\n        filter.onDisplaySizeChanged(displayWidth, displayHeight);\n        int textureId = OpenGlUtils.loadTexture(bitmap, OpenGlUtils.NO_TEXTURE, true);\n        if(rotate){\n            FloatBuffer gLCubeBuffer = ByteBuffer.allocateDirect(TextureRotationUtil.CUBE.length * 4)\n                    .order(ByteOrder.nativeOrder())\n                    .asFloatBuffer();\n            gLCubeBuffer.put(TextureRotationUtil.CUBE).position(0);\n\n            FloatBuffer gLTextureBuffer = ByteBuffer.allocateDirect(TextureRotationUtil.TEXTURE_NO_ROTATION.length * 4)\n                    .order(ByteOrder.nativeOrder())\n                    .asFloatBuffer();\n            gLTextureBuffer.put(TextureRotationUtil.getRotation(Rotation.ROTATION_90, true, false)).position(0);\n            filter.onDrawFrame(textureId, gLCubeBuffer, gLTextureBuffer);\n        }else {\n            filter.onDrawFrame(textureId);\n        }\n        IntBuffer ib = IntBuffer.allocate(width * height);\n        GLES20.glReadPixels(0, 0, width, height, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, ib);\n        Bitmap result = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);\n        result.copyPixelsFromBuffer(IntBuffer.wrap(ib.array()));\n        GLES20.glDeleteTextures(1, new int[]{textureId}, 0);\n        GLES20.glDeleteFramebuffers(1, mFrameBuffers, 0);\n        GLES20.glDeleteTextures(1, mFrameBufferTextures, 0);\n        filter.onInputSizeChanged(displayWidth, displayHeight);\n        return result;\n    }\n\n\t/**\n\t * Checks to see if a GLES error has been raised.\n\t */\n\tpublic static void checkGlError(String op) {\n\t\tint error = GLES20.glGetError();\n\t\tif (error != GLES20.GL_NO_ERROR) {\n\t\t\tString msg = op + \": glError 0x\" + Integer.toHexString(error);\n\t\t\tLog.e(\"OpenGlUtils\", msg);\n\t\t\tthrow new RuntimeException(msg);\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/common/utils/Rotation.java",
    "content": "/*\n * Copyright (C) 2012 CyberAgent\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage com.zero.magicshow.common.utils;\n\npublic enum Rotation {\n    NORMAL, ROTATION_90, ROTATION_180, ROTATION_270;\n\n    /**\n     * Retrieves the int representation of the Rotation.\n     *\n     * @return 0, 90, 180 or 270\n     */\n    public int asInt() {\n        switch (this) {\n            case NORMAL: return 0;\n            case ROTATION_90: return 90;\n            case ROTATION_180: return 180;\n            case ROTATION_270: return 270;\n            default: throw new IllegalStateException(\"Unknown Rotation!\");\n        }\n    }\n\n    /**\n     * Create a Rotation from an integer. Needs to be either 0, 90, 180 or 270.\n     *\n     * @param rotation 0, 90, 180 or 270\n     * @return Rotation object\n     */\n    public static Rotation fromInt(int rotation) {\n        switch (rotation) {\n            case 0: return NORMAL;\n            case 90: return ROTATION_90;\n            case 180: return ROTATION_180;\n            case 270: return ROTATION_270;\n            case 360: return NORMAL;\n            default: throw new IllegalStateException(\n                    rotation + \" is an unknown rotation. Needs to be either 0, 90, 180 or 270!\");\n        }\n    }\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/common/utils/RxBus.java",
    "content": "package com.zero.magicshow.common.utils;\n\nimport android.support.annotation.NonNull;\nimport android.util.Log;\n\nimport com.zero.zerolib.manager.PostManager;\n\nimport java.util.Vector;\n\nimport rx.android.schedulers.AndroidSchedulers;\nimport rx.functions.Action1;\nimport rx.functions.Actions;\nimport rx.internal.util.ActionSubscriber;\nimport rx.subjects.PublishSubject;\nimport rx.subjects.Subject;\n\n/**\n * Created by hongli on 2017/8/31.\n */\n\npublic class RxBus {\n    private static RxBus instance;\n    private Vector<ZeroSubject> subjectList = new Vector<>();\n\n    private RxBus() {\n    }\n\n    public static synchronized RxBus getInstance() {\n        if (null == instance) {\n            instance = new RxBus();\n        }\n        return instance;\n    }\n\n//    public synchronized <T> ZeroSubject<T> register(int actionType) {\n//        Subject<T, T> subject = PublishSubject.create();\n//        ZeroSubject<T> zeroSubject = new ZeroSubject(subject,actionType,null);\n//        subjectList.add(zeroSubject);\n//        return zeroSubject;\n//    }\n//\n//    public synchronized void unregister(Object object) {\n//        subjectList.remove(object);\n//    }\n\n    public synchronized <T> void registerMain(int actionType, Action1<T> action){\n        Subject<T, T> subject = PublishSubject.create();\n        subject.observeOn(AndroidSchedulers.mainThread()).doOnError(new Action1<Throwable>() {\n            @Override\n            public void call(Throwable throwable) {\n                throwable.printStackTrace();\n                Log.e(\"RxBus\",\"post error\");\n            }\n        }).subscribe(new ActionSubscriber<T>(action, new Action1<Throwable>() {\n            @Override\n            public void call(Throwable throwable) {\n                throwable.printStackTrace();\n                Log.e(\"RxBus\",\"post error\");\n            }\n        }, Actions.empty()));\n        ZeroSubject<T> zeroSubject = new ZeroSubject<T>(subject,actionType,action);\n        subjectList.add(zeroSubject);\n    }\n\n    public synchronized<T> void unregisterMain(Action1<T> action) {\n        for(ZeroSubject zeroSubject : subjectList){\n            if(zeroSubject.getAction() == action){\n                subjectList.remove(zeroSubject);\n                break;\n            }\n        }\n    }\n\n    public synchronized void unregisterMain(int actionType) {\n        for(ZeroSubject zeroSubject : subjectList){\n            if(zeroSubject.getActionType() == actionType){\n                subjectList.remove(zeroSubject);\n                break;\n            }\n        }\n    }\n    public synchronized void unregisterAllMain(int actionType) {\n        Vector<ZeroSubject> subjectRemoveList = new Vector<>();\n        for(ZeroSubject zeroSubject : subjectList){\n            if(zeroSubject.getActionType() == actionType){\n                subjectRemoveList.add(zeroSubject);\n            }\n        }\n        subjectList.removeAll(subjectRemoveList);\n    }\n\n    public synchronized<T> void unregisterCategory(int actionType) {\n        for(ZeroSubject zeroSubject : subjectList){\n            if(zeroSubject.getActionType() == actionType){\n                subjectList.remove(zeroSubject);\n                break;\n            }\n        }\n    }\n\n    public void post(@NonNull final Object content, final int actionType) {\n        PostManager.getInstance().postMain(new Runnable() {\n            @Override\n            public void run() {\n                synchronized (this) {\n                    try{\n                        for (ZeroSubject subject : subjectList) {\n                            if (subject != null && subject.getActionType() == actionType) {\n                                try{\n                                    subject.getSubject().onNext(content);\n                                }catch (Exception e){\n                                    e.printStackTrace();\n                                }\n                            }\n                        }\n                    }catch (Exception e){\n                        e.printStackTrace();\n                    }\n                }\n            }\n        },0);\n    }\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/common/utils/SavePictureTask.java",
    "content": "package com.zero.magicshow.common.utils;\n\nimport android.graphics.Bitmap;\nimport android.os.AsyncTask;\n\nimport com.zero.magicshow.common.entity.MagicShowResultEntity;\n\nimport java.io.File;\nimport java.io.FileNotFoundException;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\n\npublic class SavePictureTask extends AsyncTask<Bitmap, Integer, MagicShowResultEntity>{\n\t\n\tprivate OnPictureSaveListener onPictureSaveListener;\n\tprivate File file;\n\n\tpublic SavePictureTask(File file, OnPictureSaveListener listener){\n\t\tthis.onPictureSaveListener = listener;\n\t\tthis.file = file;\n\t}\n\n\t@Override\n\tprotected void onPreExecute() {\n\t\tsuper.onPreExecute();\n\t}\n\n\t@Override\n\tprotected void onPostExecute(final MagicShowResultEntity result) {\n\t\tif(result != null){\n            if (onPictureSaveListener != null){\n                onPictureSaveListener.onSaved(result);\n            }\n//            BaseUtil.scanFile(result);\n        }\n\t}\n\n\t@Override\n\tprotected MagicShowResultEntity doInBackground(Bitmap... params) {\n\t\tif(file == null)\n\t\t\treturn null;\n        MagicShowResultEntity resultEntity = new MagicShowResultEntity();\n        resultEntity.setAngle(params[0].getHeight() > params[0].getWidth() ? 90 : 0);\n        resultEntity.setFilePath(saveBitmap(params[0]));\n\t\treturn resultEntity;\n\t}\n\t\n\tprivate String saveBitmap(Bitmap bitmap) {\n\t\tif (file.exists()) {\n\t\t\tfile.delete();\n\t\t}\n\t\ttry {\n//            Log.e(\"HongLi\",\"bitmap degree:\" + bitmap.getConfig());\n            FileOutputStream out = new FileOutputStream(file);\n\t\t\tbitmap.compress(Bitmap.CompressFormat.JPEG, 100, out);\n\t\t\tout.flush();\n\t\t\tout.close();\n            bitmap.recycle();\n\t\t\treturn file.toString();\n\t\t} catch (FileNotFoundException e) {\n\t\t   e.printStackTrace();\n\t\t} catch (IOException e) {\n\t\t   e.printStackTrace();\n\t\t}\n\t\treturn null;\n\t}\n\t\n\tpublic interface OnPictureSaveListener{\n\t\tvoid onSaved(MagicShowResultEntity resultEntity);\n\t}\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/common/utils/TextureRotationUtil.java",
    "content": "/*\n * Copyright (C) 2012 CyberAgent\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage com.zero.magicshow.common.utils;\n\npublic class TextureRotationUtil {\n\n    public static final float TEXTURE_NO_ROTATION[] = {\n            0.0f, 1.0f,\n            1.0f, 1.0f,\n            0.0f, 0.0f,\n            1.0f, 0.0f,\n    };\n\n    public static final float TEXTURE_ROTATED_90[] = {\n            1.0f, 1.0f,\n            1.0f, 0.0f,\n            0.0f, 1.0f,\n            0.0f, 0.0f,\n    };\n    public static final float TEXTURE_ROTATED_180[] = {\n            1.0f, 0.0f,\n            0.0f, 0.0f,\n            1.0f, 1.0f,\n            0.0f, 1.0f,\n    };\n    public static final float TEXTURE_ROTATED_270[] = {\n            0.0f, 0.0f,\n            0.0f, 1.0f,\n            1.0f, 0.0f,\n            1.0f, 1.0f,\n    };\n    \n    public static final float CUBE[] = {\n        -1.0f, -1.0f,\n        1.0f, -1.0f,\n        -1.0f, 1.0f,\n        1.0f, 1.0f,\n\t};\n    \n    private TextureRotationUtil() {}\n\n    public static float[] getRotation(final Rotation rotation, final boolean flipHorizontal,\n                                                         final boolean flipVertical) {\n        float[] rotatedTex;\n        switch (rotation) {\n            case ROTATION_90:\n                rotatedTex = TEXTURE_ROTATED_90;\n                break;\n            case ROTATION_180:\n                rotatedTex = TEXTURE_ROTATED_180;\n                break;\n            case ROTATION_270:\n                rotatedTex = TEXTURE_ROTATED_270;\n                break;\n            case NORMAL:\n            default:\n                rotatedTex = TEXTURE_NO_ROTATION;\n                break;\n        }\n        if (flipHorizontal) {\n            rotatedTex = new float[]{\n                    flip(rotatedTex[0]), rotatedTex[1],\n                    flip(rotatedTex[2]), rotatedTex[3],\n                    flip(rotatedTex[4]), rotatedTex[5],\n                    flip(rotatedTex[6]), rotatedTex[7],\n            };\n        }\n        if (flipVertical) {\n            rotatedTex = new float[]{\n                    rotatedTex[0], flip(rotatedTex[1]),\n                    rotatedTex[2], flip(rotatedTex[3]),\n                    rotatedTex[4], flip(rotatedTex[5]),\n                    rotatedTex[6], flip(rotatedTex[7]),\n            };\n        }\n        return rotatedTex;\n    }\n\n\n    private static float flip(final float i) {\n        if (i == 0.0f) {\n            return 1.0f;\n        }\n        return 0.0f;\n    }\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/common/utils/ZeroSubject.java",
    "content": "package com.zero.magicshow.common.utils;\n\nimport rx.functions.Action1;\nimport rx.subjects.Subject;\n\n/**\n * Created by hongli on 2017/8/31.\n */\n\npublic class ZeroSubject<T>{\n    private int actionType;\n    private Subject<T,T> subject;\n    private Action1<T> action;\n    public ZeroSubject(Subject<T,T> subject, int actionType, Action1<T> action) {\n        this.actionType = actionType;\n        this.subject = subject;\n        this.action = action;\n    }\n\n    public int getActionType(){\n        return actionType;\n    }\n\n    public Subject getSubject(){\n        return subject;\n    }\n\n    public Action1<T> getAction() {\n        return action;\n    }\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/core/MagicEngine.java",
    "content": "package com.zero.magicshow.core;\n\nimport com.zero.magicshow.core.camera.CameraEngine;\nimport com.zero.magicshow.core.filter.utils.MagicFilterType;\nimport com.zero.magicshow.common.utils.SavePictureTask;\nimport com.zero.magicshow.common.utils.MagicParams;\nimport com.zero.magicshow.core.widget.MagicCameraView;\nimport com.zero.magicshow.core.widget.MagicImageView;\nimport com.zero.magicshow.common.base.MagicBaseView;\nimport com.zero.zerolib.manager.PostManager;\n\nimport java.io.File;\n\n/**\n * Created by why8222 on 2016/2/25.\n */\npublic class MagicEngine {\n    private static MagicEngine magicEngine;\n    private float skinSmoothLevel;\n    private float whiteSkinLevel;\n\n    public static MagicEngine getInstance(){\n        if(magicEngine == null)\n            throw new NullPointerException(\"MagicEngine must be built first\");\n        else\n            return magicEngine;\n    }\n\n    private MagicEngine(Builder builder){\n\n    }\n\n    public void setFilter(MagicFilterType type){\n        MagicParams.magicBaseView.setFilter(type);\n    }\n\n    public MagicFilterType getFilterType(){\n        return MagicParams.magicBaseView.getFilterType();\n    }\n\n    public void adjustFilter(float rang, MagicFilterType type){\n        if(MagicParams.magicBaseView instanceof MagicImageView) {\n            ((MagicImageView) MagicParams.magicBaseView).adjustFilter(rang,type);\n        }\n    }\n\n    public void savePicture(File file, SavePictureTask.OnPictureSaveListener listener){\n        SavePictureTask savePictureTask = new SavePictureTask(file, listener);\n        MagicParams.magicBaseView.savePicture(savePictureTask);\n    }\n\n    public void startRecord(){\n        if(MagicParams.magicBaseView instanceof MagicCameraView)\n            ((MagicCameraView)MagicParams.magicBaseView).changeRecordingState(true);\n    }\n\n    public void stopRecord(){\n        if(MagicParams.magicBaseView instanceof MagicCameraView)\n            ((MagicCameraView)MagicParams.magicBaseView).changeRecordingState(false);\n    }\n\n    public void setBeautyLevel(int level){\n        if(MagicParams.magicBaseView instanceof MagicCameraView && MagicParams.beautyLevel != level) {\n            MagicParams.beautyLevel = level;\n            ((MagicCameraView) MagicParams.magicBaseView).onBeautyLevelChanged();\n        }\n    }\n\n    public void initBeauty(){\n        if(MagicParams.magicBaseView instanceof MagicImageView) {\n            PostManager.getInstance().postSlow(new Runnable() {\n                @Override\n                public void run() {\n                    ((MagicImageView) MagicParams.magicBaseView).initMagicBeautify();\n                }\n            },0);\n        }\n    }\n\n    public void uninitBeauty(){\n        if(MagicParams.magicBaseView instanceof MagicImageView) {\n            PostManager.getInstance().postSlow(new Runnable() {\n                @Override\n                public void run() {\n                    ((MagicImageView) MagicParams.magicBaseView).uninitMagicBeautify();\n                }\n            },0);\n        }\n    }\n\n    public void setSkinSmooth(float level){\n        skinSmoothLevel = level;\n        PostManager.getInstance().removeSlow(setSkinSmoothRun);\n        PostManager.getInstance().postSlow(setSkinSmoothRun,0);\n    }\n\n    public void setWhiteSkin(float level){\n        whiteSkinLevel = level;\n        PostManager.getInstance().removeSlow(setWhiteSkinRun);\n        PostManager.getInstance().postSlow(setWhiteSkinRun,0);\n    }\n\n    public void commitImage(){\n        if(MagicParams.magicBaseView instanceof MagicImageView) {\n            ((MagicImageView) MagicParams.magicBaseView).commit();\n        }\n    }\n\n    public void restoreImage(){\n        if(MagicParams.magicBaseView instanceof MagicImageView) {\n            ((MagicImageView) MagicParams.magicBaseView).restore();\n        }\n    }\n\n    private Runnable setSkinSmoothRun = new Runnable() {\n        @Override\n        public void run() {\n            if(MagicParams.magicBaseView instanceof MagicImageView) {\n                ((MagicImageView) MagicParams.magicBaseView).setSkinSmooth(skinSmoothLevel);\n            }\n        }\n    };\n\n    private Runnable setWhiteSkinRun = new Runnable() {\n        @Override\n        public void run() {\n            if(MagicParams.magicBaseView instanceof MagicImageView) {\n                ((MagicImageView) MagicParams.magicBaseView).setWhiteSkin(whiteSkinLevel);\n            }\n        }\n    };\n\n    public void switchCamera(){\n        CameraEngine.switchCamera();\n    }\n\n    public static class Builder{\n\n        public MagicEngine build(MagicBaseView magicBaseView) {\n            MagicParams.context = magicBaseView.getContext();\n            MagicParams.magicBaseView = magicBaseView;\n            magicEngine = new MagicEngine(this);\n            return magicEngine;\n        }\n\n        public Builder setVideoPath(String path){\n            MagicParams.videoPath = path;\n            return this;\n        }\n\n        public Builder setVideoName(String name){\n            MagicParams.videoName = name;\n            return this;\n        }\n\n    }\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/core/beautify/MagicJni.java",
    "content": "package com.zero.magicshow.core.beautify;\n\nimport android.graphics.Bitmap;\n\nimport java.nio.ByteBuffer;\n\n/**\n * Created by why8222 on 2016/2/29.\n */\npublic class MagicJni {\n    static{\n        System.loadLibrary(\"MagicJni\");\n    }\n    //初始化\n    public static native void jniInitMagicBeautify(ByteBuffer handler);\n    public static native void jniUnInitMagicBeautify();\n    //局部均方差磨皮\n    public static native void jniStartSkinSmooth(float denoiseLevel);\n    //log曲线美白\n    public static native void jniStartWhiteSkin(float whitenLevel);\n    //Bitmap操作\n    public static native ByteBuffer jniStoreBitmapData(Bitmap bitmap);\n    public static native void jniFreeBitmapData(ByteBuffer handler);\n    public static native Bitmap jniGetBitmapFromStoredBitmapData(ByteBuffer handler);\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/core/camera/CameraEngine.java",
    "content": "package com.zero.magicshow.core.camera;\n\nimport android.app.Activity;\nimport android.graphics.PixelFormat;\nimport android.graphics.SurfaceTexture;\nimport android.hardware.Camera;\nimport android.hardware.Camera.CameraInfo;\nimport android.hardware.Camera.Parameters;\nimport android.hardware.Camera.Size;\nimport android.util.Log;\nimport android.view.Surface;\nimport android.view.SurfaceView;\n\nimport com.zero.magicshow.common.config.CameraConfig;\nimport com.zero.magicshow.common.utils.CameraParamUtil;\nimport com.zero.magicshow.core.camera.utils.CameraUtils;\n\nimport java.io.IOException;\nimport java.util.List;\n\nimport static android.hardware.Camera.Parameters.WHITE_BALANCE_AUTO;\n\npublic class CameraEngine {\n    private static Camera camera = null;\n    public static int cameraID = 0;\n    private static SurfaceTexture surfaceTexture;\n    private static SurfaceView surfaceView;\n\n    public static Camera getCamera(){\n        return camera;\n    }\n\n    public static boolean openCamera(){\n        if(camera == null){\n            try{\n                camera = Camera.open(cameraID);\n                setDefaultParameters();\n                return true;\n            }catch(RuntimeException e){\n                return false;\n            }\n        }\n        return false;\n    }\n\n    public static boolean openCamera(int id){\n        if(camera == null){\n            try{\n                camera = Camera.open(id);\n                cameraID = id;\n                setDefaultParameters();\n                return true;\n            }catch(RuntimeException e){\n                return false;\n            }\n        }\n        return false;\n    }\n\n    public static void releaseCamera(boolean isDestory){\n        if(camera != null){\n            camera.setPreviewCallback(null);\n            camera.stopPreview();\n            camera.release();\n            if(isDestory){\n                cameraID = 0;\n            }\n//            cameraID = 0;\n            camera = null;\n        }\n    }\n\n    public void resumeCamera(){\n        openCamera();\n    }\n\n    public void setParameters(Parameters parameters){\n        camera.setParameters(parameters);\n    }\n\n    public Parameters getParameters(){\n        if(camera != null)\n            camera.getParameters();\n        return null;\n    }\n\n    public static void switchCamera(){\n        releaseCamera(false);\n        cameraID = cameraID == 0 ? 1 : 0;\n        openCamera(cameraID);\n        startPreview(surfaceTexture);\n    }\n\n    private static void setDefaultParameters(){\n        Parameters parameters = camera.getParameters();\n//        if (parameters.getSupportedFocusModes().contains(\n//                Camera.Parameters.FOCUS_MODE_CONTINUOUS_PICTURE)) {\n//            parameters.setFocusMode(Parameters.FOCUS_MODE_CONTINUOUS_PICTURE);\n//        }\n        //增加对聚焦模式的判断\n        List<String> focusModesList = parameters.getSupportedFocusModes();\n        if (CameraParamUtil.getInstance().isSupportedFocusMode(focusModesList, Camera.Parameters.FOCUS_MODE_AUTO)) {\n            parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_AUTO);\n        }else if(CameraParamUtil.getInstance().isSupportedFocusMode(focusModesList, Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO)){\n            parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO);\n        }\n        Size previewSize = CameraUtils.getLargePreviewSize(camera);\n        parameters.setPreviewSize(previewSize.width, previewSize.height);\n//        Size pictureSize = CameraUtils.getLargePictureSize(camera);\n        parameters.setPictureSize(CameraConfig.pictureWidth, CameraConfig.pictureHeight);\n//        parameters.setRotation(cameraID == 0 ? 90 : 270);\n        parameters.setPictureFormat(PixelFormat.JPEG);//设置拍照后存储的图片格式\n        parameters.setWhiteBalance(WHITE_BALANCE_AUTO);\n        //设置曝光值为1，酒吧比较暗,增加曝光\n        parameters.setExposureCompensation(1);\n        parameters.setSceneMode(Camera.Parameters.SCENE_MODE_AUTO);\n        parameters.setAntibanding(Camera.Parameters.ANTIBANDING_AUTO);\n        camera.setParameters(parameters);\n        camera.autoFocus(autoFocusCallback);\n        Camera.CameraInfo info = new Camera.CameraInfo();\n        Camera.getCameraInfo(cameraID, info);\n        int degrees = 90;//getDisplayRotation(activity);\n        int result;\n        if (info.facing == Camera.CameraInfo.CAMERA_FACING_FRONT) {\n            result = (info.orientation + degrees) % 360;\n            result = (360 - result) % 360; // compensate the mirror\n        } else { // back-facing\n            result = (info.orientation - degrees + 360) % 360;\n        }\n        camera.setDisplayOrientation(result);\n    }\n    public static int getDisplayRotation(Activity activity) {\n        int rotation = activity.getWindowManager().getDefaultDisplay().getRotation();\n        switch (rotation) {\n            case Surface.ROTATION_0: return 0;\n            case Surface.ROTATION_90: return 90;\n            case Surface.ROTATION_180: return 180;\n            case Surface.ROTATION_270: return 270;\n        }\n        return 0;\n    }\n    private static Camera.AutoFocusCallback autoFocusCallback = new Camera.AutoFocusCallback() {\n        @Override\n        public void onAutoFocus(boolean success, Camera camera) {\n            if (success) {\n                camera.cancelAutoFocus();\n                onFocusEnd();\n            }\n        }\n    };\n\n    public static void onFocusEnd() {\n//        mFoucsView.setVisibility(INVISIBLE);\n    }\n\n    private static Size getPreviewSize(){\n        return camera.getParameters().getPreviewSize();\n    }\n\n    private static Size getPictureSize(){\n        return camera.getParameters().getPictureSize();\n    }\n\n    public static void startPreview(SurfaceTexture surfaceTexture){\n        if(camera != null)\n            try {\n                camera.setPreviewTexture(surfaceTexture);\n                CameraEngine.surfaceTexture = surfaceTexture;\n                camera.startPreview();\n            } catch (IOException e) {\n                e.printStackTrace();\n            }\n    }\n\n    public static void startPreview(){\n        if(camera != null)\n            camera.startPreview();\n    }\n\n    public static void stopPreview(){\n        camera.stopPreview();\n    }\n\n    public static void setRotation(int rotation){\n        Camera.Parameters params = camera.getParameters();\n        params.setRotation(rotation);\n        camera.setParameters(params);\n    }\n\n    public static void takePicture(Camera.ShutterCallback shutterCallback, Camera.PictureCallback rawCallback,\n                                   Camera.PictureCallback jpegCallback){\n        camera.takePicture(shutterCallback, rawCallback, jpegCallback);\n    }\n\n    public static com.zero.magicshow.core.camera.utils.CameraInfo getCameraInfo(){\n        if(null == camera){\n            return null;\n        }\n        com.zero.magicshow.core.camera.utils.CameraInfo info = new com.zero.magicshow.core.camera.utils.CameraInfo();\n        Size size = getPreviewSize();\n        CameraInfo cameraInfo = new CameraInfo();\n        Camera.getCameraInfo(cameraID, cameraInfo);\n        info.previewWidth = size.width;\n        info.previewHeight = size.height;\n        info.orientation = cameraInfo.orientation;\n        info.isFront = cameraID == 1 ? true : false;\n        size = getPictureSize();\n        info.pictureWidth = CameraConfig.pictureWidth;\n        info.pictureHeight = CameraConfig.pictureHeight;\n        Log.e(\"HongLi\",\"size.width:\" + size.width + \";size.height:\" + size.height +\n                \";info.previewWidth:\" + info.previewWidth + \";info.previewHeight:\" + info.previewHeight + \";isFront:\" + info.isFront);\n        return info;\n    }\n}"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/core/camera/utils/CameraInfo.java",
    "content": "package com.zero.magicshow.core.camera.utils;\n\n/**\n * Created by why8222 on 2016/2/25.\n */\npublic class CameraInfo {\n\n    public int previewWidth;\n\n    public int previewHeight;\n\n    public int orientation;\n\n    public boolean isFront;\n\n    public int pictureWidth;\n\n    public int pictureHeight;\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/core/camera/utils/CameraUtils.java",
    "content": "package com.zero.magicshow.core.camera.utils;\n\nimport android.hardware.Camera;\n\nimport java.util.List;\n\n/**\n * Created by why8222 on 2016/2/25.\n */\npublic class CameraUtils {\n\n    public static Camera.Size getLargePictureSize(Camera camera){\n        if(camera != null){\n            List<Camera.Size> sizes = camera.getParameters().getSupportedPictureSizes();\n            Camera.Size temp = sizes.get(0);\n            for(int i = 1;i < sizes.size();i ++){\n                float scale = (float)(sizes.get(i).height) / sizes.get(i).width;\n                if(temp.width < sizes.get(i).width && scale < 0.6f && scale > 0.5f)\n                    temp = sizes.get(i);\n            }\n            return temp;\n        }\n        return null;\n    }\n\n    public static Camera.Size getLargePreviewSize(Camera camera){\n        if(camera != null){\n            List<Camera.Size> sizes = camera.getParameters().getSupportedPreviewSizes();\n            Camera.Size temp = sizes.get(0);\n            for(int i = 1;i < sizes.size();i ++){\n                if(temp.width < sizes.get(i).width)\n                    temp = sizes.get(i);\n            }\n            return temp;\n        }\n        return null;\n    }\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/core/encoder/gles/EglCore.java",
    "content": "/*\n * Copyright 2013 Google Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage com.zero.magicshow.core.encoder.gles;\n\nimport android.graphics.SurfaceTexture;\nimport android.opengl.EGL14;\nimport android.opengl.EGLConfig;\nimport android.opengl.EGLContext;\nimport android.opengl.EGLDisplay;\nimport android.opengl.EGLExt;\nimport android.opengl.EGLSurface;\nimport android.util.Log;\nimport android.view.Surface;\n\n/**\n * Core EGL state (display, context, config).\n * <p>\n * The EGLContext must only be attached to one thread at a time.  This class is not thread-safe.\n */\npublic final class EglCore {\n    private static final String TAG = \"EglCore\";\n\n    /**\n     * Constructor flag: surface must be recordable.  This discourages EGL from using a\n     * pixel format that cannot be converted efficiently to something usable by the video\n     * encoder.\n     */\n    public static final int FLAG_RECORDABLE = 0x01;\n\n    /**\n     * Constructor flag: ask for GLES3, fall back to GLES2 if not available.  Without this\n     * flag, GLES2 is used.\n     */\n    public static final int FLAG_TRY_GLES3 = 0x02;\n\n    // Android-specific extension.\n    private static final int EGL_RECORDABLE_ANDROID = 0x3142;\n\n    private EGLDisplay mEGLDisplay = EGL14.EGL_NO_DISPLAY;\n    private EGLContext mEGLContext = EGL14.EGL_NO_CONTEXT;\n    private EGLConfig mEGLConfig = null;\n    private int mGlVersion = -1;\n\n\n    /**\n     * Prepares EGL display and context.\n     * <p>\n     * Equivalent to EglCore(null, 0).\n     */\n    public EglCore() {\n        this(null, 0);\n    }\n\n    /**\n     * Prepares EGL display and context.\n     * <p>\n     * @param sharedContext The context to share, or null if sharing is not desired.\n     * @param flags Configuration bit flags, e.g. FLAG_RECORDABLE.\n     */\n    public EglCore(EGLContext sharedContext, int flags) {\n        if (mEGLDisplay != EGL14.EGL_NO_DISPLAY) {\n            throw new RuntimeException(\"EGL already set up\");\n        }\n\n        if (sharedContext == null) {\n            sharedContext = EGL14.EGL_NO_CONTEXT;\n        }\n\n        mEGLDisplay = EGL14.eglGetDisplay(EGL14.EGL_DEFAULT_DISPLAY);\n        if (mEGLDisplay == EGL14.EGL_NO_DISPLAY) {\n            throw new RuntimeException(\"unable to get EGL14 display\");\n        }\n        int[] version = new int[2];\n        if (!EGL14.eglInitialize(mEGLDisplay, version, 0, version, 1)) {\n            mEGLDisplay = null;\n            throw new RuntimeException(\"unable to initialize EGL14\");\n        }\n\n        // Try to get a GLES3 context, if requested.\n        if ((flags & FLAG_TRY_GLES3) != 0) {\n            //Log.d(TAG, \"Trying GLES 3\");\n            EGLConfig config = getConfig(flags, 3);\n            if (config != null) {\n                int[] attrib3_list = {\n                        EGL14.EGL_CONTEXT_CLIENT_VERSION, 3,\n                        EGL14.EGL_NONE\n                };\n                EGLContext context = EGL14.eglCreateContext(mEGLDisplay, config, sharedContext,\n                        attrib3_list, 0);\n\n                if (EGL14.eglGetError() == EGL14.EGL_SUCCESS) {\n                    //Log.d(TAG, \"Got GLES 3 config\");\n                    mEGLConfig = config;\n                    mEGLContext = context;\n                    mGlVersion = 3;\n                }\n            }\n        }\n        if (mEGLContext == EGL14.EGL_NO_CONTEXT) {  // GLES 2 only, or GLES 3 attempt failed\n            //Log.d(TAG, \"Trying GLES 2\");\n            EGLConfig config = getConfig(flags, 2);\n            if (config == null) {\n                throw new RuntimeException(\"Unable to find a suitable EGLConfig\");\n            }\n            int[] attrib2_list = {\n                    EGL14.EGL_CONTEXT_CLIENT_VERSION, 2,\n                    EGL14.EGL_NONE\n            };\n            EGLContext context = EGL14.eglCreateContext(mEGLDisplay, config, sharedContext,\n                    attrib2_list, 0);\n            checkEglError(\"eglCreateContext\");\n            mEGLConfig = config;\n            mEGLContext = context;\n            mGlVersion = 2;\n        }\n\n        // Confirm with query.\n        int[] values = new int[1];\n        EGL14.eglQueryContext(mEGLDisplay, mEGLContext, EGL14.EGL_CONTEXT_CLIENT_VERSION,\n                values, 0);\n        Log.d(TAG, \"EGLContext created, client version \" + values[0]);\n    }\n\n    /**\n     * Finds a suitable EGLConfig.\n     *\n     * @param flags Bit flags from constructor.\n     * @param version Must be 2 or 3.\n     */\n    private EGLConfig getConfig(int flags, int version) {\n        int renderableType = EGL14.EGL_OPENGL_ES2_BIT;\n        if (version >= 3) {\n            renderableType |= EGLExt.EGL_OPENGL_ES3_BIT_KHR;\n        }\n\n        // The actual surface is generally RGBA or RGBX, so situationally omitting alpha\n        // doesn't really help.  It can also lead to a huge performance hit on glReadPixels()\n        // when reading into a GL_RGBA buffer.\n        int[] attribList = {\n                EGL14.EGL_RED_SIZE, 8,\n                EGL14.EGL_GREEN_SIZE, 8,\n                EGL14.EGL_BLUE_SIZE, 8,\n                EGL14.EGL_ALPHA_SIZE, 8,\n                //EGL14.EGL_DEPTH_SIZE, 16,\n                //EGL14.EGL_STENCIL_SIZE, 8,\n                EGL14.EGL_RENDERABLE_TYPE, renderableType,\n                EGL14.EGL_NONE, 0,      // placeholder for recordable [@-3]\n                EGL14.EGL_NONE\n        };\n        if ((flags & FLAG_RECORDABLE) != 0) {\n            attribList[attribList.length - 3] = EGL_RECORDABLE_ANDROID;\n            attribList[attribList.length - 2] = 1;\n        }\n        EGLConfig[] configs = new EGLConfig[1];\n        int[] numConfigs = new int[1];\n        if (!EGL14.eglChooseConfig(mEGLDisplay, attribList, 0, configs, 0, configs.length,\n                numConfigs, 0)) {\n            Log.w(TAG, \"unable to find RGB8888 / \" + version + \" EGLConfig\");\n            return null;\n        }\n        return configs[0];\n    }\n\n    /**\n     * Discards all resources held by this class, notably the EGL context.  This must be\n     * called from the thread where the context was created.\n     * <p>\n     * On completion, no context will be current.\n     */\n    public void release() {\n        if (mEGLDisplay != EGL14.EGL_NO_DISPLAY) {\n            // Android is unusual in that it uses a reference-counted EGLDisplay.  So for\n            // every eglInitialize() we need an eglTerminate().\n            EGL14.eglMakeCurrent(mEGLDisplay, EGL14.EGL_NO_SURFACE, EGL14.EGL_NO_SURFACE,\n                    EGL14.EGL_NO_CONTEXT);\n            EGL14.eglDestroyContext(mEGLDisplay, mEGLContext);\n            EGL14.eglReleaseThread();\n            EGL14.eglTerminate(mEGLDisplay);\n        }\n\n        mEGLDisplay = EGL14.EGL_NO_DISPLAY;\n        mEGLContext = EGL14.EGL_NO_CONTEXT;\n        mEGLConfig = null;\n    }\n\n    @Override\n    protected void finalize() throws Throwable {\n        try {\n            if (mEGLDisplay != EGL14.EGL_NO_DISPLAY) {\n                // We're limited here -- finalizers don't run on the thread that holds\n                // the EGL state, so if a surface or context is still current on another\n                // thread we can't fully release it here.  Exceptions thrown from here\n                // are quietly discarded.  Complain in the log file.\n                Log.w(TAG, \"WARNING: EglCore was not explicitly released -- state may be leaked\");\n                release();\n            }\n        } finally {\n            super.finalize();\n        }\n    }\n\n    /**\n     * Destroys the specified surface.  Note the EGLSurface won't actually be destroyed if it's\n     * still current in a context.\n     */\n    public void releaseSurface(EGLSurface eglSurface) {\n        EGL14.eglDestroySurface(mEGLDisplay, eglSurface);\n    }\n\n    /**\n     * Creates an EGL surface associated with a Surface.\n     * <p>\n     * If this is destined for MediaCodec, the EGLConfig should have the \"recordable\" attribute.\n     */\n    public EGLSurface createWindowSurface(Object surface) {\n        if (!(surface instanceof Surface) && !(surface instanceof SurfaceTexture)) {\n            throw new RuntimeException(\"invalid surface: \" + surface);\n        }\n\n        // Create a window surface, and attach it to the Surface we received.\n        int[] surfaceAttribs = {\n                EGL14.EGL_NONE\n        };\n        EGLSurface eglSurface = EGL14.eglCreateWindowSurface(mEGLDisplay, mEGLConfig, surface,\n                surfaceAttribs, 0);\n        checkEglError(\"eglCreateWindowSurface\");\n        if (eglSurface == null) {\n            throw new RuntimeException(\"surface was null\");\n        }\n        return eglSurface;\n    }\n\n    /**\n     * Creates an EGL surface associated with an offscreen buffer.\n     */\n    public EGLSurface createOffscreenSurface(int width, int height) {\n        int[] surfaceAttribs = {\n                EGL14.EGL_WIDTH, width,\n                EGL14.EGL_HEIGHT, height,\n                EGL14.EGL_NONE\n        };\n        EGLSurface eglSurface = EGL14.eglCreatePbufferSurface(mEGLDisplay, mEGLConfig,\n                surfaceAttribs, 0);\n        checkEglError(\"eglCreatePbufferSurface\");\n        if (eglSurface == null) {\n            throw new RuntimeException(\"surface was null\");\n        }\n        return eglSurface;\n    }\n\n    /**\n     * Makes our EGL context current, using the supplied surface for both \"draw\" and \"read\".\n     */\n    public void makeCurrent(EGLSurface eglSurface) {\n        if (mEGLDisplay == EGL14.EGL_NO_DISPLAY) {\n            // called makeCurrent() before create?\n            Log.d(TAG, \"NOTE: makeCurrent w/o display\");\n        }\n        if (!EGL14.eglMakeCurrent(mEGLDisplay, eglSurface, eglSurface, mEGLContext)) {\n            throw new RuntimeException(\"eglMakeCurrent failed\");\n        }\n    }\n\n    /**\n     * Makes our EGL context current, using the supplied \"draw\" and \"read\" surfaces.\n     */\n    public void makeCurrent(EGLSurface drawSurface, EGLSurface readSurface) {\n        if (mEGLDisplay == EGL14.EGL_NO_DISPLAY) {\n            // called makeCurrent() before create?\n            Log.d(TAG, \"NOTE: makeCurrent w/o display\");\n        }\n        if (!EGL14.eglMakeCurrent(mEGLDisplay, drawSurface, readSurface, mEGLContext)) {\n            throw new RuntimeException(\"eglMakeCurrent(draw,read) failed\");\n        }\n    }\n\n    /**\n     * Makes no context current.\n     */\n    public void makeNothingCurrent() {\n        if (!EGL14.eglMakeCurrent(mEGLDisplay, EGL14.EGL_NO_SURFACE, EGL14.EGL_NO_SURFACE,\n                EGL14.EGL_NO_CONTEXT)) {\n            throw new RuntimeException(\"eglMakeCurrent failed\");\n        }\n    }\n\n    /**\n     * Calls eglSwapBuffers.  Use this to \"publish\" the current frame.\n     *\n     * @return false on failure\n     */\n    public boolean swapBuffers(EGLSurface eglSurface) {\n        return EGL14.eglSwapBuffers(mEGLDisplay, eglSurface);\n    }\n\n    /**\n     * Sends the presentation time stamp to EGL.  Time is expressed in nanoseconds.\n     */\n    public void setPresentationTime(EGLSurface eglSurface, long nsecs) {\n        EGLExt.eglPresentationTimeANDROID(mEGLDisplay, eglSurface, nsecs);\n    }\n\n    /**\n     * Returns true if our context and the specified surface are current.\n     */\n    public boolean isCurrent(EGLSurface eglSurface) {\n        return mEGLContext.equals(EGL14.eglGetCurrentContext()) &&\n            eglSurface.equals(EGL14.eglGetCurrentSurface(EGL14.EGL_DRAW));\n    }\n\n    /**\n     * Performs a simple surface query.\n     */\n    public int querySurface(EGLSurface eglSurface, int what) {\n        int[] value = new int[1];\n        EGL14.eglQuerySurface(mEGLDisplay, eglSurface, what, value, 0);\n        return value[0];\n    }\n\n    /**\n     * Queries a string value.\n     */\n    public String queryString(int what) {\n        return EGL14.eglQueryString(mEGLDisplay, what);\n    }\n\n    /**\n     * Returns the GLES version this context is configured for (currently 2 or 3).\n     */\n    public int getGlVersion() {\n        return mGlVersion;\n    }\n\n    /**\n     * Writes the current display, context, and surface to the log.\n     */\n    public static void logCurrent(String msg) {\n        EGLDisplay display;\n        EGLContext context;\n        EGLSurface surface;\n\n        display = EGL14.eglGetCurrentDisplay();\n        context = EGL14.eglGetCurrentContext();\n        surface = EGL14.eglGetCurrentSurface(EGL14.EGL_DRAW);\n        Log.i(TAG, \"Current EGL (\" + msg + \"): display=\" + display + \", context=\" + context +\n                \", surface=\" + surface);\n    }\n\n    /**\n     * Checks for EGL errors.  Throws an exception if an error has been raised.\n     */\n    private void checkEglError(String msg) {\n        int error;\n        if ((error = EGL14.eglGetError()) != EGL14.EGL_SUCCESS) {\n            throw new RuntimeException(msg + \": EGL error: 0x\" + Integer.toHexString(error));\n        }\n    }\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/core/encoder/gles/EglSurfaceBase.java",
    "content": "/*\n * Copyright 2013 Google Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage com.zero.magicshow.core.encoder.gles;\n\nimport android.graphics.Bitmap;\nimport android.opengl.EGL14;\nimport android.opengl.EGLSurface;\nimport android.opengl.GLES20;\nimport android.util.Log;\n\nimport com.zero.magicshow.common.utils.OpenGlUtils;\n\nimport java.io.BufferedOutputStream;\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.nio.IntBuffer;\n\n/**\n * Common base class for EGL surfaces.\n * <p>\n * There can be multiple surfaces associated with a single context.\n */\npublic class EglSurfaceBase {\n    protected static final String TAG = \"EglSurfaceBase\";\n\n    // EglCore object we're associated with.  It may be associated with multiple surfaces.\n    protected EglCore mEglCore;\n\n    private EGLSurface mEGLSurface = EGL14.EGL_NO_SURFACE;\n    protected int mWidth = -1;\n    protected int mHeight = -1;\n\n    protected EglSurfaceBase(EglCore eglCore) {\n        mEglCore = eglCore;\n    }\n\n    /**\n     * Creates a window surface.\n     * <p>\n     * @param surface May be a Surface or SurfaceTexture.\n     */\n    public void createWindowSurface(Object surface) {\n        if (mEGLSurface != EGL14.EGL_NO_SURFACE) {\n            throw new IllegalStateException(\"surface already created\");\n        }\n        mEGLSurface = mEglCore.createWindowSurface(surface);\n\n        // Don't cache width/height here, because the size of the underlying surface can change\n        // out from under us (see e.g. HardwareScalerActivity).\n        //mWidth = mEglCore.querySurface(mEGLSurface, EGL14.EGL_WIDTH);\n        //mHeight = mEglCore.querySurface(mEGLSurface, EGL14.EGL_HEIGHT);\n    }\n\n    /**\n     * Creates an off-screen surface.\n     */\n    public void createOffscreenSurface(int width, int height) {\n        if (mEGLSurface != EGL14.EGL_NO_SURFACE) {\n            throw new IllegalStateException(\"surface already created\");\n        }\n        mEGLSurface = mEglCore.createOffscreenSurface(width, height);\n        mWidth = width;\n        mHeight = height;\n    }\n\n    /**\n     * Returns the surface's width, in pixels.\n     * <p>\n     * If this is called on a window surface, and the underlying surface is in the process\n     * of changing size, we may not see the new size right away (e.g. in the \"surfaceChanged\"\n     * callback).  The size should match after the next buffer swap.\n     */\n    public int getWidth() {\n        if (mWidth < 0) {\n            return mEglCore.querySurface(mEGLSurface, EGL14.EGL_WIDTH);\n        } else {\n            return mWidth;\n        }\n    }\n\n    /**\n     * Returns the surface's height, in pixels.\n     */\n    public int getHeight() {\n        if (mHeight < 0) {\n            return mEglCore.querySurface(mEGLSurface, EGL14.EGL_HEIGHT);\n        } else {\n            return mHeight;\n        }\n    }\n\n    /**\n     * Release the EGL surface.\n     */\n    public void releaseEglSurface() {\n        mEglCore.releaseSurface(mEGLSurface);\n        mEGLSurface = EGL14.EGL_NO_SURFACE;\n        mWidth = mHeight = -1;\n    }\n\n    /**\n     * Makes our EGL context and surface current.\n     */\n    public void makeCurrent() {\n        mEglCore.makeCurrent(mEGLSurface);\n    }\n\n    /**\n     * Makes our EGL context and surface current for drawing, using the supplied surface\n     * for reading.\n     */\n    public void makeCurrentReadFrom(EglSurfaceBase readSurface) {\n        mEglCore.makeCurrent(mEGLSurface, readSurface.mEGLSurface);\n    }\n\n    /**\n     * Calls eglSwapBuffers.  Use this to \"publish\" the current frame.\n     *\n     * @return false on failure\n     */\n    public boolean swapBuffers() {\n        boolean result = mEglCore.swapBuffers(mEGLSurface);\n        if (!result) {\n            Log.d(TAG, \"WARNING: swapBuffers() failed\");\n        }\n        return result;\n    }\n\n    /**\n     * Sends the presentation time stamp to EGL.\n     *\n     * @param nsecs Timestamp, in nanoseconds.\n     */\n    public void setPresentationTime(long nsecs) {\n        mEglCore.setPresentationTime(mEGLSurface, nsecs);\n    }\n\n    /**\n     * Saves the EGL surface to a file.\n     * <p>\n     * Expects that this object's EGL surface is current.\n     */\n    public void saveFrame(File file) throws IOException {\n        if (!mEglCore.isCurrent(mEGLSurface)) {\n            throw new RuntimeException(\"Expected EGL context/surface is not current\");\n        }\n\n        // glReadPixels fills in a \"direct\" ByteBuffer with what is essentially big-endian RGBA\n        // data (i.e. a byte of red, followed by a byte of green...).  While the Bitmap\n        // constructor that takes an int[] wants little-endian ARGB (blue/red swapped), the\n        // Bitmap \"copy pixels\" method wants the same format GL provides.\n        //\n        // Ideally we'd have some way to re-use the ByteBuffer, especially if we're calling\n        // here often.\n        //\n        // Making this even more interesting is the upside-down nature of GL, which means\n        // our output will look upside down relative to what appears on screen if the\n        // typical GL conventions are used.\n\n        String filename = file.toString();\n\n        int width = getWidth();\n        int height = getHeight();\n        IntBuffer ib = IntBuffer.allocate(width * height);\n        GLES20.glReadPixels(0, 0, width, height, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, ib);\n        OpenGlUtils.checkGlError(\"glReadPixels\");\n\n        BufferedOutputStream bos = null;\n        try {\n            bos = new BufferedOutputStream(new FileOutputStream(filename));\n            Bitmap bmp = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);\n            bmp.copyPixelsFromBuffer(IntBuffer.wrap(ib.array()));\n            bmp.compress(Bitmap.CompressFormat.PNG, 90, bos);\n            bmp.recycle();\n        } finally {\n            if (bos != null) bos.close();\n        }\n        Log.d(TAG, \"Saved \" + width + \"x\" + height + \" frame as '\" + filename + \"'\");\n    }\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/core/encoder/video/TextureMovieEncoder.java",
    "content": "/*\n * Copyright 2013 Google Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage com.zero.magicshow.core.encoder.video;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.lang.ref.WeakReference;\nimport java.nio.FloatBuffer;\n\nimport android.graphics.SurfaceTexture;\nimport android.opengl.EGLContext;\nimport android.os.Handler;\nimport android.os.Looper;\nimport android.os.Message;\nimport android.util.Log;\n\nimport com.zero.magicshow.core.camera.utils.CameraInfo;\nimport com.zero.magicshow.core.filter.base.MagicCameraInputFilter;\nimport com.zero.magicshow.core.filter.base.gpuimage.GPUImageFilter;\nimport com.zero.magicshow.core.filter.utils.MagicFilterFactory;\nimport com.zero.magicshow.core.filter.utils.MagicFilterType;\nimport com.zero.magicshow.core.encoder.gles.EglCore;\n\n/**\n * Encode a movie from frames rendered from an external texture image.\n * <p>\n * The object wraps an encoder running on a dedicated thread.  The various control messages\n * may be sent from arbitrary threads (typically the app UI thread).  The encoder thread\n * manages both sides of the encoder (feeding and draining); the only external input is\n * the GL texture.\n * <p>\n * The design is complicated slightly by the need to create an EGL context that shares state\n * with a view that gets restarted if (say) the device orientation changes.  When the view\n * in question is a GLSurfaceView, we don't have full control over the EGL context creation\n * on that side, so we have to bend a bit backwards here.\n * <p>\n * To use:\n * <ul>\n * <li>create TextureMovieEncoder object\n * <li>create an EncoderConfig\n * <li>call TextureMovieEncoder#startRecording() with the config\n * <li>call TextureMovieEncoder#setTextureId() with the texture object that receives frames\n * <li>for each frame, after latching it with SurfaceTexture#updateTexImage(),\n *     call TextureMovieEncoder#frameAvailable().\n * </ul>\n *\n * TODO: tweak the API (esp. textureId) so it's less awkward for simple use cases.\n */\npublic class TextureMovieEncoder implements Runnable {\n    private static final String TAG = \"\";\n    private static final boolean VERBOSE = false;\n\n    private static final int MSG_START_RECORDING = 0;\n    private static final int MSG_STOP_RECORDING = 1;\n    private static final int MSG_FRAME_AVAILABLE = 2;\n    private static final int MSG_SET_TEXTURE_ID = 3;\n    private static final int MSG_UPDATE_SHARED_CONTEXT = 4;\n    private static final int MSG_QUIT = 5;\n\n    // ----- accessed exclusively by encoder thread -----\n    private WindowSurface mInputWindowSurface;\n    private EglCore mEglCore;\n    private MagicCameraInputFilter mInput;\n    private int mTextureId;\n\n    private VideoEncoderCore mVideoEncoder;\n\n    // ----- accessed by multiple threads -----\n    private volatile EncoderHandler mHandler;\n\n    private Object mReadyFence = new Object();      // guards ready/running\n    private boolean mReady;\n    private boolean mRunning;\n    private GPUImageFilter filter;\n    private FloatBuffer gLCubeBuffer;\n    private FloatBuffer gLTextureBuffer;\n\n    public TextureMovieEncoder() {\n\n    }\n\n    /**\n     * Encoder configuration.\n     * <p>\n     * Object is immutable, which means we can safely pass it between threads without\n     * explicit synchronization (and don't need to worry about it getting tweaked out from\n     * under us).\n     * <p>\n     * TODO: make frame rate and iframe interval configurable?  Maybe use builder pattern\n     *       with reasonable defaults for those and bit rate.\n     */\n    public static class EncoderConfig {\n        final File mOutputFile;\n        final int mWidth;\n        final int mHeight;\n        final int mBitRate;\n        final EGLContext mEglContext;\n\n        public EncoderConfig(File outputFile, int width, int height, int bitRate,\n                EGLContext sharedEglContext, CameraInfo info) {\n            mOutputFile = outputFile;\n            mWidth = width;\n            mHeight = height;\n            mBitRate = bitRate;\n            mEglContext = sharedEglContext;\n        }\n\n        @Override\n        public String toString() {\n            return \"EncoderConfig: \" + mWidth + \"x\" + mHeight + \" @\" + mBitRate +\n                    \" to '\" + mOutputFile.toString() + \"' ctxt=\" + mEglContext;\n        }\n    }\n\n    /**\n     * Tells the video recorder to start recording.  (Call from non-encoder thread.)\n     * <p>\n     * Creates a new thread, which will create an encoder using the provided configuration.\n     * <p>\n     * Returns after the recorder thread has started and is ready to accept Messages.  The\n     * encoder may not yet be fully configured.\n     */\n    public void startRecording(EncoderConfig config) {\n        Log.d(TAG, \"Encoder: startRecording()\");\n        synchronized (mReadyFence) {\n            if (mRunning) {\n                Log.w(TAG, \"Encoder thread already running\");\n                return;\n            }\n            mRunning = true;\n            new Thread(this, \"TextureMovieEncoder\").start();\n            while (!mReady) {\n                try {\n                    mReadyFence.wait();\n                } catch (InterruptedException ie) {\n                    // ignore\n                }\n            }\n        }\n\n        mHandler.sendMessage(mHandler.obtainMessage(MSG_START_RECORDING, config));\n    }\n\n    /**\n     * Tells the video recorder to stop recording.  (Call from non-encoder thread.)\n     * <p>\n     * Returns immediately; the encoder/muxer may not yet be finished creating the movie.\n     * <p>\n     * TODO: have the encoder thread invoke a callback on the UI thread just before it shuts down\n     * so we can provide reasonable status UI (and let the caller know that movie encoding\n     * has completed).\n     */\n    public void stopRecording() {\n        mHandler.sendMessage(mHandler.obtainMessage(MSG_STOP_RECORDING));\n        mHandler.sendMessage(mHandler.obtainMessage(MSG_QUIT));\n        // We don't know when these will actually finish (or even start).  We don't want to\n        // delay the UI thread though, so we return immediately.\n    }\n\n    /**\n     * Returns true if recording has been started.\n     */\n    public boolean isRecording() {\n        synchronized (mReadyFence) {\n            return mRunning;\n        }\n    }\n\n    /**\n     * Tells the video recorder to refresh its EGL surface.  (Call from non-encoder thread.)\n     */\n    public void updateSharedContext(EGLContext sharedContext) {\n        mHandler.sendMessage(mHandler.obtainMessage(MSG_UPDATE_SHARED_CONTEXT, sharedContext));\n    }\n\n    /**\n     * Tells the video recorder that a new frame is available.  (Call from non-encoder thread.)\n     * <p>\n     * This function sends a message and returns immediately.  This isn't sufficient -- we\n     * don't want the caller to latch a new frame until we're done with this one -- but we\n     * can get away with it so long as the input frame rate is reasonable and the encoder\n     * thread doesn't stall.\n     * <p>\n     * TODO: either block here until the texture has been rendered onto the encoder surface,\n     * or have a separate \"block if still busy\" method that the caller can execute immediately\n     * before it calls updateTexImage().  The latter is preferred because we don't want to\n     * stall the caller while this thread does work.\n     */\n    public void frameAvailable(SurfaceTexture st) {\n        synchronized (mReadyFence) {\n            if (!mReady) {\n                return;\n            }\n        }\n\n        float[] transform = new float[16];      // TODO - avoid alloc every frame\n        st.getTransformMatrix(transform);\n        long timestamp = st.getTimestamp();\n        if (timestamp == 0) {\n            // Seeing this after device is toggled off/on with power button.  The\n            // first frame back has a zero timestamp.\n            //\n            // MPEG4Writer thinks this is cause to abort() in native code, so it's very\n            // important that we just ignore the frame.\n            Log.w(TAG, \"HEY: got SurfaceTexture with timestamp of zero\");\n            return;\n        }\n\n        mHandler.sendMessage(mHandler.obtainMessage(MSG_FRAME_AVAILABLE,\n                (int) (timestamp >> 32), (int) timestamp, transform));\n    }\n\n    /**\n     * Tells the video recorder what texture name to use.  This is the external texture that\n     * we're receiving camera previews in.  (Call from non-encoder thread.)\n     * <p>\n     * TODO: do something less clumsy\n     */\n    public void setTextureId(int id) {\n        synchronized (mReadyFence) {\n            if (!mReady) {\n                return;\n            }\n        }\n        mHandler.sendMessage(mHandler.obtainMessage(MSG_SET_TEXTURE_ID, id, 0, null));\n    }\n\n    /**\n     * Encoder thread entry point.  Establishes Looper/Handler and waits for messages.\n     * <p>\n     * @see Thread#run()\n     */\n    @Override\n    public void run() {\n        // Establish a Looper for this thread, and define a Handler for it.\n        Looper.prepare();\n        synchronized (mReadyFence) {\n            mHandler = new EncoderHandler(this);\n            mReady = true;\n            mReadyFence.notify();\n        }\n        Looper.loop();\n\n        Log.d(TAG, \"Encoder thread exiting\");\n        synchronized (mReadyFence) {\n            mReady = mRunning = false;\n            mHandler = null;\n        }\n    }\n\n\n    /**\n     * Handles encoder state change requests.  The handler is created on the encoder thread.\n     */\n    private static class EncoderHandler extends Handler {\n        private WeakReference<TextureMovieEncoder> mWeakEncoder;\n\n        public EncoderHandler(TextureMovieEncoder encoder) {\n            mWeakEncoder = new WeakReference<TextureMovieEncoder>(encoder);\n        }\n\n        @Override  // runs on encoder thread\n        public void handleMessage(Message inputMessage) {\n            int what = inputMessage.what;\n            Object obj = inputMessage.obj;\n\n            TextureMovieEncoder encoder = mWeakEncoder.get();\n            if (encoder == null) {\n                Log.w(TAG, \"EncoderHandler.handleMessage: encoder is null\");\n                return;\n            }\n\n            switch (what) {\n                case MSG_START_RECORDING:\n                    encoder.handleStartRecording((EncoderConfig) obj);\n                    break;\n                case MSG_STOP_RECORDING:\n                    encoder.handleStopRecording();\n                    break;\n                case MSG_FRAME_AVAILABLE:\n                    long timestamp = (((long) inputMessage.arg1) << 32) |\n                            (((long) inputMessage.arg2) & 0xffffffffL);\n                    encoder.handleFrameAvailable((float[]) obj, timestamp);\n                    break;\n                case MSG_SET_TEXTURE_ID:\n                    encoder.handleSetTexture(inputMessage.arg1);\n                    break;\n                case MSG_UPDATE_SHARED_CONTEXT:\n                    encoder.handleUpdateSharedContext((EGLContext) inputMessage.obj);\n                    break;\n                case MSG_QUIT:\n                    Looper.myLooper().quit();\n                    break;\n                default:\n                    throw new RuntimeException(\"Unhandled msg what=\" + what);\n            }\n        }\n    }\n\n    /**\n     * Starts recording.\n     */\n    private void handleStartRecording(EncoderConfig config) {\n        Log.d(TAG, \"handleStartRecording \" + config);\n        prepareEncoder(config.mEglContext, config.mWidth, config.mHeight, config.mBitRate,\n                config.mOutputFile);\n    }\n\n    /**\n     * Handles notification of an available frame.\n     * <p>\n     * The texture is rendered onto the encoder's input surface, along with a moving\n     * box (just because we can).\n     * <p>\n     * @param transform The texture transform, from SurfaceTexture.\n     * @param timestampNanos The frame's timestamp, from SurfaceTexture.\n     */\n    private void handleFrameAvailable(float[] transform, long timestampNanos) {\n        if (VERBOSE) Log.d(TAG, \"handleFrameAvailable tr=\" + transform);\n        mVideoEncoder.drainEncoder(false);\n        mInput.setTextureTransformMatrix(transform);\n        if(filter == null) {\n            mInput.onDrawFrame(mTextureId, gLCubeBuffer, gLTextureBuffer);\n        }else {\n            filter.onDrawFrame(mTextureId, gLCubeBuffer, gLTextureBuffer);\n        }\n\n        mInputWindowSurface.setPresentationTime(timestampNanos);\n        mInputWindowSurface.swapBuffers();\n    }\n\n    /**\n     * Handles a request to stop encoding.\n     */\n    private void handleStopRecording() {\n        Log.d(TAG, \"handleStopRecording\");\n        mVideoEncoder.drainEncoder(true);\n        releaseEncoder();\n    }\n\n    /**\n     * Sets the texture name that SurfaceTexture will use when frames are received.\n     */\n    private void handleSetTexture(int id) {\n        //Log.d(TAG, \"handleSetTexture \" + id);\n        mTextureId = id;\n    }\n\n    /**\n     * Tears down the EGL surface and context we've been using to feed the MediaCodec input\n     * surface, and replaces it with a new one that shares with the new context.\n     * <p>\n     * This is useful if the old context we were sharing with went away (maybe a GLSurfaceView\n     * that got torn down) and we need to hook up with the new one.\n     */\n    private void handleUpdateSharedContext(EGLContext newSharedContext) {\n        Log.d(TAG, \"handleUpdatedSharedContext \" + newSharedContext);\n\n        // Release the EGLSurface and EGLContext.\n        mInputWindowSurface.releaseEglSurface();\n        mInput.destroy();\n        mEglCore.release();\n\n        // Create a new EGLContext and recreate the window surface.\n        mEglCore = new EglCore(newSharedContext, EglCore.FLAG_RECORDABLE);\n        mInputWindowSurface.recreate(mEglCore);\n        mInputWindowSurface.makeCurrent();\n\n        // Create new programs and such for the new context.\n        mInput = new MagicCameraInputFilter();\n        mInput.init();\n        filter = MagicFilterFactory.initFilters(type);\n        if(filter != null){\n            filter.init();\n            filter.onInputSizeChanged(mPreviewWidth, mPreviewHeight);\n            filter.onDisplaySizeChanged(mVideoWidth, mVideoHeight);\n        }\n    }\n\n    private void prepareEncoder(EGLContext sharedContext, int width, int height, int bitRate,\n            File outputFile) {\n        try {\n            mVideoEncoder = new VideoEncoderCore(width, height, bitRate, outputFile);\n        } catch (IOException ioe) {\n            throw new RuntimeException(ioe);\n        }\n        mVideoWidth = width;\n        mVideoHeight = height;\n        mEglCore = new EglCore(sharedContext, EglCore.FLAG_RECORDABLE);\n        mInputWindowSurface = new WindowSurface(mEglCore, mVideoEncoder.getInputSurface(), true);\n        mInputWindowSurface.makeCurrent();\n\n        mInput = new MagicCameraInputFilter();\n        mInput.init();\n        filter = MagicFilterFactory.initFilters(type);\n        if(filter != null){\n            filter.init();\n            filter.onInputSizeChanged(mPreviewWidth, mPreviewHeight);\n            filter.onDisplaySizeChanged(mVideoWidth, mVideoHeight);\n        }\n    }\n\n    private void releaseEncoder() {\n        mVideoEncoder.release();\n        if (mInputWindowSurface != null) {\n            mInputWindowSurface.release();\n            mInputWindowSurface = null;\n        }\n        if (mInput != null) {\n            mInput.destroy();\n            mInput = null;\n        }\n        if (mEglCore != null) {\n            mEglCore.release();\n            mEglCore = null;\n        }\n        if(filter != null){\n            filter.destroy();\n            filter = null;\n            type = MagicFilterType.NONE;\n        }\n    }\n    private MagicFilterType type = MagicFilterType.NONE;\n    public void setFilter(MagicFilterType type) {\n        this.type = type;\n    }\n\n    private int mPreviewWidth = -1;\n    private int mPreviewHeight = -1;\n    private int mVideoWidth = -1;\n    private int mVideoHeight = -1;\n\n    public void setPreviewSize(int width, int height){\n        mPreviewWidth = width;\n        mPreviewHeight = height;\n    }\n\n    public void setTextureBuffer(FloatBuffer gLTextureBuffer) {\n        this.gLTextureBuffer = gLTextureBuffer;\n    }\n\n    public void setCubeBuffer(FloatBuffer gLCubeBuffer) {\n        this.gLCubeBuffer = gLCubeBuffer;\n    }\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/core/encoder/video/VideoEncoderCore.java",
    "content": "/*\n * Copyright 2014 Google Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage com.zero.magicshow.core.encoder.video;\n\nimport android.media.MediaCodec;\nimport android.media.MediaCodecInfo;\nimport android.media.MediaFormat;\nimport android.media.MediaMuxer;\nimport android.util.Log;\nimport android.view.Surface;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.nio.ByteBuffer;\n\n/**\n * This class wraps up the core components used for surface-input video encoding.\n * <p>\n * Once created, frames are fed to the input surface.  Remember to provide the presentation\n * time stamp, and always call drainEncoder() before swapBuffers() to ensure that the\n * producer side doesn't get backed up.\n * <p>\n * This class is not thread-safe, with one exception: it is valid to use the input surface\n * on one thread, and drain the output on a different thread.\n */\npublic class VideoEncoderCore {\n    private static final String TAG = \"VideoEncoderCore\";\n    private static final boolean VERBOSE = false;\n\n    // TODO: these ought to be configurable as well\n    private static final String MIME_TYPE = \"video/avc\";    // H.264 Advanced Video Coding\n    private static final int FRAME_RATE = 30;               // 30fps\n    private static final int IFRAME_INTERVAL = 5;           // 5 seconds between I-frames\n\n    private Surface mInputSurface;\n    private MediaMuxer mMuxer;\n    private MediaCodec mEncoder;\n    private MediaCodec.BufferInfo mBufferInfo;\n    private int mTrackIndex;\n    private boolean mMuxerStarted;\n\n\n    /**\n     * Configures encoder and muxer state, and prepares the input Surface.\n     */\n    public VideoEncoderCore(int width, int height, int bitRate, File outputFile)\n            throws IOException {\n        mBufferInfo = new MediaCodec.BufferInfo();\n\n        MediaFormat format = MediaFormat.createVideoFormat(MIME_TYPE, width, height);\n\n        // Set some properties.  Failing to specify some of these can cause the MediaCodec\n        // configure() call to throw an unhelpful exception.\n        format.setInteger(MediaFormat.KEY_COLOR_FORMAT,\n                MediaCodecInfo.CodecCapabilities.COLOR_FormatSurface);\n        format.setInteger(MediaFormat.KEY_BIT_RATE, bitRate);\n        format.setInteger(MediaFormat.KEY_FRAME_RATE, FRAME_RATE);\n        format.setInteger(MediaFormat.KEY_I_FRAME_INTERVAL, IFRAME_INTERVAL);\n        if (VERBOSE) Log.d(TAG, \"format: \" + format);\n\n        // Create a MediaCodec encoder, and configure it with our format.  Get a Surface\n        // we can use for input and wrap it with a class that handles the EGL work.\n        mEncoder = MediaCodec.createEncoderByType(MIME_TYPE);\n        mEncoder.configure(format, null, null, MediaCodec.CONFIGURE_FLAG_ENCODE);\n        mInputSurface = mEncoder.createInputSurface();\n        mEncoder.start();\n\n        // Create a MediaMuxer.  We can't add the video track and start() the muxer here,\n        // because our MediaFormat doesn't have the Magic Goodies.  These can only be\n        // obtained from the encoder after it has started processing data.\n        //\n        // We're not actually interested in multiplexing audio.  We just want to convert\n        // the raw H.264 elementary stream we get from MediaCodec into a .mp4 file.\n        mMuxer = new MediaMuxer(outputFile.toString(),\n                MediaMuxer.OutputFormat.MUXER_OUTPUT_MPEG_4);\n\n        mTrackIndex = -1;\n        mMuxerStarted = false;\n    }\n\n    /**\n     * Returns the encoder's input surface.\n     */\n    public Surface getInputSurface() {\n        return mInputSurface;\n    }\n\n    /**\n     * Releases encoder resources.\n     */\n    public void release() {\n        if (VERBOSE) Log.d(TAG, \"releasing encoder objects\");\n        if (mEncoder != null) {\n            mEncoder.stop();\n            mEncoder.release();\n            mEncoder = null;\n        }\n        if (mMuxer != null) {\n            // TODO: stop() throws an exception if you haven't fed it any data.  Keep track\n            //       of frames submitted, and don't call stop() if we haven't written anything.\n            mMuxer.stop();\n            mMuxer.release();\n            mMuxer = null;\n        }\n    }\n\n    /**\n     * Extracts all pending data from the encoder and forwards it to the muxer.\n     * <p>\n     * If endOfStream is not set, this returns when there is no more data to drain.  If it\n     * is set, we send EOS to the encoder, and then iterate until we see EOS on the output.\n     * Calling this with endOfStream set should be done once, right before stopping the muxer.\n     * <p>\n     * We're just using the muxer to get a .mp4 file (instead of a raw H.264 stream).  We're\n     * not recording audio.\n     */\n    public void drainEncoder(boolean endOfStream) {\n        final int TIMEOUT_USEC = 10000;\n        if (VERBOSE) Log.d(TAG, \"drainEncoder(\" + endOfStream + \")\");\n\n        if (endOfStream) {\n            if (VERBOSE) Log.d(TAG, \"sending EOS to encoder\");\n            mEncoder.signalEndOfInputStream();\n        }\n\n        ByteBuffer[] encoderOutputBuffers = mEncoder.getOutputBuffers();\n        while (true) {\n            int encoderStatus = mEncoder.dequeueOutputBuffer(mBufferInfo, TIMEOUT_USEC);\n            if (encoderStatus == MediaCodec.INFO_TRY_AGAIN_LATER) {\n                // no output available yet\n                if (!endOfStream) {\n                    break;      // out of while\n                } else {\n                    if (VERBOSE) Log.d(TAG, \"no output available, spinning to await EOS\");\n                }\n            } else if (encoderStatus == MediaCodec.INFO_OUTPUT_BUFFERS_CHANGED) {\n                // not expected for an encoder\n                encoderOutputBuffers = mEncoder.getOutputBuffers();\n            } else if (encoderStatus == MediaCodec.INFO_OUTPUT_FORMAT_CHANGED) {\n                // should happen before receiving buffers, and should only happen once\n                if (mMuxerStarted) {\n                    throw new RuntimeException(\"format changed twice\");\n                }\n                MediaFormat newFormat = mEncoder.getOutputFormat();\n                Log.d(TAG, \"encoder output format changed: \" + newFormat);\n\n                // now that we have the Magic Goodies, start the muxer\n                mTrackIndex = mMuxer.addTrack(newFormat);\n                mMuxer.start();\n                mMuxerStarted = true;\n            } else if (encoderStatus < 0) {\n                Log.w(TAG, \"unexpected result from encoder.dequeueOutputBuffer: \" +\n                        encoderStatus);\n                // let's ignore it\n            } else {\n                ByteBuffer encodedData = encoderOutputBuffers[encoderStatus];\n                if (encodedData == null) {\n                    throw new RuntimeException(\"encoderOutputBuffer \" + encoderStatus +\n                            \" was null\");\n                }\n\n                if ((mBufferInfo.flags & MediaCodec.BUFFER_FLAG_CODEC_CONFIG) != 0) {\n                    // The codec config data was pulled out and fed to the muxer when we got\n                    // the INFO_OUTPUT_FORMAT_CHANGED status.  Ignore it.\n                    if (VERBOSE) Log.d(TAG, \"ignoring BUFFER_FLAG_CODEC_CONFIG\");\n                    mBufferInfo.size = 0;\n                }\n\n                if (mBufferInfo.size != 0) {\n                    if (!mMuxerStarted) {\n                        throw new RuntimeException(\"muxer hasn't started\");\n                    }\n\n                    // adjust the ByteBuffer values to match BufferInfo (not needed?)\n                    encodedData.position(mBufferInfo.offset);\n                    encodedData.limit(mBufferInfo.offset + mBufferInfo.size);\n\n                    mMuxer.writeSampleData(mTrackIndex, encodedData, mBufferInfo);\n                    if (VERBOSE) {\n                        Log.d(TAG, \"sent \" + mBufferInfo.size + \" bytes to muxer, ts=\" +\n                                mBufferInfo.presentationTimeUs);\n                    }\n                }\n\n                mEncoder.releaseOutputBuffer(encoderStatus, false);\n\n                if ((mBufferInfo.flags & MediaCodec.BUFFER_FLAG_END_OF_STREAM) != 0) {\n                    if (!endOfStream) {\n                        Log.w(TAG, \"reached end of stream unexpectedly\");\n                    } else {\n                        if (VERBOSE) Log.d(TAG, \"end of stream reached\");\n                    }\n                    break;      // out of while\n                }\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/core/encoder/video/WindowSurface.java",
    "content": "/*\n * Copyright 2013 Google Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage com.zero.magicshow.core.encoder.video;\n\nimport android.graphics.SurfaceTexture;\nimport android.view.Surface;\n\nimport com.zero.magicshow.core.encoder.gles.EglCore;\nimport com.zero.magicshow.core.encoder.gles.EglSurfaceBase;\n\n/**\n * Recordable EGL window surface.\n * <p>\n * It's good practice to explicitly release() the surface, preferably from a \"finally\" block.\n */\npublic class WindowSurface extends EglSurfaceBase {\n    private Surface mSurface;\n    private boolean mReleaseSurface;\n\n    /**\n     * Associates an EGL surface with the native window surface.\n     * <p>\n     * Set releaseSurface to true if you want the Surface to be released when release() is\n     * called.  This is convenient, but can interfere with framework classes that expect to\n     * manage the Surface themselves (e.g. if you release a SurfaceView's Surface, the\n     * surfaceDestroyed() callback won't fire).\n     */\n    public WindowSurface(EglCore eglCore, Surface surface, boolean releaseSurface) {\n        super(eglCore);\n        createWindowSurface(surface);\n        mSurface = surface;\n        mReleaseSurface = releaseSurface;\n    }\n\n    /**\n     * Associates an EGL surface with the SurfaceTexture.\n     */\n    public WindowSurface(EglCore eglCore, SurfaceTexture surfaceTexture) {\n        super(eglCore);\n        createWindowSurface(surfaceTexture);\n    }\n\n    /**\n     * Releases any resources associated with the EGL surface (and, if configured to do so,\n     * with the Surface as well).\n     * <p>\n     * Does not require that the surface's EGL context be current.\n     */\n    public void release() {\n        releaseEglSurface();\n        if (mSurface != null) {\n            if (mReleaseSurface) {\n                mSurface.release();\n            }\n            mSurface = null;\n        }\n    }\n\n    /**\n     * Recreate the EGLSurface, using the new EglBase.  The caller should have already\n     * freed the old EGLSurface with releaseEglSurface().\n     * <p>\n     * This is useful when we want to update the EGLSurface associated with a Surface.\n     * For example, if we want to share with a different EGLContext, which can only\n     * be done by tearing down and recreating the context.  (That's handled by the caller;\n     * this just creates a new EGLSurface for the Surface we were handed earlier.)\n     * <p>\n     * If the previous EGLSurface isn't fully destroyed, e.g. it's still current on a\n     * context somewhere, the create call will fail with complaints from the Surface\n     * about already being connected.\n     */\n    public void recreate(EglCore newEglCore) {\n        if (mSurface == null) {\n            throw new RuntimeException(\"not yet implemented for SurfaceTexture\");\n        }\n        mEglCore = newEglCore;          // switch to new context\n        createWindowSurface(mSurface);  // create new surface\n    }\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/core/filter/advanced/MagicAmaroFilter.java",
    "content": "package com.zero.magicshow.core.filter.advanced;\n\nimport android.opengl.GLES20;\n\nimport com.zero.magicshow.R;\nimport com.zero.magicshow.core.filter.base.gpuimage.GPUImageFilter;\nimport com.zero.magicshow.common.utils.MagicParams;\nimport com.zero.magicshow.common.utils.OpenGlUtils;\n\npublic class MagicAmaroFilter extends GPUImageFilter{\n\tprivate int[] inputTextureHandles = {-1,-1,-1};\n\tprivate int[] inputTextureUniformLocations = {-1,-1,-1};\n\tprivate int mGLStrengthLocation;\n\n\tpublic MagicAmaroFilter(){\n\t\tsuper(NO_FILTER_VERTEX_SHADER, OpenGlUtils.readShaderFromRawResource(R.raw.amaro));\n\t}\n\t\n\tprotected void onDestroy() {\n        super.onDestroy();\n        GLES20.glDeleteTextures(inputTextureHandles.length, inputTextureHandles, 0);\n        for(int i = 0; i < inputTextureHandles.length; i++)\n        \tinputTextureHandles[i] = -1;\n    }\n\t\n\tprotected void onDrawArraysAfter(){\n\t\tfor(int i = 0; i < inputTextureHandles.length\n\t\t\t\t&& inputTextureHandles[i] != OpenGlUtils.NO_TEXTURE; i++){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3));\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0);\n\t\t}\n\t}\n\t  \n\tprotected void onDrawArraysPre(){\n\t\tfor(int i = 0; i < inputTextureHandles.length \n\t\t\t\t&& inputTextureHandles[i] != OpenGlUtils.NO_TEXTURE; i++){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3));\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, inputTextureHandles[i]);\n\t\t\tGLES20.glUniform1i(inputTextureUniformLocations[i], (i+3));\n\t\t}\n\t}\n\t\n\tprotected void onInit(){\n\t\tsuper.onInit();\n\t\tfor(int i=0; i < inputTextureUniformLocations.length; i++)\n\t\t\tinputTextureUniformLocations[i] = GLES20.glGetUniformLocation(getProgram(), \"inputImageTexture\"+(2+i));\n\t\tmGLStrengthLocation = GLES20.glGetUniformLocation(mGLProgId,\n\t\t\t\t\"strength\");\n\t}\n\t\n\tprotected void onInitialized(){\n\t\tsuper.onInitialized();\n\t\tsetFloat(mGLStrengthLocation, 1.0f);\n\t    runOnDraw(new Runnable(){\n\t\t    public void run(){\n\t\t    \tinputTextureHandles[0] = OpenGlUtils.loadTexture(MagicParams.context, \"filter/brannan_blowout.png\");\n\t\t\t\tinputTextureHandles[1] = OpenGlUtils.loadTexture(MagicParams.context, \"filter/overlaymap.png\");\n\t\t\t\tinputTextureHandles[2] = OpenGlUtils.loadTexture(MagicParams.context, \"filter/amaromap.png\");\n\t\t    }\n\t    });\n\t}\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/core/filter/advanced/MagicAntiqueFilter.java",
    "content": "package com.zero.magicshow.core.filter.advanced;\n\nimport android.opengl.GLES20;\n\nimport com.zero.magicshow.R;\nimport com.zero.magicshow.core.filter.base.gpuimage.GPUImageFilter;\nimport com.zero.magicshow.common.utils.OpenGlUtils;\n\nimport java.nio.ByteBuffer;\n\npublic class MagicAntiqueFilter extends GPUImageFilter{\n\tprivate int[] mToneCurveTexture = {-1};\n\tprivate int mToneCurveTextureUniformLocation;\n\t  \n\tpublic MagicAntiqueFilter(){\n\t\tsuper(NO_FILTER_VERTEX_SHADER, OpenGlUtils.readShaderFromRawResource(R.raw.antique));\n\t}\n\t\n\tprotected void onDestroy(){\n\t\tsuper.onDestroy();\n\t    GLES20.glDeleteTextures(1, mToneCurveTexture, 0);\n\t    this.mToneCurveTexture[0] = -1;\n\t}\n\t  \n\tprotected void onDrawArraysAfter(){\n\t\tif (this.mToneCurveTexture[0] != -1){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE3);\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0);\n\t    }\n\t}\n\t  \n\tprotected void onDrawArraysPre(){\n\t\tif (this.mToneCurveTexture[0] != -1){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE3);\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mToneCurveTexture[0]);\n\t\t\tGLES20.glUniform1i(this.mToneCurveTextureUniformLocation, 3);\n\t    }\n\t}\n\t  \n\tprotected void onInit(){\n\t\tsuper.onInit();\n\t    mToneCurveTextureUniformLocation = GLES20.glGetUniformLocation(mGLProgId, \"curve\");\n\t}\n\t  \n\tprotected void onInitialized(){\n\t\tsuper.onInitialized();\n\t    runOnDraw(new Runnable(){\n\t\t    public void run(){\n\t\t\t    GLES20.glGenTextures(1, mToneCurveTexture, 0);\n\t\t\t    GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mToneCurveTexture[0]);\n\t\t\t    GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t\t                GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);\n\t\t        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t\t                GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);\n\t\t        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t\t                GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);\n\t\t        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t\t                GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);\n\t\t        byte[] arrayOfByte = new byte[2048];\n\t\t        int[] arrayOfInt1 = { 0, 1, 1, 2, 3, 3, 4, 5, 6, 6, 7, 8, 8, 9, 10, 11, 11, 12, 13, 14, 15, 15, 16, 17, 18, 19, 20, 21, 22, 23, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 48, 49, 50, 51, 52, 53, 55, 56, 57, 58, 59, 61, 62, 63, 64, 66, 67, 68, 69, 71, 72, 73, 74, 76, 77, 78, 79, 81, 82, 83, 85, 86, 87, 89, 90, 91, 93, 94, 95, 96, 98, 99, 100, 102, 103, 104, 106, 107, 108, 110, 111, 112, 114, 115, 116, 118, 119, 120, 122, 123, 124, 126, 127, 128, 130, 131, 132, 134, 135, 136, 137, 139, 140, 141, 143, 144, 145, 146, 148, 149, 150, 152, 153, 154, 155, 157, 158, 159, 160, 161, 163, 164, 165, 166, 168, 169, 170, 171, 172, 173, 175, 176, 177, 178, 179, 180, 181, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 211, 212, 213, 214, 215, 216, 216, 217, 218, 219, 220, 220, 221, 222, 223, 223, 224, 225, 226, 226, 227, 228, 228, 229, 230, 230, 231, 232, 232, 233, 234, 234, 235, 236, 236, 237, 238, 238, 239, 239, 240, 241, 241, 242, 242, 243, 244, 244, 245, 245, 246, 247, 247, 248, 248, 249, 249, 250, 251, 251, 252, 252, 253, 253, 254, 254, 255 };\n\t\t        int[] arrayOfInt2 = { 15, 15, 16, 17, 18, 19, 20, 20, 21, 22, 23, 23, 24, 25, 26, 27, 28, 29, 30, 31, 31, 32, 33, 34, 35, 37, 38, 39, 40, 41, 42, 43, 43, 44, 45, 46, 48, 49, 50, 51, 52, 53, 55, 56, 57, 57, 58, 59, 61, 62, 63, 64, 66, 67, 68, 69, 71, 72, 72, 73, 74, 76, 77, 78, 79, 81, 82, 83, 85, 86, 87, 87, 89, 90, 91, 93, 94, 95, 96, 98, 99, 100, 102, 102, 103, 104, 106, 107, 108, 110, 111, 112, 114, 115, 116, 118, 118, 119, 120, 122, 123, 124, 126, 127, 128, 130, 131, 132, 134, 134, 135, 136, 137, 139, 140, 141, 143, 144, 145, 146, 148, 149, 149, 150, 152, 153, 154, 155, 157, 158, 159, 160, 161, 163, 163, 164, 165, 166, 168, 169, 170, 171, 172, 173, 175, 176, 177, 177, 178, 179, 180, 181, 183, 184, 185, 186, 187, 188, 189, 190, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 211, 212, 212, 213, 214, 215, 216, 216, 217, 218, 219, 220, 220, 221, 222, 222, 223, 223, 224, 225, 226, 226, 227, 228, 228, 229, 230, 230, 230, 231, 232, 232, 233, 234, 234, 235, 236, 236, 237, 238, 238, 238, 239, 239, 240, 241, 241, 242, 242, 243, 244, 244, 245, 245, 245, 246, 247, 247, 248, 248, 249, 249, 250, 251, 251, 252, 252, 252, 253, 253, 254, 254, 255 };\n\t\t        int[] arrayOfInt3 = { 87, 89, 89, 90, 90, 91, 91, 93, 93, 94, 95, 95, 96, 96, 98, 98, 99, 100, 100, 102, 102, 103, 103, 104, 104, 106, 107, 107, 108, 108, 110, 110, 111, 112, 112, 114, 114, 115, 115, 116, 118, 118, 119, 119, 120, 120, 122, 123, 123, 124, 124, 126, 126, 127, 128, 128, 130, 130, 131, 131, 132, 134, 134, 135, 135, 136, 136, 137, 139, 139, 140, 140, 141, 143, 143, 144, 144, 145, 146, 146, 148, 148, 149, 150, 150, 152, 152, 153, 154, 154, 155, 155, 157, 158, 158, 159, 159, 160, 161, 161, 163, 163, 164, 165, 165, 166, 168, 168, 169, 169, 170, 171, 171, 172, 173, 173, 175, 175, 176, 177, 177, 178, 179, 179, 180, 181, 181, 183, 183, 184, 185, 185, 186, 187, 187, 188, 189, 189, 190, 191, 191, 192, 193, 193, 194, 195, 195, 196, 197, 197, 198, 199, 199, 200, 201, 201, 202, 203, 204, 204, 205, 206, 206, 207, 208, 208, 209, 210, 211, 211, 211, 212, 212, 213, 214, 215, 215, 216, 216, 217, 217, 218, 219, 219, 220, 220, 221, 221, 222, 223, 223, 223, 224, 225, 226, 226, 226, 227, 228, 228, 228, 229, 230, 230, 230, 231, 232, 232, 232, 233, 234, 234, 235, 235, 236, 236, 237, 238, 238, 238, 239, 239, 240, 240, 241, 241, 242, 242, 242, 243, 244, 244, 244, 245, 245, 246, 247, 247, 247, 248, 248, 249, 249, 249, 250, 251, 251, 252, 252, 252, 253, 253, 254, 254, 254, 255 };\n\t\t        int[] arrayOfInt4 = { 0, 1, 1, 2, 3, 4, 4, 5, 6, 7, 7, 8, 9, 10, 10, 11, 12, 13, 13, 14, 15, 16, 17, 17, 18, 19, 20, 20, 21, 22, 23, 24, 24, 25, 26, 27, 28, 29, 29, 30, 31, 32, 33, 34, 35, 36, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 64, 65, 66, 67, 68, 69, 70, 72, 73, 74, 75, 76, 78, 79, 80, 81, 83, 84, 85, 86, 88, 89, 90, 91, 93, 94, 95, 97, 98, 99, 101, 102, 103, 105, 106, 107, 109, 110, 111, 113, 114, 115, 117, 118, 119, 121, 122, 123, 125, 126, 127, 129, 130, 131, 133, 134, 136, 137, 138, 140, 141, 142, 144, 145, 146, 148, 149, 150, 152, 153, 154, 156, 157, 158, 159, 161, 162, 163, 165, 166, 167, 168, 170, 171, 172, 173, 175, 176, 177, 178, 180, 181, 182, 183, 184, 186, 187, 188, 189, 190, 191, 192, 193, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 213, 214, 215, 216, 217, 218, 219, 219, 220, 221, 222, 223, 223, 224, 225, 226, 227, 227, 228, 229, 230, 230, 231, 232, 232, 233, 234, 234, 235, 236, 236, 237, 238, 238, 239, 240, 240, 241, 242, 242, 243, 244, 244, 245, 245, 246, 247, 247, 248, 248, 249, 250, 250, 251, 251, 252, 253, 253, 254, 254, 255 };\n\t\t        for (int i = 0; i < 256; i++){\n\t\t          arrayOfByte[(i * 4)] = ((byte)arrayOfInt1[i]);\n\t\t          arrayOfByte[(1 + i * 4)] = ((byte)arrayOfInt2[i]);\n\t\t          arrayOfByte[(2 + i * 4)] = ((byte)arrayOfInt3[i]);\n\t\t          arrayOfByte[(3 + i * 4)] = ((byte)arrayOfInt4[i]);\n\t\t        }\n\t\t        int[] arrayOfInt5 = { 0, 0, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 8, 8, 8, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 20, 20, 20, 21, 21, 21, 22, 22, 23, 23, 23, 24, 24, 24, 25, 25, 25, 25, 26, 26, 27, 27, 28, 28, 28, 28, 29, 29, 30, 29, 31, 31, 31, 31, 32, 32, 33, 33, 34, 34, 34, 34, 35, 35, 36, 36, 37, 37, 37, 38, 38, 39, 39, 39, 40, 40, 40, 41, 42, 42, 43, 43, 44, 44, 45, 45, 45, 46, 47, 47, 48, 48, 49, 50, 51, 51, 52, 52, 53, 53, 54, 55, 55, 56, 57, 57, 58, 59, 60, 60, 61, 62, 63, 63, 64, 65, 66, 67, 68, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 88, 89, 90, 91, 93, 94, 95, 96, 97, 98, 100, 101, 103, 104, 105, 107, 108, 110, 111, 113, 115, 116, 118, 119, 120, 122, 123, 125, 127, 128, 130, 132, 134, 135, 137, 139, 141, 143, 144, 146, 148, 150, 152, 154, 156, 158, 160, 163, 165, 167, 169, 171, 173, 175, 178, 180, 182, 185, 187, 189, 192, 194, 197, 199, 201, 204, 206, 209, 211, 214, 216, 219, 221, 224, 226, 229, 232, 234, 236, 239, 241, 245, 247, 250, 252, 255 };\n\t\t        for (int j = 0; j < 256; j++){\n\t\t          arrayOfByte[(1024 + j * 4)] = ((byte)arrayOfInt5[j]);\n\t\t          arrayOfByte[(1 + (1024 + j * 4))] = ((byte)arrayOfInt5[j]);\n\t\t          arrayOfByte[(2 + (1024 + j * 4))] = ((byte)arrayOfInt5[j]);\n\t\t          arrayOfByte[(3 + (1024 + j * 4))] = -1;\n\t\t        }\n\t\t        GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, 256, 2, 0, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, ByteBuffer.wrap(arrayOfByte));\n\t\t    }\n\t    });\n\t}\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/core/filter/advanced/MagicBeautyFilter.java",
    "content": "package com.zero.magicshow.core.filter.advanced;\n\nimport android.opengl.GLES20;\n\nimport com.zero.magicshow.R;\nimport com.zero.magicshow.core.filter.base.gpuimage.GPUImageFilter;\nimport com.zero.magicshow.common.utils.MagicParams;\nimport com.zero.magicshow.common.utils.OpenGlUtils;\n\n/**\n * Created by Administrator on 2016/5/22.\n */\npublic class MagicBeautyFilter extends GPUImageFilter{\n    private int mSingleStepOffsetLocation;\n    private int mParamsLocation;\n\n    public MagicBeautyFilter(){\n        super(NO_FILTER_VERTEX_SHADER ,\n                OpenGlUtils.readShaderFromRawResource(R.raw.beauty));\n    }\n\n    protected void onInit() {\n        super.onInit();\n        mSingleStepOffsetLocation = GLES20.glGetUniformLocation(getProgram(), \"singleStepOffset\");\n        mParamsLocation = GLES20.glGetUniformLocation(getProgram(), \"params\");\n        setBeautyLevel(MagicParams.beautyLevel);\n    }\n\n    private void setTexelSize(final float w, final float h) {\n        setFloatVec2(mSingleStepOffsetLocation, new float[] {2.0f / w, 2.0f / h});\n    }\n\n    @Override\n    public void onInputSizeChanged(final int width, final int height) {\n        super.onInputSizeChanged(width, height);\n        setTexelSize(width, height);\n    }\n\n    public void setBeautyLevel(int level){\n        switch (level) {\n            case 1:\n                setFloat(mParamsLocation, 1.0f);\n                break;\n            case 2:\n                setFloat(mParamsLocation, 0.8f);\n                break;\n            case 3:\n                setFloat(mParamsLocation,0.6f);\n                break;\n            case 4:\n                setFloat(mParamsLocation, 0.4f);\n                break;\n            case 5:\n                setFloat(mParamsLocation,0.33f);\n                break;\n            default:\n                setFloat(mParamsLocation,0.0f);\n                break;\n        }\n    }\n\n    public void onBeautyLevelChanged(){\n        setBeautyLevel(MagicParams.beautyLevel);\n    }\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/core/filter/advanced/MagicBlackCatFilter.java",
    "content": "package com.zero.magicshow.core.filter.advanced;\n\nimport android.opengl.GLES20;\n\nimport com.zero.magicshow.R;\nimport com.zero.magicshow.core.filter.base.gpuimage.GPUImageFilter;\nimport com.zero.magicshow.common.utils.OpenGlUtils;\n\nimport java.nio.ByteBuffer;\n\npublic class MagicBlackCatFilter extends GPUImageFilter{\n\t\n\tprivate int[] mToneCurveTexture = {-1};\n\tprivate int mToneCurveTextureUniformLocation;\n\t  \n\tpublic MagicBlackCatFilter(){\n\t\tsuper(NO_FILTER_VERTEX_SHADER, OpenGlUtils.readShaderFromRawResource(R.raw.blackcat));\n\t}\n\t\n\tprotected void onDestroy(){\n\t\tsuper.onDestroy();\n\t    GLES20.glDeleteTextures(1, mToneCurveTexture, 0);\n\t    mToneCurveTexture[0] = -1;\n\t}\n\t  \n\tprotected void onDrawArraysAfter(){\n\t\tif (mToneCurveTexture[0] != -1){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE3);\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0);\n\t    }\n\t}\n\t  \n\tprotected void onDrawArraysPre(){\n\t\tif (mToneCurveTexture[0] != -1){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE3);\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mToneCurveTexture[0]);\n\t\t\tGLES20.glUniform1i(mToneCurveTextureUniformLocation, 3);\n\t    }\n\t}\n\t  \n\tprotected void onInit(){\n\t\tsuper.onInit();\n\t    mToneCurveTextureUniformLocation = GLES20.glGetUniformLocation(mGLProgId, \"curve\");\n\t}\n\t  \n\tprotected void onInitialized(){\n\t\tsuper.onInitialized();\n\t    runOnDraw(new Runnable(){\n\t\t    public void run(){\n\t\t\t    GLES20.glGenTextures(1, mToneCurveTexture, 0);\n\t\t\t    GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mToneCurveTexture[0]);\n\t\t\t    GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t\t                GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);\n\t\t        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t\t                GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);\n\t\t        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t\t                GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);\n\t\t        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t\t                GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);\n\t\t        byte[] arrayOfByte = new byte[2048];\n\t\t        int[] arrayOfInt1 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 5, 7, 8, 10, 11, 13, 15, 16, 18, 20, 21, 23, 24, 26, 28, 29, 31, 33, 34, 36, 37, 39, 41, 42, 44, 45, 47, 49, 50, 52, 53, 55, 57, 58, 60, 61, 63, 65, 66, 68, 69, 71, 72, 74, 76, 77, 79, 80, 82, 83, 85, 86, 88, 90, 91, 93, 94, 96, 97, 99, 100, 102, 103, 105, 106, 108, 109, 111, 112, 114, 115, 116, 118, 119, 121, 122, 124, 125, 127, 128, 129, 131, 132, 134, 135, 136, 138, 139, 141, 142, 143, 145, 146, 147, 149, 150, 151, 153, 154, 155, 157, 158, 159, 160, 162, 163, 164, 165, 167, 168, 169, 170, 172, 173, 174, 175, 176, 178, 179, 180, 181, 182, 183, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 199, 200, 201, 202, 203, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 215, 216, 217, 218, 219, 220, 220, 221, 222, 223, 224, 224, 225, 226, 227, 227, 228, 229, 229, 230, 231, 232, 232, 233, 234, 234, 235, 236, 236, 237, 238, 238, 239, 240, 240, 241, 242, 242, 243, 243, 244, 245, 245, 246, 247, 247, 248, 248, 249, 250, 250, 251, 251, 252, 253, 253, 254, 254, 255 };\n\t\t        int[] arrayOfInt2 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 5, 7, 8, 10, 11, 13, 15, 16, 16, 18, 20, 21, 23, 24, 26, 28, 29, 31, 33, 34, 36, 37, 39, 41, 41, 42, 44, 45, 47, 49, 50, 52, 53, 55, 57, 58, 60, 61, 63, 65, 66, 68, 69, 71, 72, 74, 76, 77, 79, 80, 82, 83, 85, 86, 86, 88, 90, 91, 93, 94, 96, 97, 99, 100, 102, 103, 105, 106, 108, 109, 111, 112, 114, 115, 116, 118, 119, 121, 122, 124, 125, 127, 128, 129, 131, 134, 135, 136, 138, 139, 141, 142, 143, 145, 146, 147, 149, 150, 151, 153, 154, 155, 157, 158, 159, 160, 162, 163, 164, 165, 167, 168, 169, 170, 172, 173, 174, 175, 176, 179, 180, 181, 182, 183, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 199, 200, 201, 203, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 215, 216, 217, 219, 220, 220, 221, 222, 223, 224, 224, 225, 226, 227, 227, 228, 229, 229, 230, 232, 232, 233, 234, 234, 235, 236, 236, 237, 238, 238, 239, 240, 240, 242, 242, 243, 243, 244, 245, 245, 246, 247, 247, 248, 248, 249, 250, 251, 251, 252, 253, 253, 254, 254, 255 };\n\t\t        int[] arrayOfInt3 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 3, 5, 7, 8, 10, 10, 11, 13, 15, 16, 18, 20, 20, 21, 23, 24, 26, 28, 29, 29, 31, 33, 34, 36, 37, 39, 39, 41, 42, 44, 45, 47, 49, 50, 50, 52, 53, 55, 57, 58, 60, 61, 63, 63, 65, 66, 68, 69, 71, 72, 74, 76, 77, 79, 79, 80, 82, 83, 85, 86, 88, 90, 91, 93, 94, 96, 97, 99, 100, 100, 102, 103, 105, 106, 108, 109, 111, 112, 114, 115, 116, 118, 119, 121, 122, 124, 125, 127, 128, 129, 131, 132, 134, 135, 136, 138, 139, 141, 142, 143, 145, 146, 147, 149, 150, 151, 153, 154, 155, 157, 158, 159, 160, 162, 164, 165, 167, 168, 169, 170, 172, 173, 174, 175, 176, 178, 179, 180, 181, 182, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 199, 200, 201, 202, 203, 203, 204, 205, 206, 207, 209, 210, 211, 212, 213, 214, 215, 215, 216, 218, 219, 220, 220, 221, 222, 223, 224, 225, 226, 227, 227, 228, 229, 229, 230, 232, 232, 233, 234, 234, 235, 236, 236, 238, 238, 239, 240, 240, 241, 242, 243, 243, 244, 245, 245, 246, 247, 247, 248, 249, 250, 250, 251, 251, 252, 253, 254, 254, 255 };\n\t\t        for (int i = 0; i < 256; i++){\n\t\t          arrayOfByte[(i * 4)] = ((byte)arrayOfInt1[i]);\n\t\t          arrayOfByte[(1 + i * 4)] = ((byte)arrayOfInt2[i]);\n\t\t          arrayOfByte[(2 + i * 4)] = ((byte)arrayOfInt3[i]);\n\t\t          arrayOfByte[(3 + i * 4)] = -1;\n\t\t        }\n\t\t        int[] arrayOfInt4 = { 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 12, 13, 13, 14, 14, 15, 16, 17, 18, 18, 19, 19, 20, 21, 21, 23, 24, 25, 26, 26, 26, 27, 28, 29, 30, 31, 32, 32, 33, 34, 35, 36, 37, 38, 38, 38, 39, 40, 41, 43, 44, 45, 45, 46, 47, 48, 49, 49, 50, 51, 52, 53, 54, 55, 56, 57, 57, 58, 59, 60, 61, 62, 63, 64, 65, 65, 66, 67, 68, 69, 70, 70, 71, 72, 74, 75, 76, 76, 77, 78, 79, 80, 81, 82, 82, 83, 85, 86, 87, 88, 89, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 101, 102, 103, 104, 105, 107, 107, 108, 109, 111, 112, 113, 114, 114, 115, 116, 117, 119, 120, 120, 121, 122, 123, 124, 125, 126, 126, 127, 128, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 139, 141, 142, 143, 144, 145, 145, 146, 147, 148, 149, 151, 151, 153, 154, 155, 156, 157, 158, 158, 159, 160, 161, 162, 163, 165, 166, 167, 168, 169, 170, 170, 171, 172, 173, 174, 175, 177, 178, 179, 180, 181, 182, 183, 183, 184, 185, 186, 189, 189, 190, 191, 192, 193, 194, 195, 195, 196, 198, 199, 201, 202, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 213, 214, 214, 215, 216, 218, 219, 220, 221, 221, 222, 223, 225, 227, 227, 228, 229, 230, 230, 230, 230, 230, 230, 230, 230, 230 };\n\t\t        int[] arrayOfInt5 = { 0, 1, 1, 2, 3, 3, 4, 5, 5, 6, 7, 8, 8, 9, 10, 11, 11, 12, 13, 14, 15, 15, 16, 17, 18, 19, 19, 20, 21, 22, 23, 24, 25, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 39, 40, 41, 42, 43, 44, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 61, 62, 63, 64, 65, 66, 67, 69, 70, 71, 72, 73, 74, 76, 77, 78, 79, 81, 82, 83, 84, 86, 87, 88, 89, 91, 92, 93, 95, 96, 97, 99, 100, 101, 103, 104, 105, 107, 108, 109, 111, 112, 114, 115, 116, 118, 119, 121, 122, 124, 125, 126, 128, 129, 131, 132, 134, 135, 137, 138, 140, 141, 142, 144, 145, 147, 148, 149, 151, 152, 154, 155, 156, 158, 159, 160, 162, 163, 164, 166, 167, 168, 170, 171, 172, 173, 175, 176, 177, 178, 180, 181, 182, 183, 184, 186, 187, 188, 189, 190, 191, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 220, 221, 222, 223, 224, 225, 225, 226, 227, 228, 229, 229, 230, 231, 232, 232, 233, 234, 234, 235, 236, 236, 237, 238, 238, 239, 240, 240, 241, 241, 242, 243, 243, 244, 244, 245, 245, 246, 246, 247, 247, 248, 248, 249, 249, 250, 250, 251, 251, 252, 252, 252, 253, 253, 254, 254, 254, 255, 255 };\n\t\t        int[] arrayOfInt6 = { 0, 0, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 8, 8, 8, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 20, 20, 20, 21, 21, 21, 22, 22, 23, 23, 23, 24, 24, 24, 25, 25, 25, 25, 26, 26, 27, 27, 28, 28, 28, 28, 29, 29, 30, 29, 31, 31, 31, 31, 32, 32, 33, 33, 34, 34, 34, 34, 35, 35, 36, 36, 37, 37, 37, 38, 38, 39, 39, 39, 40, 40, 40, 41, 42, 42, 43, 43, 44, 44, 45, 45, 45, 46, 47, 47, 48, 48, 49, 50, 51, 51, 52, 52, 53, 53, 54, 55, 55, 56, 57, 57, 58, 59, 60, 60, 61, 62, 63, 63, 64, 65, 66, 67, 68, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 88, 89, 90, 91, 93, 94, 95, 96, 97, 98, 100, 101, 103, 104, 105, 107, 108, 110, 111, 113, 115, 116, 118, 119, 120, 122, 123, 125, 127, 128, 130, 132, 134, 135, 137, 139, 141, 143, 144, 146, 148, 150, 152, 154, 156, 158, 160, 163, 165, 167, 169, 171, 173, 175, 178, 180, 182, 185, 187, 189, 192, 194, 197, 199, 201, 204, 206, 209, 211, 214, 216, 219, 221, 224, 226, 229, 232, 234, 236, 239, 241, 245, 247, 250, 252, 255 };\n\t\t        for (int j = 0; j < 256; j++){\n\t\t          arrayOfByte[(1024 + j * 4)] = ((byte)arrayOfInt4[j]);\n\t\t          arrayOfByte[(1 + (1024 + j * 4))] = ((byte)arrayOfInt5[j]);\n\t\t          arrayOfByte[(2 + (1024 + j * 4))] = ((byte)arrayOfInt6[j]);\n\t\t          arrayOfByte[(3 + (1024 + j * 4))] = -1;\n\t\t        }\n\t\t        GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, 256, 2, 0, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, ByteBuffer.wrap(arrayOfByte));\n\t\t    }\n\t    });\n\t}\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/core/filter/advanced/MagicBrannanFilter.java",
    "content": "package com.zero.magicshow.core.filter.advanced;\n\nimport android.opengl.GLES20;\n\nimport com.zero.magicshow.R;\nimport com.zero.magicshow.core.filter.base.gpuimage.GPUImageFilter;\nimport com.zero.magicshow.common.utils.MagicParams;\nimport com.zero.magicshow.common.utils.OpenGlUtils;\n\npublic class MagicBrannanFilter extends GPUImageFilter{\n\tprivate int[] inputTextureHandles = {-1,-1,-1,-1,-1};\n\tprivate int[] inputTextureUniformLocations = {-1,-1,-1,-1,-1};\n    private int mGLStrengthLocation;\n\n\tpublic MagicBrannanFilter(){\n\t\tsuper(NO_FILTER_VERTEX_SHADER, OpenGlUtils.readShaderFromRawResource(R.raw.brannan));\n\t}\n\t\n\tprotected void onDestroy() {\n        super.onDestroy();\n        GLES20.glDeleteTextures(inputTextureHandles.length, inputTextureHandles, 0);\n        for(int i = 0; i < inputTextureHandles.length; i++)\n        \tinputTextureHandles[i] = -1;\n    }\n\t\n\tprotected void onDrawArraysAfter(){\n\t\tfor(int i = 0; i < inputTextureHandles.length\n\t\t\t\t&& inputTextureHandles[i] != OpenGlUtils.NO_TEXTURE; i++){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3));\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0);\n\t\t}\n\t}\n\t  \n\tprotected void onDrawArraysPre(){\n\t\tfor(int i = 0; i < inputTextureHandles.length \n\t\t\t\t&& inputTextureHandles[i] != OpenGlUtils.NO_TEXTURE; i++){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3) );\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, inputTextureHandles[i]);\n\t\t\tGLES20.glUniform1i(inputTextureUniformLocations[i], (i+3));\n\t\t}\n\t}\n\t\n\tprotected void onInit(){\n\t\tsuper.onInit();\n\t\tfor(int i=0; i < inputTextureUniformLocations.length; i++)\n\t\t\tinputTextureUniformLocations[i] = GLES20.glGetUniformLocation(getProgram(), \"inputImageTexture\"+(2+i));\n\t\tmGLStrengthLocation = GLES20.glGetUniformLocation(mGLProgId,\n\t\t\t\t\"strength\");\n\t}\n\t\n\tprotected void onInitialized(){\n\t\tsuper.onInitialized();\n\t\tsetFloat(mGLStrengthLocation, 1.0f);\n\t    runOnDraw(new Runnable(){\n\t\t    public void run(){\n\t\t    \tinputTextureHandles[0] = OpenGlUtils.loadTexture(MagicParams.context, \"filter/brannan_process.png\");\n\t\t\t\tinputTextureHandles[1] = OpenGlUtils.loadTexture(MagicParams.context, \"filter/brannan_blowout.png\");\n\t\t\t\tinputTextureHandles[2] = OpenGlUtils.loadTexture(MagicParams.context, \"filter/brannan_contrast.png\");\n\t\t\t\tinputTextureHandles[3] = OpenGlUtils.loadTexture(MagicParams.context, \"filter/brannan_luma.png\");\n\t\t\t\tinputTextureHandles[4] = OpenGlUtils.loadTexture(MagicParams.context, \"filter/brannan_screen.png\");\n\t\t    }\n\t    });\n\t}\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/core/filter/advanced/MagicBrooklynFilter.java",
    "content": "package com.zero.magicshow.core.filter.advanced;\n\nimport android.opengl.GLES20;\n\nimport com.zero.magicshow.R;\nimport com.zero.magicshow.core.filter.base.gpuimage.GPUImageFilter;\nimport com.zero.magicshow.common.utils.MagicParams;\nimport com.zero.magicshow.common.utils.OpenGlUtils;\n\npublic class MagicBrooklynFilter extends GPUImageFilter{\n\tprivate int[] inputTextureHandles = {-1,-1,-1};\n\tprivate int[] inputTextureUniformLocations = {-1,-1,-1};\n    private int mGLStrengthLocation;\n\n\tpublic MagicBrooklynFilter(){\n\t\tsuper(NO_FILTER_VERTEX_SHADER, OpenGlUtils.readShaderFromRawResource(R.raw.brooklyn));\n\t}\n\t\n\tpublic void onDestroy() {\n        super.onDestroy();\n        GLES20.glDeleteTextures(inputTextureHandles.length, inputTextureHandles, 0);\n        for(int i = 0; i < inputTextureHandles.length; i++)\n        \tinputTextureHandles[i] = -1;\n    }\n\t\n\tprotected void onDrawArraysAfter(){\n\t\tfor(int i = 0; i < inputTextureHandles.length\n\t\t\t\t&& inputTextureHandles[i] != OpenGlUtils.NO_TEXTURE; i++){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3));\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0);\n\t\t}\n\t}\n\t  \n\tprotected void onDrawArraysPre(){\n\t\tfor(int i = 0; i < inputTextureHandles.length \n\t\t\t\t&& inputTextureHandles[i] != OpenGlUtils.NO_TEXTURE; i++){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3) );\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, inputTextureHandles[i]);\n\t\t\tGLES20.glUniform1i(inputTextureUniformLocations[i], (i+3));\n\t\t}\n\t}\n\t\n\tpublic void onInit(){\n\t\tsuper.onInit();\n\t\tfor(int i=0; i < inputTextureUniformLocations.length; i++)\n\t\t\tinputTextureUniformLocations[i] = GLES20.glGetUniformLocation(getProgram(), \"inputImageTexture\"+(2+i));\n\t\tmGLStrengthLocation = GLES20.glGetUniformLocation(mGLProgId,\n\t\t\t\t\"strength\");\n\t}\n\t\n\tpublic void onInitialized(){\n\t\tsuper.onInitialized();\n\t\tsetFloat(mGLStrengthLocation, 1.0f);\n\t    runOnDraw(new Runnable(){\n\t\t    public void run(){\n\t\t    \tinputTextureHandles[0] = OpenGlUtils.loadTexture(MagicParams.context, \"filter/brooklynCurves1.png\");\n\t\t\t\tinputTextureHandles[1] = OpenGlUtils.loadTexture(MagicParams.context, \"filter/filter_map_first.png\");\n\t\t\t\tinputTextureHandles[2] = OpenGlUtils.loadTexture(MagicParams.context, \"filter/brooklynCurves2.png\");\n\t\t    }\n\t    });\n\t}\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/core/filter/advanced/MagicCalmFilter.java",
    "content": "package com.zero.magicshow.core.filter.advanced;\n\nimport android.opengl.GLES20;\n\nimport com.zero.magicshow.R;\nimport com.zero.magicshow.core.filter.base.gpuimage.GPUImageFilter;\nimport com.zero.magicshow.common.utils.MagicParams;\nimport com.zero.magicshow.common.utils.OpenGlUtils;\n\nimport java.nio.ByteBuffer;\n\npublic class MagicCalmFilter extends GPUImageFilter{\n\tprivate int[] mToneCurveTexture = {-1};\n\tprivate int mToneCurveTextureUniformLocation;\n\tprivate int mMaskGrey1TextureId = -1;\n\tprivate int mMaskGrey1UniformLocation;\n\tprivate int mMaskGrey2TextureId = -1;\n\tprivate int mMaskGrey2UniformLocation;\n\t\n\tpublic MagicCalmFilter(){\n\t\tsuper(NO_FILTER_VERTEX_SHADER, OpenGlUtils.readShaderFromRawResource(R.raw.calm));\n\t}\n\t\n\tprotected void onDestroy(){\n\t\tsuper.onDestroy();\t  \n\t    GLES20.glDeleteTextures(3, new int[]{mToneCurveTexture[0], mMaskGrey1TextureId, mMaskGrey2TextureId}, 0);\t    \n\t    mToneCurveTexture[0] = -1;\n\t    mMaskGrey1TextureId = -1;\n\t    mMaskGrey2TextureId = -1;\n\t}\n\t  \n\tprotected void onDrawArraysAfter(){\n\t\tif (mToneCurveTexture[0] != -1){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE3);\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0);\n\t    }\n\t\tif (mMaskGrey1TextureId != -1){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE4);\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0);\n\t    }\n\t    if (mMaskGrey2TextureId != -1){\n\t    \tGLES20.glActiveTexture(GLES20.GL_TEXTURE5);\n\t    \tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);\n\t    \tGLES20.glActiveTexture(GLES20.GL_TEXTURE0);\n\t    }\n\t}\n\t  \n\tprotected void onDrawArraysPre(){\n\t\tif (mToneCurveTexture[0] != -1){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE3);\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mToneCurveTexture[0]);\n\t\t\tGLES20.glUniform1i(mToneCurveTextureUniformLocation, 3);\n\t    }\n\t\tif (mMaskGrey1TextureId != -1){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE4);\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mMaskGrey1TextureId);\n\t\t\tGLES20.glUniform1i(mMaskGrey1UniformLocation, 4);\n\t    }\n\t    if (mMaskGrey2TextureId != -1){\n\t    \tGLES20.glActiveTexture(GLES20.GL_TEXTURE5);\n\t    \tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mMaskGrey2TextureId);\n\t     \tGLES20.glUniform1i(mMaskGrey2UniformLocation, 5);\n\t    }\n\t}\n\t  \n\tprotected void onInit(){\n\t\tsuper.onInit();\n\t    mToneCurveTextureUniformLocation = GLES20.glGetUniformLocation(mGLProgId, \"curve\");\n        mMaskGrey1UniformLocation = GLES20.glGetUniformLocation(getProgram(), \"grey1Frame\");\n        mMaskGrey2UniformLocation = GLES20.glGetUniformLocation(getProgram(), \"grey2Frame\");\n\t}\n\t  \n\tprotected void onInitialized(){\n\t\tsuper.onInitialized();\n\t    runOnDraw(new Runnable(){\n\t\t    public void run(){\n\t\t\t    GLES20.glGenTextures(1, mToneCurveTexture, 0);\n\t\t\t    GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mToneCurveTexture[0]);\n\t\t\t    GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t\t                GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);\n\t\t        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t\t                GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);\n\t\t        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t\t                GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);\n\t\t        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t\t                GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);\t\t\t\t\t\n\t\t        byte[] arrayOfByte = new byte[3072];\n\t\t        int[] arrayOfInt1 = { 38, 39, 40, 41, 41, 42, 43, 44, 45, 46, 47, 47, 48, 49, 50, 51, 52, 52, 53, 54, 55, 56, 57, 58, 58, 59, 60, 61, 62, 63, 64, 64, 65, 66, 67, 68, 69, 69, 70, 71, 72, 73, 74, 75, 75, 76, 77, 78, 79, 80, 81, 81, 82, 83, 84, 85, 86, 87, 87, 88, 89, 90, 91, 92, 92, 93, 94, 95, 96, 97, 98, 98, 99, 100, 101, 102, 103, 104, 104, 105, 106, 107, 108, 109, 109, 110, 111, 112, 113, 114, 115, 115, 116, 117, 118, 119, 120, 121, 121, 122, 123, 124, 125, 126, 127, 127, 128, 129, 130, 131, 132, 132, 133, 134, 135, 136, 137, 138, 138, 139, 140, 141, 142, 143, 144, 144, 145, 146, 147, 148, 149, 149, 150, 151, 152, 153, 154, 155, 155, 156, 157, 158, 159, 160, 161, 161, 162, 163, 164, 165, 166, 166, 167, 168, 169, 170, 171, 172, 172, 173, 174, 175, 176, 177, 178, 178, 179, 180, 181, 182, 183, 184, 184, 185, 186, 187, 188, 189, 189, 190, 191, 192, 193, 194, 195, 195, 196, 197, 198, 199, 200, 201, 201, 202, 203, 204, 205, 206, 206, 207, 208, 209, 210, 211, 212, 212, 213, 214, 215, 216, 217, 218, 218, 219, 220, 221, 222, 223, 224, 224, 225, 226, 227, 228, 229, 229, 230, 231, 232, 233, 234, 235, 235, 236, 237, 238, 239, 240, 241, 241, 242, 243, 244, 245, 246, 246, 247, 248, 249, 250, 251, 252, 252, 253, 254, 255 };\n\t\t        for (int i = 0; i < 256; i++){\n\t\t          arrayOfByte[(i * 4)] = ((byte)arrayOfInt1[i]);\n\t\t          arrayOfByte[(1 + i * 4)] = ((byte)arrayOfInt1[i]);\n\t\t          arrayOfByte[(2 + i * 4)] = ((byte)arrayOfInt1[i]);\n\t\t          arrayOfByte[(3 + i * 4)] = -1;\n\t\t        }\n\t\t        int[] arrayOfInt2 = { 0, 1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 18, 19, 21, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 35, 36, 37, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 93, 94, 95, 96, 97, 98, 99, 99, 100, 101, 102, 103, 104, 104, 105, 106, 107, 108, 109, 109, 110, 111, 112, 113, 114, 114, 115, 116, 117, 118, 118, 119, 120, 121, 122, 123, 123, 124, 125, 126, 127, 127, 128, 129, 130, 131, 131, 132, 133, 134, 135, 135, 136, 137, 138, 139, 140, 140, 141, 142, 143, 144, 145, 145, 146, 147, 148, 149, 150, 150, 151, 152, 153, 154, 155, 156, 157, 157, 158, 159, 160, 161, 162, 163, 164, 165, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 196, 197, 198, 199, 200, 201, 202, 203, 204, 206, 207, 208, 209, 210, 211, 213, 214, 215, 216, 217, 218, 220, 221, 222, 223, 224, 226, 227, 228, 229, 230, 232, 233, 234, 235, 237, 238, 239, 240, 241, 243, 244, 245, 246, 248, 249, 250, 251, 253, 254, 255 };\n\t\t        int[] arrayOfInt3 = { 0, 1, 1, 2, 3, 3, 4, 5, 6, 6, 7, 8, 8, 9, 10, 11, 11, 12, 13, 14, 15, 15, 16, 17, 18, 19, 20, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 36, 37, 38, 39, 40, 42, 43, 44, 46, 47, 48, 50, 51, 53, 54, 56, 57, 59, 60, 62, 64, 65, 67, 69, 70, 72, 74, 75, 77, 79, 80, 82, 84, 85, 87, 89, 91, 92, 94, 96, 97, 99, 101, 102, 104, 106, 107, 109, 111, 112, 114, 115, 117, 118, 120, 121, 123, 124, 126, 127, 129, 130, 132, 133, 134, 136, 137, 138, 140, 141, 142, 144, 145, 146, 147, 149, 150, 151, 152, 153, 155, 156, 157, 158, 159, 160, 161, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 184, 185, 186, 187, 188, 189, 190, 191, 191, 192, 193, 194, 195, 196, 196, 197, 198, 199, 200, 200, 201, 202, 203, 203, 204, 205, 206, 206, 207, 208, 209, 209, 210, 211, 211, 212, 213, 214, 214, 215, 216, 216, 217, 218, 218, 219, 220, 220, 221, 222, 222, 223, 224, 224, 225, 226, 226, 227, 227, 228, 229, 229, 230, 231, 231, 232, 233, 233, 234, 234, 235, 236, 236, 237, 237, 238, 239, 239, 240, 240, 241, 242, 242, 243, 243, 244, 245, 245, 246, 246, 247, 247, 248, 249, 249, 250, 250, 251, 252, 252, 253, 253, 254, 254, 255 };\n\t\t        for (int j = 0; j < 256; j++){\n\t\t          arrayOfByte[(1024 + j * 4)] = ((byte)arrayOfInt3[j]);\n\t\t          arrayOfByte[(1 + (1024 + j * 4))] = ((byte)arrayOfInt3[j]);\n\t\t          arrayOfByte[(2 + (1024 + j * 4))] = ((byte)arrayOfInt2[j]);\n\t\t          arrayOfByte[(3 + (1024 + j * 4))] = -1;\n\t\t        }\n\t\t        int[] arrayOfInt4 = { 0, 1, 3, 4, 5, 7, 8, 10, 11, 12, 14, 15, 16, 18, 19, 20, 22, 23, 24, 26, 27, 28, 30, 31, 33, 34, 35, 37, 38, 39, 41, 42, 43, 45, 46, 47, 49, 50, 51, 53, 54, 55, 57, 58, 59, 61, 62, 63, 64, 66, 67, 68, 70, 71, 72, 74, 75, 76, 77, 79, 80, 81, 83, 84, 85, 86, 88, 89, 90, 91, 93, 94, 95, 96, 98, 99, 100, 101, 103, 104, 105, 106, 108, 109, 110, 111, 112, 114, 115, 116, 117, 118, 119, 121, 122, 123, 124, 125, 126, 128, 129, 130, 131, 132, 133, 134, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 175, 176, 177, 178, 179, 180, 181, 182, 183, 183, 184, 185, 186, 187, 188, 189, 189, 190, 191, 192, 193, 194, 194, 195, 196, 197, 198, 198, 199, 200, 201, 202, 202, 203, 204, 205, 205, 206, 207, 208, 208, 209, 210, 211, 211, 212, 213, 214, 214, 215, 216, 216, 217, 218, 218, 219, 220, 221, 221, 222, 223, 223, 224, 225, 225, 226, 227, 227, 228, 229, 229, 230, 231, 231, 232, 233, 233, 234, 235, 235, 236, 237, 237, 238, 239, 239, 240, 240, 241, 242, 242, 243, 244, 244, 245, 246, 246, 247, 247, 248, 249, 249, 250, 251, 251, 252, 252, 253, 254, 254, 255 };\n\t\t        int[] arrayOfInt5 = { 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 11, 11, 12, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 20, 20, 21, 21, 21, 22, 22, 23, 23, 24, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 30, 30, 31, 31, 32, 33, 33, 34, 34, 35, 35, 36, 37, 37, 38, 38, 39, 40, 40, 41, 42, 42, 43, 44, 44, 45, 46, 47, 47, 48, 49, 49, 50, 51, 52, 53, 53, 54, 55, 56, 57, 57, 58, 59, 60, 61, 62, 63, 64, 65, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 81, 82, 83, 84, 85, 86, 87, 88, 90, 91, 92, 93, 94, 96, 97, 98, 99, 101, 102, 103, 105, 106, 107, 109, 110, 111, 113, 114, 115, 117, 118, 120, 121, 123, 124, 126, 127, 129, 130, 132, 133, 135, 137, 138, 140, 142, 143, 145, 147, 148, 150, 152, 153, 155, 157, 159, 161, 162, 164, 166, 168, 170, 172, 174, 175, 177, 179, 181, 183, 185, 187, 189, 191, 193, 195, 197, 199, 201, 203, 205, 207, 209, 211, 213, 215, 217, 219, 221, 224, 226, 228, 230, 232, 234, 236, 238, 240, 242, 244, 247, 249, 251, 253, 255 };\n\t\t        int[] arrayOfInt6 = { 0, 0, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 8, 8, 8, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 20, 20, 20, 21, 21, 21, 22, 22, 23, 23, 23, 24, 24, 24, 25, 25, 25, 25, 26, 26, 27, 27, 28, 28, 28, 28, 29, 29, 30, 29, 31, 31, 31, 31, 32, 32, 33, 33, 34, 34, 34, 34, 35, 35, 36, 36, 37, 37, 37, 38, 38, 39, 39, 39, 40, 40, 40, 41, 42, 42, 43, 43, 44, 44, 45, 45, 45, 46, 47, 47, 48, 48, 49, 50, 51, 51, 52, 52, 53, 53, 54, 55, 55, 56, 57, 57, 58, 59, 60, 60, 61, 62, 63, 63, 64, 65, 66, 67, 68, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 88, 89, 90, 91, 93, 94, 95, 96, 97, 98, 100, 101, 103, 104, 105, 107, 108, 110, 111, 113, 115, 116, 118, 119, 120, 122, 123, 125, 127, 128, 130, 132, 134, 135, 137, 139, 141, 143, 144, 146, 148, 150, 152, 154, 156, 158, 160, 163, 165, 167, 169, 171, 173, 175, 178, 180, 182, 185, 187, 189, 192, 194, 197, 199, 201, 204, 206, 209, 211, 214, 216, 219, 221, 224, 226, 229, 232, 234, 236, 239, 241, 245, 247, 250, 252, 255 };\n\t\t        for (int k = 0; k < 256; k++){\n\t\t          arrayOfByte[(2048 + k * 4)] = ((byte)arrayOfInt4[k]);\n\t\t          arrayOfByte[(1 + (2048 + k * 4))] = ((byte)arrayOfInt5[k]);\n\t\t          arrayOfByte[(2 + (2048 + k * 4))] = ((byte)arrayOfInt6[k]);\n\t\t          arrayOfByte[(3 + (2048 + k * 4))] = -1;\n\t\t        }\n\t\t        GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, 256, 3, 0, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, ByteBuffer.wrap(arrayOfByte));\n\t\t        mMaskGrey1TextureId = OpenGlUtils.loadTexture(MagicParams.context, \"filter/calm_mask1.jpg\");\n\t\t        mMaskGrey2TextureId = OpenGlUtils.loadTexture(MagicParams.context, \"filter/calm_mask2.jpg\");\n\t\t    }\n\t    });\n\t}\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/core/filter/advanced/MagicCoolFilter.java",
    "content": "package com.zero.magicshow.core.filter.advanced;\n\nimport android.opengl.GLES20;\n\nimport com.zero.magicshow.R;\nimport com.zero.magicshow.core.filter.base.gpuimage.GPUImageFilter;\nimport com.zero.magicshow.common.utils.OpenGlUtils;\n\nimport java.nio.ByteBuffer;\n\npublic class MagicCoolFilter extends GPUImageFilter{\n\tprivate int[] mToneCurveTexture = {-1};\n\tprivate int mToneCurveTextureUniformLocation;\n\t  \n\tpublic MagicCoolFilter(){\n\t\tsuper(NO_FILTER_VERTEX_SHADER, OpenGlUtils.readShaderFromRawResource(R.raw.cool));\n\t}\n\t\n\tpublic void onDestroy(){\n\t\tsuper.onDestroy();\n\t    GLES20.glDeleteTextures(1, mToneCurveTexture, 0);\n\t    this.mToneCurveTexture[0] = -1;\n\t}\n\t  \n\tprotected void onDrawArraysAfter(){\n\t\tif (this.mToneCurveTexture[0] != -1){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE3);\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0);\n\t    }\n\t}\n\t  \n\tprotected void onDrawArraysPre(){\n\t\tif (this.mToneCurveTexture[0] != -1){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE3);\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mToneCurveTexture[0]);\n\t\t\tGLES20.glUniform1i(this.mToneCurveTextureUniformLocation, 3);\n\t    }\n\t}\n\t  \n\tpublic void onInit(){\n\t\tsuper.onInit();\n\t    mToneCurveTextureUniformLocation = GLES20.glGetUniformLocation(mGLProgId, \"curve\");\n\t}\n\t  \n\tpublic void onInitialized(){\n\t\tsuper.onInitialized();\n\t    runOnDraw(new Runnable(){\n\t\t    public void run(){\n\t\t\t    GLES20.glGenTextures(1, mToneCurveTexture, 0);\n\t\t\t    GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mToneCurveTexture[0]);\n\t\t\t    GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t\t                GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);\n\t\t        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t\t                GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);\n\t\t        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t\t                GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);\n\t\t        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t\t                GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);\t\t\t\t\t\n\t\t        byte[] arrayOfByte = new byte[2048];\n\t\t        int[] arrayOfInt1 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 3, 4, 5, 5, 6, 7, 8, 9, 9, 10, 11, 12, 12, 13, 14, 15, 16, 16, 17, 18, 19, 20, 20, 21, 22, 23, 24, 24, 25, 26, 27, 28, 28, 29, 30, 31, 32, 33, 33, 34, 35, 36, 37, 38, 39, 39, 40, 41, 42, 43, 44, 45, 46, 47, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 82, 83, 84, 85, 86, 87, 88, 90, 91, 92, 93, 94, 95, 97, 98, 99, 100, 102, 103, 104, 105, 107, 108, 109, 111, 112, 113, 115, 116, 117, 119, 120, 121, 123, 124, 126, 127, 128, 130, 131, 133, 134, 136, 137, 139, 140, 142, 143, 145, 146, 148, 149, 151, 152, 154, 155, 157, 158, 160, 161, 163, 165, 166, 168, 169, 171, 173, 174, 176, 177, 179, 181, 182, 184, 185, 187, 189, 190, 192, 194, 195, 197, 199, 200, 202, 204, 205, 207, 209, 210, 212, 214, 216, 217, 219, 221, 222, 224, 226, 228, 229, 231, 233, 234, 236, 238, 240, 241, 243, 245, 246, 248, 250, 252, 253, 255 };\n\t\t        int[] arrayOfInt2 = { 0, 1, 2, 3, 4, 5, 6, 7, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 250, 251, 252, 253, 254, 255 };\n\t\t        int[] arrayOfInt3 = { 0, 3, 6, 9, 11, 14, 17, 20, 23, 26, 28, 31, 34, 37, 40, 43, 45, 48, 51, 54, 57, 59, 62, 65, 68, 70, 73, 76, 79, 81, 84, 87, 89, 92, 95, 97, 100, 102, 105, 108, 110, 113, 115, 118, 120, 123, 125, 128, 130, 133, 135, 137, 140, 142, 144, 147, 149, 151, 153, 156, 158, 160, 162, 164, 166, 168, 171, 173, 175, 177, 179, 180, 182, 184, 186, 188, 190, 191, 193, 195, 197, 198, 200, 201, 203, 205, 206, 207, 209, 210, 212, 213, 214, 216, 217, 218, 219, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 234, 235, 236, 237, 237, 238, 239, 240, 240, 241, 242, 242, 243, 243, 244, 244, 245, 245, 246, 246, 247, 247, 248, 248, 248, 249, 249, 249, 250, 250, 250, 251, 251, 251, 251, 252, 252, 252, 252, 252, 253, 253, 253, 253, 253, 253, 253, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 };\n\t\t        int[] arrayOfInt4 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 13, 17, 21, 24, 32, 36, 39, 46, 50, 53, 56, 62, 65, 68, 73, 75, 78, 80, 85, 87, 88, 92, 94, 95, 96, 99, 100, 102, 104, 106, 107, 109, 110, 112, 113, 115, 116, 117, 120, 121, 122, 123, 125, 126, 127, 129, 130, 131, 132, 134, 135, 136, 138, 139, 140, 141, 142, 143, 144, 146, 147, 148, 149, 150, 151, 152, 154, 154, 155, 156, 158, 159, 159, 161, 162, 163, 163, 165, 166, 166, 168, 169, 169, 170, 172, 172, 173, 175, 175, 176, 177, 178, 179, 180, 181, 182, 182, 184, 184, 185, 186, 187, 188, 188, 190, 190, 191, 192, 193, 194, 194, 196, 196, 197, 197, 199, 199, 200, 201, 202, 202, 203, 204, 205, 205, 207, 207, 208, 208, 210, 210, 211, 212, 213, 213, 214, 215, 215, 216, 217, 218, 218, 219, 220, 221, 221, 222, 223, 223, 224, 225, 226, 226, 227, 228, 228, 229, 230, 230, 231, 232, 232, 233, 234, 235, 235, 236, 237, 237, 238, 239, 239, 240, 240, 241, 242, 242, 243, 244, 244, 245, 246, 246, 247, 248, 248, 249, 249, 250, 251, 251, 252, 253, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 };\n\t\t        for (int i = 0; i < 256; i++){\n\t\t          arrayOfByte[(i * 4)] = ((byte)arrayOfInt1[i]);\n\t\t          arrayOfByte[(1 + i * 4)] = ((byte)arrayOfInt2[i]);\n\t\t          arrayOfByte[(2 + i * 4)] = ((byte)arrayOfInt3[i]);\n\t\t          arrayOfByte[(3 + i * 4)] = ((byte)arrayOfInt4[i]);\n\t\t        }\n\t\t        int[] arrayOfInt5 = { 0, 0, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 8, 8, 8, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 20, 20, 20, 21, 21, 21, 22, 22, 23, 23, 23, 24, 24, 24, 25, 25, 25, 25, 26, 26, 27, 27, 28, 28, 28, 28, 29, 29, 30, 29, 31, 31, 31, 31, 32, 32, 33, 33, 34, 34, 34, 34, 35, 35, 36, 36, 37, 37, 37, 38, 38, 39, 39, 39, 40, 40, 40, 41, 42, 42, 43, 43, 44, 44, 45, 45, 45, 46, 47, 47, 48, 48, 49, 50, 51, 51, 52, 52, 53, 53, 54, 55, 55, 56, 57, 57, 58, 59, 60, 60, 61, 62, 63, 63, 64, 65, 66, 67, 68, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 88, 89, 90, 91, 93, 94, 95, 96, 97, 98, 100, 101, 103, 104, 105, 107, 108, 110, 111, 113, 115, 116, 118, 119, 120, 122, 123, 125, 127, 128, 130, 132, 134, 135, 137, 139, 141, 143, 144, 146, 148, 150, 152, 154, 156, 158, 160, 163, 165, 167, 169, 171, 173, 175, 178, 180, 182, 185, 187, 189, 192, 194, 197, 199, 201, 204, 206, 209, 211, 214, 216, 219, 221, 224, 226, 229, 232, 234, 236, 239, 241, 245, 247, 250, 252, 255 };\n\t\t        for (int j = 0; j < 256; j++){\n\t\t          arrayOfByte[(1024 + j * 4)] = ((byte)arrayOfInt5[j]);\n\t\t          arrayOfByte[(1 + (1024 + j * 4))] = ((byte)arrayOfInt5[j]);\n\t\t          arrayOfByte[(2 + (1024 + j * 4))] = ((byte)arrayOfInt5[j]);\n\t\t          arrayOfByte[(3 + (1024 + j * 4))] = -1;\n\t\t        }\n\t\t        GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, 256, 2, 0, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, ByteBuffer.wrap(arrayOfByte));\n\t\t    }\n\t    });\n\t}\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/core/filter/advanced/MagicCrayonFilter.java",
    "content": "package com.zero.magicshow.core.filter.advanced;\n\nimport android.opengl.GLES20;\n\nimport com.zero.magicshow.R;\nimport com.zero.magicshow.core.filter.base.gpuimage.GPUImageFilter;\nimport com.zero.magicshow.common.utils.OpenGlUtils;\n\npublic class MagicCrayonFilter extends GPUImageFilter{\n\t\n\tprivate int mSingleStepOffsetLocation;\n\t//1.0 - 5.0\n\tprivate int mStrengthLocation;\n\t\n\tpublic MagicCrayonFilter(){\n\t\tsuper(NO_FILTER_VERTEX_SHADER, OpenGlUtils.readShaderFromRawResource(R.raw.crayon));\n\t}\n\t\n\tprotected void onInit() {\n        super.onInit();\n        mSingleStepOffsetLocation = GLES20.glGetUniformLocation(getProgram(), \"singleStepOffset\");\n        mStrengthLocation = GLES20.glGetUniformLocation(getProgram(), \"strength\");\n        setFloat(mStrengthLocation, 2.0f);\n    }\n    \n    protected void onDestroy() {\n        super.onDestroy();\n    }\n\n    protected void onInitialized(){\n        super.onInitialized();\n        setFloat(mStrengthLocation, 0.5f);\n    }\n\n    private void setTexelSize(final float w, final float h) {\n\t\tsetFloatVec2(mSingleStepOffsetLocation, new float[] {1.0f / w, 1.0f / h});\n\t}\n\t\n\t@Override\n    public void onInputSizeChanged(final int width, final int height) {\n        super.onInputSizeChanged(width, height);\n        setTexelSize(width, height);\n    }\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/core/filter/advanced/MagicEarlyBirdFilter.java",
    "content": "package com.zero.magicshow.core.filter.advanced;\n\nimport android.opengl.GLES20;\n\nimport com.zero.magicshow.R;\nimport com.zero.magicshow.core.filter.base.gpuimage.GPUImageFilter;\nimport com.zero.magicshow.common.utils.MagicParams;\nimport com.zero.magicshow.common.utils.OpenGlUtils;\n\npublic class MagicEarlyBirdFilter extends GPUImageFilter{\n\tprivate int[] inputTextureHandles = {-1,-1,-1,-1,-1};\n\tprivate int[] inputTextureUniformLocations = {-1,-1,-1,-1,-1};\n\tprotected int mGLStrengthLocation;\n\n\tpublic MagicEarlyBirdFilter(){\n\t\tsuper(NO_FILTER_VERTEX_SHADER, OpenGlUtils.readShaderFromRawResource(R.raw.earlybird));\n\t}\n\t\n\tprotected void onDestroy() {\n        super.onDestroy();\n        GLES20.glDeleteTextures(inputTextureHandles.length, inputTextureHandles, 0);\n        for(int i = 0; i < inputTextureHandles.length; i++)\n        \tinputTextureHandles[i] = -1;\n    }\n\t\n\tprotected void onDrawArraysAfter(){\n\t\tfor(int i = 0; i < inputTextureHandles.length\n\t\t\t\t&& inputTextureHandles[i] != OpenGlUtils.NO_TEXTURE; i++){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3));\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0);\n\t\t}\n\t}\n\t  \n\tprotected void onDrawArraysPre(){\n\t\tfor(int i = 0; i < inputTextureHandles.length \n\t\t\t\t&& inputTextureHandles[i] != OpenGlUtils.NO_TEXTURE; i++){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3) );\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, inputTextureHandles[i]);\n\t\t\tGLES20.glUniform1i(inputTextureUniformLocations[i], (i+3));\n\t\t}\n\t}\n\t\n\tprotected void onInit(){\n\t\tsuper.onInit();\n\t\tfor(int i=0; i < inputTextureUniformLocations.length; i++)\n\t\t\tinputTextureUniformLocations[i] = GLES20.glGetUniformLocation(getProgram(), \"inputImageTexture\"+(2+i));\n\t\tmGLStrengthLocation = GLES20.glGetUniformLocation(mGLProgId,\n\t\t\t\t\"strength\");\n\t}\n\t\n\tprotected void onInitialized(){\n\t\tsuper.onInitialized();\n\t\tsetFloat(mGLStrengthLocation, 1.0f);\n\t    runOnDraw(new Runnable(){\n\t\t    public void run(){\n\t\t    \tinputTextureHandles[0] = OpenGlUtils.loadTexture(MagicParams.context, \"filter/earlybirdcurves.png\");\n\t\t\t\tinputTextureHandles[1] = OpenGlUtils.loadTexture(MagicParams.context, \"filter/earlybirdoverlaymap_new.png\");\n\t\t\t\tinputTextureHandles[2] = OpenGlUtils.loadTexture(MagicParams.context, \"filter/vignettemap_new.png\");\n\t\t\t\tinputTextureHandles[3] = OpenGlUtils.loadTexture(MagicParams.context, \"filter/earlybirdblowout.png\");\n\t\t\t\tinputTextureHandles[4] = OpenGlUtils.loadTexture(MagicParams.context, \"filter/earlybirdmap.png\");\n\t\t    }\n\t    });\n\t}\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/core/filter/advanced/MagicEmeraldFilter.java",
    "content": "package com.zero.magicshow.core.filter.advanced;\n\nimport android.opengl.GLES20;\n\nimport com.zero.magicshow.R;\nimport com.zero.magicshow.core.filter.base.gpuimage.GPUImageFilter;\nimport com.zero.magicshow.common.utils.OpenGlUtils;\n\nimport java.nio.ByteBuffer;\n\npublic class MagicEmeraldFilter extends GPUImageFilter{\n\tprivate int[] mToneCurveTexture = {-1};\n\tprivate int mToneCurveTextureUniformLocation;\n\t  \n\tpublic MagicEmeraldFilter(){\n\t\tsuper(NO_FILTER_VERTEX_SHADER, OpenGlUtils.readShaderFromRawResource(R.raw.emerald));\n\t}\n\t\n\tprotected void onDestroy(){\n\t\tsuper.onDestroy();\n\t    GLES20.glDeleteTextures(1, mToneCurveTexture, 0);\n\t    mToneCurveTexture[0] = -1;\n\t}\n\t  \n\tprotected void onDrawArraysAfter(){\n\t\tif (mToneCurveTexture[0] != -1){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE3);\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0);\n\t    }\n\t}\n\t  \n\tprotected void onDrawArraysPre(){\n\t\tif (mToneCurveTexture[0] != -1){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE3);\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mToneCurveTexture[0]);\n\t\t\tGLES20.glUniform1i(mToneCurveTextureUniformLocation, 3);\n\t    }\n\t}\n\t  \n\tprotected void onInit(){\n\t\tsuper.onInit();\n\t    mToneCurveTextureUniformLocation = GLES20.glGetUniformLocation(mGLProgId, \"curve\");\n\t}\n\t  \n\tprotected void onInitialized(){\n\t\tsuper.onInitialized();\n\t    runOnDraw(new Runnable(){\n\t\t    public void run(){\n\t\t\t    GLES20.glGenTextures(1, mToneCurveTexture, 0);\n\t\t\t    GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mToneCurveTexture[0]);\n\t\t\t    GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t\t                GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);\n\t\t        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t\t                GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);\n\t\t        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t\t                GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);\n\t\t        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t\t                GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);\t\t\t\n\t\t        byte[] arrayOfByte = new byte[2048];\n\t\t        int[] arrayOfInt1 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 3, 4, 7, 8, 9, 10, 12, 13, 14, 17, 18, 19, 21, 22, 23, 25, 26, 29, 30, 31, 32, 34, 35, 36, 39, 40, 41, 43, 44, 45, 46, 48, 50, 51, 53, 54, 55, 56, 58, 60, 61, 62, 64, 65, 66, 67, 69, 70, 72, 73, 75, 76, 77, 78, 79, 81, 82, 84, 85, 87, 88, 89, 90, 91, 92, 94, 96, 97, 98, 99, 101, 102, 103, 104, 105, 106, 107, 110, 111, 112, 113, 114, 115, 116, 117, 119, 120, 121, 122, 123, 125, 126, 127, 128, 129, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 173, 174, 175, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 184, 185, 186, 187, 188, 189, 190, 191, 191, 192, 193, 194, 195, 196, 197, 197, 198, 199, 200, 201, 201, 202, 203, 204, 205, 206, 206, 207, 208, 209, 210, 210, 211, 212, 213, 213, 214, 215, 216, 216, 217, 218, 219, 220, 220, 221, 222, 223, 223, 224, 225, 226, 226, 227, 228, 228, 229, 230, 231, 231, 232, 233, 234, 234, 235, 236, 236, 237, 237, 238, 239, 239, 240, 241, 242, 242, 243, 244, 244, 245, 246, 247, 247, 248, 249, 249, 250, 251, 251, 252, 253, 254, 254, 255 };\n\t\t        int[] arrayOfInt2 = { 0, 0, 0, 0, 0, 0, 1, 3, 4, 5, 7, 8, 9, 10, 12, 13, 14, 16, 18, 19, 21, 22, 23, 25, 26, 27, 29, 30, 31, 32, 34, 35, 36, 37, 39, 40, 41, 43, 44, 45, 46, 48, 50, 51, 53, 54, 55, 56, 58, 59, 60, 61, 62, 64, 65, 66, 67, 69, 70, 71, 72, 73, 75, 76, 77, 78, 79, 82, 83, 84, 85, 87, 88, 89, 90, 91, 92, 94, 95, 96, 97, 98, 99, 101, 102, 103, 104, 105, 106, 107, 109, 111, 112, 113, 114, 115, 116, 117, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 131, 132, 133, 134, 135, 136, 137, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 184, 185, 186, 188, 189, 190, 191, 191, 192, 193, 194, 195, 196, 197, 197, 198, 199, 200, 201, 201, 202, 203, 204, 205, 206, 206, 207, 209, 210, 210, 211, 212, 213, 213, 214, 215, 216, 216, 217, 218, 219, 220, 220, 221, 222, 223, 223, 224, 225, 226, 226, 227, 228, 229, 230, 231, 231, 232, 233, 234, 234, 235, 236, 237, 237, 238, 239, 239, 240, 241, 242, 242, 243, 244, 244, 245, 247, 247, 248, 249, 249, 250, 251, 251, 252, 253, 254, 254, 255, 255, 255, 255, 255, 255 };\n\t\t        int[] arrayOfInt3 = { 0, 1, 3, 4, 5, 7, 8, 9, 10, 12, 13, 14, 16, 17, 18, 19, 21, 22, 23, 25, 26, 27, 29, 30, 31, 32, 34, 35, 36, 37, 39, 40, 41, 43, 44, 45, 46, 48, 49, 50, 51, 53, 54, 55, 56, 58, 59, 60, 61, 62, 64, 65, 66, 67, 69, 70, 71, 72, 73, 75, 76, 77, 78, 79, 81, 82, 83, 84, 85, 87, 88, 89, 90, 91, 92, 94, 95, 96, 97, 98, 99, 101, 102, 103, 104, 105, 106, 107, 109, 110, 111, 112, 113, 114, 115, 116, 117, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 184, 185, 186, 187, 188, 189, 190, 191, 191, 192, 193, 194, 195, 196, 197, 197, 198, 199, 200, 201, 201, 202, 203, 204, 205, 206, 206, 207, 208, 209, 210, 210, 211, 212, 213, 213, 214, 215, 216, 216, 217, 218, 219, 220, 220, 221, 222, 223, 223, 224, 225, 226, 226, 227, 228, 228, 229, 230, 231, 231, 232, 233, 234, 234, 235, 236, 237, 237, 238, 239, 239, 240, 241, 242, 242, 243, 244, 244, 245, 246, 247, 247, 248, 249, 249, 250, 251, 251, 252, 253, 254, 254, 255 };\n\t\t        for (int i = 0; i < 256; i++){\n\t\t          arrayOfByte[(i * 4)] = ((byte)arrayOfInt1[i]);\n\t\t          arrayOfByte[(1 + i * 4)] = ((byte)arrayOfInt2[i]);\n\t\t          arrayOfByte[(2 + i * 4)] = ((byte)arrayOfInt3[i]);\n\t\t          arrayOfByte[(3 + i * 4)] = -1;\n\t\t        }\n\t\t        int[] arrayOfInt4 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 17, 18, 19, 20, 21, 22, 23, 24, 25, 27, 28, 29, 30, 31, 32, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 60, 61, 62, 63, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 123, 124, 125, 126, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 164, 165, 166, 167, 168, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 200, 201, 202, 203, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 224, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 255, 255, 255, 255, 255 };\n\t\t        int[] arrayOfInt5 = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 126, 127, 128, 129, 130, 131, 132, 133, 135, 136, 137, 138, 139, 140, 141, 142, 143, 145, 146, 147, 148, 149, 150, 151, 152, 154, 155, 156, 157, 158, 159, 160, 161, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 223, 224, 225, 226, 227, 228, 229, 229, 230, 231, 232, 233, 233, 234, 235, 236, 237, 237, 238, 239, 240, 240, 241, 242, 243, 243, 244, 245, 245, 246, 247, 247, 248, 249, 249, 250, 250, 251, 252, 252, 253, 253, 254, 254, 255 };\n\t\t        int[] arrayOfInt6 = { 0, 0, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 8, 8, 8, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 20, 20, 20, 21, 21, 21, 22, 22, 23, 23, 23, 24, 24, 24, 25, 25, 25, 25, 26, 26, 27, 27, 28, 28, 28, 28, 29, 29, 30, 29, 31, 31, 31, 31, 32, 32, 33, 33, 34, 34, 34, 34, 35, 35, 36, 36, 37, 37, 37, 38, 38, 39, 39, 39, 40, 40, 40, 41, 42, 42, 43, 43, 44, 44, 45, 45, 45, 46, 47, 47, 48, 48, 49, 50, 51, 51, 52, 52, 53, 53, 54, 55, 55, 56, 57, 57, 58, 59, 60, 60, 61, 62, 63, 63, 64, 65, 66, 67, 68, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 88, 89, 90, 91, 93, 94, 95, 96, 97, 98, 100, 101, 103, 104, 105, 107, 108, 110, 111, 113, 115, 116, 118, 119, 120, 122, 123, 125, 127, 128, 130, 132, 134, 135, 137, 139, 141, 143, 144, 146, 148, 150, 152, 154, 156, 158, 160, 163, 165, 167, 169, 171, 173, 175, 178, 180, 182, 185, 187, 189, 192, 194, 197, 199, 201, 204, 206, 209, 211, 214, 216, 219, 221, 224, 226, 229, 232, 234, 236, 239, 241, 245, 247, 250, 252, 255 };\n\t\t        for (int j = 0; j < 256; j++){\n\t\t          arrayOfByte[(1024 + j * 4)] = ((byte)arrayOfInt5[j]);\n\t\t          arrayOfByte[(1 + (1024 + j * 4))] = ((byte)arrayOfInt4[j]);\n\t\t          arrayOfByte[(2 + (1024 + j * 4))] = ((byte)arrayOfInt6[j]);\n\t\t          arrayOfByte[(3 + (1024 + j * 4))] = -1;\n\t\t        }\n\t\t        GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, 256, 2, 0, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, ByteBuffer.wrap(arrayOfByte));\n\t\t    }\n\t    });\n\t}\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/core/filter/advanced/MagicEvergreenFilter.java",
    "content": "package com.zero.magicshow.core.filter.advanced;\n\nimport android.opengl.GLES20;\n\nimport com.zero.magicshow.R;\nimport com.zero.magicshow.core.filter.base.gpuimage.GPUImageFilter;\nimport com.zero.magicshow.common.utils.OpenGlUtils;\n\nimport java.nio.ByteBuffer;\n\npublic class MagicEvergreenFilter extends GPUImageFilter{\n\tprivate int[] mToneCurveTexture = {-1};\n\tprivate int mToneCurveTextureUniformLocation;\n\t  \n\tpublic MagicEvergreenFilter(){\n\t\tsuper(NO_FILTER_VERTEX_SHADER, OpenGlUtils.readShaderFromRawResource(R.raw.evergreen));\n\t}\n\t\n\tprotected void onDestroy(){\n\t\tsuper.onDestroy();\n\t    GLES20.glDeleteTextures(1, mToneCurveTexture, 0);\n\t    mToneCurveTexture[0] = -1;\n\t}\n\t  \n\tprotected void onDrawArraysAfter(){\n\t\tif (mToneCurveTexture[0] != -1){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE3);\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0);\n\t    }\n\t}\n\t  \n\tprotected void onDrawArraysPre(){\n\t\tif (mToneCurveTexture[0] != -1){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE3);\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mToneCurveTexture[0]);\n\t\t\tGLES20.glUniform1i(mToneCurveTextureUniformLocation, 3);\n\t    }\n\t}\n\t  \n\tprotected void onInit(){\n\t\tsuper.onInit();\n\t    mToneCurveTextureUniformLocation = GLES20.glGetUniformLocation(mGLProgId, \"curve\");\n\t}\n\t  \n\tprotected void onInitialized(){\n\t\tsuper.onInitialized();\n\t    runOnDraw(new Runnable(){\n\t\t    public void run(){\n\t\t    \tGLES20.glGenTextures(1, mToneCurveTexture, 0);\n\t\t\t    GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mToneCurveTexture[0]);\n\t\t\t    GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t\t                GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);\n\t\t        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t\t                GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);\n\t\t        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t\t                GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);\n\t\t        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t\t                GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);\t\t\t\t\t\n\t\t        byte[] arrayOfByte = new byte[1024];\n\t\t        int[] arrayOfInt1 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255 };\n\t\t        int[] arrayOfInt2 = { 0, 1, 1, 2, 3, 4, 4, 5, 6, 6, 7, 8, 9, 9, 10, 11, 12, 12, 13, 14, 15, 15, 16, 17, 17, 18, 19, 20, 21, 21, 22, 23, 24, 24, 25, 26, 27, 28, 28, 29, 30, 31, 32, 32, 33, 34, 35, 36, 37, 38, 38, 39, 40, 41, 42, 43, 44, 45, 46, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 90, 91, 92, 93, 94, 95, 96, 97, 99, 100, 101, 102, 103, 104, 105, 107, 108, 109, 110, 111, 112, 113, 115, 116, 117, 118, 119, 120, 122, 123, 124, 125, 126, 127, 129, 130, 131, 132, 133, 135, 136, 137, 138, 139, 140, 142, 143, 144, 145, 146, 148, 149, 150, 151, 152, 153, 155, 156, 157, 158, 159, 160, 162, 163, 164, 165, 166, 167, 169, 170, 171, 172, 173, 174, 175, 177, 178, 179, 180, 181, 182, 183, 185, 186, 187, 188, 189, 190, 191, 192, 193, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 241, 242, 243, 244, 245, 246, 247, 247, 248, 249, 250, 251, 252, 252, 253, 254, 255 };\n\t\t        int[] arrayOfInt3 = { 0, 2, 4, 6, 8, 10, 11, 13, 16, 17, 19, 20, 21, 23, 24, 25, 27, 28, 29, 31, 32, 33, 34, 36, 38, 39, 40, 42, 43, 44, 45, 46, 48, 49, 50, 51, 52, 53, 54, 56, 58, 59, 60, 61, 62, 63, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 76, 77, 78, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 128, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 144, 145, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 157, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 168, 169, 170, 171, 172, 173, 175, 176, 177, 177, 178, 179, 180, 181, 182, 183, 184, 185, 185, 186, 187, 188, 190, 191, 192, 193, 193, 194, 195, 196, 197, 198, 199, 200, 200, 201, 202, 203, 205, 206, 207, 207, 208, 209, 210, 211, 212, 213, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 225, 226, 227, 228, 229, 230, 231, 231, 232, 234, 235, 236, 237, 237, 238, 239, 240, 241, 242, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 252, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 };\n\t\t        int[] arrayOfInt4 = { 0, 0, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 8, 8, 8, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 20, 20, 20, 21, 21, 21, 22, 22, 23, 23, 23, 24, 24, 24, 25, 25, 25, 25, 26, 26, 27, 27, 28, 28, 28, 28, 29, 29, 30, 29, 31, 31, 31, 31, 32, 32, 33, 33, 34, 34, 34, 34, 35, 35, 36, 36, 37, 37, 37, 38, 38, 39, 39, 39, 40, 40, 40, 41, 42, 42, 43, 43, 44, 44, 45, 45, 45, 46, 47, 47, 48, 48, 49, 50, 51, 51, 52, 52, 53, 53, 54, 55, 55, 56, 57, 57, 58, 59, 60, 60, 61, 62, 63, 63, 64, 65, 66, 67, 68, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 88, 89, 90, 91, 93, 94, 95, 96, 97, 98, 100, 101, 103, 104, 105, 107, 108, 110, 111, 113, 115, 116, 118, 119, 120, 122, 123, 125, 127, 128, 130, 132, 134, 135, 137, 139, 141, 143, 144, 146, 148, 150, 152, 154, 156, 158, 160, 163, 165, 167, 169, 171, 173, 175, 178, 180, 182, 185, 187, 189, 192, 194, 197, 199, 201, 204, 206, 209, 211, 214, 216, 219, 221, 224, 226, 229, 232, 234, 236, 239, 241, 245, 247, 250, 252, 255 };\n\t\t        for (int i = 0; i < 256; i++)\n\t\t        {\n\t\t          arrayOfByte[(i * 4)] = ((byte)arrayOfInt1[i]);\n\t\t          arrayOfByte[(1 + i * 4)] = ((byte)arrayOfInt2[i]);\n\t\t          arrayOfByte[(2 + i * 4)] = ((byte)arrayOfInt3[i]);\n\t\t          arrayOfByte[(3 + i * 4)] = ((byte)arrayOfInt4[i]);\n\t\t        }\n\t\t        GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, 256, 1, 0, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, ByteBuffer.wrap(arrayOfByte));\n\t\t    }\n\t    });\n\t}\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/core/filter/advanced/MagicFairytaleFilter.java",
    "content": "package com.zero.magicshow.core.filter.advanced;\n\nimport com.zero.magicshow.core.filter.base.MagicLookupFilter;\n\npublic class MagicFairytaleFilter extends MagicLookupFilter{\n\n\tpublic MagicFairytaleFilter() {\n\t\tsuper(\"filter/fairy_tale.png\");\n\t}\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/core/filter/advanced/MagicFreudFilter.java",
    "content": "package com.zero.magicshow.core.filter.advanced;\n\nimport android.opengl.GLES20;\n\nimport com.zero.magicshow.R;\nimport com.zero.magicshow.core.filter.base.gpuimage.GPUImageFilter;\nimport com.zero.magicshow.common.utils.MagicParams;\nimport com.zero.magicshow.common.utils.OpenGlUtils;\n\npublic class MagicFreudFilter extends GPUImageFilter{\n\tprivate int mTexelHeightUniformLocation;\n    private int mTexelWidthUniformLocation;\n\tprivate int[] inputTextureHandles = {-1};\n\tprivate int[] inputTextureUniformLocations = {-1};\n\tprivate int mGLStrengthLocation;\n\n\tpublic MagicFreudFilter(){\n\t\tsuper(NO_FILTER_VERTEX_SHADER, OpenGlUtils.readShaderFromRawResource(R.raw.freud));\n\t}\n\t\n\tprotected void onDestroy() {\n        super.onDestroy();\n        GLES20.glDeleteTextures(1, inputTextureHandles, 0);\n        for(int i = 0; i < inputTextureHandles.length; i++)\n        \tinputTextureHandles[i] = -1;\n    }\n\t\n\tprotected void onDrawArraysAfter(){\n\t\tfor(int i = 0; i < inputTextureHandles.length\n\t\t\t\t&& inputTextureHandles[i] != OpenGlUtils.NO_TEXTURE; i++){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3));\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0);\n\t\t}\n\t}\n\t  \n\tprotected void onDrawArraysPre(){\n\t\tfor(int i = 0; i < inputTextureHandles.length \n\t\t\t\t&& inputTextureHandles[i] != OpenGlUtils.NO_TEXTURE; i++){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3) );\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, inputTextureHandles[i]);\n\t\t\tGLES20.glUniform1i(inputTextureUniformLocations[i], (i+3));\n\t\t}\n\t}\n\t\n\tprotected void onInit(){\n\t\tsuper.onInit();\n\t\tinputTextureUniformLocations[0] = GLES20.glGetUniformLocation(getProgram(), \"inputImageTexture2\");\n\t\t\n\t\tmTexelWidthUniformLocation = GLES20.glGetUniformLocation(getProgram(), \"inputImageTextureWidth\");\n        mTexelHeightUniformLocation = GLES20.glGetUniformLocation(getProgram(), \"inputImageTextureHeight\");\n\n\t\tmGLStrengthLocation = GLES20.glGetUniformLocation(mGLProgId,\n\t\t\t\t\"strength\");\n\t}\n\t\n\tprotected void onInitialized(){\n\t\tsuper.onInitialized();\n\t\tsetFloat(mGLStrengthLocation, 1.0f);\n\t    runOnDraw(new Runnable(){\n\t\t    public void run(){\n\t\t    \tinputTextureHandles[0] = OpenGlUtils.loadTexture(MagicParams.context, \"filter/freud_rand.png\");\n\t\t    }\n\t    });\n\t}\n\t\n\tpublic void onInputSizeChanged(int width, int height) {\n        super.onInputSizeChanged(width, height);\n        GLES20.glUniform1f(mTexelWidthUniformLocation, (float)width);\n        GLES20.glUniform1f(mTexelHeightUniformLocation, (float)height);\n    }\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/core/filter/advanced/MagicHealthyFilter.java",
    "content": "package com.zero.magicshow.core.filter.advanced;\n\nimport android.opengl.GLES20;\n\nimport com.zero.magicshow.R;\nimport com.zero.magicshow.core.filter.base.gpuimage.GPUImageFilter;\nimport com.zero.magicshow.common.utils.MagicParams;\nimport com.zero.magicshow.common.utils.OpenGlUtils;\n\nimport java.nio.ByteBuffer;\n\npublic class MagicHealthyFilter extends GPUImageFilter{\n\t\n\tprivate int[] mToneCurveTexture = {-1};\n\tprivate int mToneCurveTextureUniformLocation;\n\tprivate int mMaskGrey1TextureId = -1;\n\tprivate int mMaskGrey1UniformLocation;\n\tprivate int mTexelHeightUniformLocation;\n\tprivate int mTexelWidthUniformLocation;\n\n\tpublic MagicHealthyFilter(){\n\t\tsuper(NO_FILTER_VERTEX_SHADER, OpenGlUtils.readShaderFromRawResource(R.raw.healthy));\n\t}\n\t\n\tprotected void onDestroy(){\n\t\tsuper.onDestroy();\n\t    GLES20.glDeleteTextures(1, mToneCurveTexture, 0);\n\t    mToneCurveTexture[0] = -1;\n\t    int[] texture = new int[1];\n\t    texture[0] = mMaskGrey1TextureId;\n\t    GLES20.glDeleteTextures(1, texture, 0);\n\t    mMaskGrey1TextureId = -1;\n\t}\n\t  \n\tprotected void onDrawArraysAfter(){\n\t\tif (mToneCurveTexture[0] != -1){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE3);\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0);\n\t    }\n\t\tif (mMaskGrey1TextureId != -1){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE4);\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0);\n\t    }\n\t}\n\t  \n\tprotected void onDrawArraysPre(){\n\t\tif (mToneCurveTexture[0] != -1){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE3);\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mToneCurveTexture[0]);\n\t\t\tGLES20.glUniform1i(mToneCurveTextureUniformLocation, 3);\n\t    }\n\t\tif (mMaskGrey1TextureId != -1){\n\t      GLES20.glActiveTexture(GLES20.GL_TEXTURE4);\n\t      GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mMaskGrey1TextureId);\n\t      GLES20.glUniform1i(mMaskGrey1UniformLocation, 4);\n\t    }\n\t}\n\t  \n\tprotected void onInit(){\n\t\tsuper.onInit();\n\t    mToneCurveTextureUniformLocation = GLES20.glGetUniformLocation(mGLProgId, \"curve\");\n        mMaskGrey1UniformLocation = GLES20.glGetUniformLocation(getProgram(), \"mask\");\n        mTexelWidthUniformLocation = GLES20.glGetUniformLocation(getProgram(), \"texelWidthOffset\");\n        mTexelHeightUniformLocation = GLES20.glGetUniformLocation(getProgram(), \"texelHeightOffset\");\n\t}\n\t  \n\tprotected void onInitialized(){\n\t\tsuper.onInitialized();\n\t    runOnDraw(new Runnable(){\n\t\t    public void run(){\n\t\t    \tGLES20.glGenTextures(1, mToneCurveTexture, 0);\n\t\t\t    GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mToneCurveTexture[0]);\n\t\t\t    GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t\t                GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);\n\t\t        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t\t                GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);\n\t\t        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t\t                GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);\n\t\t        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t\t                GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);\t\t\t\t\t\n\t\t        byte[] arrayOfByte = new byte[1024];\n\t\t        int[] arrayOfInt1 = { 95, 95, 96, 97, 97, 98, 99, 99, 100, 101, 101, 102, 103, 104, 104, 105, 106, 106, 107, 108, 108, 109, 110, 111, 111, 112, 113, 113, 114, 115, 115, 116, 117, 117, 118, 119, 120, 120, 121, 122, 122, 123, 124, 124, 125, 126, 127, 127, 128, 129, 129, 130, 131, 131, 132, 133, 133, 134, 135, 136, 136, 137, 138, 138, 139, 140, 140, 141, 142, 143, 143, 144, 145, 145, 146, 147, 147, 148, 149, 149, 150, 151, 152, 152, 153, 154, 154, 155, 156, 156, 157, 158, 159, 159, 160, 161, 161, 162, 163, 163, 164, 165, 165, 166, 167, 168, 168, 169, 170, 170, 171, 172, 172, 173, 174, 175, 175, 176, 177, 177, 178, 179, 179, 180, 181, 181, 182, 183, 184, 184, 185, 186, 186, 187, 188, 188, 189, 190, 191, 191, 192, 193, 193, 194, 195, 195, 196, 197, 197, 198, 199, 200, 200, 201, 202, 202, 203, 204, 204, 205, 206, 207, 207, 208, 209, 209, 210, 211, 211, 212, 213, 213, 214, 215, 216, 216, 217, 218, 218, 219, 220, 220, 221, 222, 223, 223, 224, 225, 225, 226, 227, 227, 228, 229, 229, 230, 231, 232, 232, 233, 234, 234, 235, 236, 236, 237, 238, 239, 239, 240, 241, 241, 242, 243, 243, 244, 245, 245, 246, 247, 248, 248, 249, 250, 250, 251, 252, 252, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 };\n\t\t        int[] arrayOfInt2 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 4, 5, 7, 8, 9, 12, 13, 14, 15, 16, 17, 19, 20, 21, 22, 23, 24, 25, 26, 27, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 41, 42, 43, 44, 45, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 60, 61, 62, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 168, 169, 170, 171, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 189, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 204, 205, 206, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 219, 220, 221, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 234, 235, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 249, 249, 250, 251, 252, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255 };\n\t\t        int[] arrayOfInt3 = { 0, 1, 2, 3, 3, 4, 5, 6, 7, 8, 9, 10, 10, 11, 12, 13, 14, 15, 16, 17, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 95, 96, 97, 98, 99, 100, 101, 102, 103, 105, 106, 107, 108, 109, 110, 111, 112, 114, 115, 116, 117, 118, 119, 120, 121, 122, 124, 125, 126, 127, 128, 129, 130, 131, 132, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 249, 250, 251, 252, 253, 254, 255 };\n\t\t        for (int i = 0; i < 256; i++)\n\t\t        {\n\t\t          arrayOfByte[(i * 4)] = ((byte)arrayOfInt3[i]);\n\t\t          arrayOfByte[(1 + i * 4)] = ((byte)arrayOfInt2[i]);\n\t\t          arrayOfByte[(2 + i * 4)] = ((byte)arrayOfInt1[i]);\n\t\t          arrayOfByte[(3 + i * 4)] = -1;\n\t\t        }\n\t\t        GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, 256, 1, 0, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, ByteBuffer.wrap(arrayOfByte));\n\t\t        mMaskGrey1TextureId = OpenGlUtils.loadTexture(MagicParams.context, \"filter/healthy_mask_1.jpg\");\n\t\t    }\n\t    });\n\t}\n\t\n\tpublic void onInputSizeChanged(int width, int height){\n\t\tsuper.onInputSizeChanged(width, height);\n\t    GLES20.glUniform1f(mTexelWidthUniformLocation, 1.0f / width);\n\t    GLES20.glUniform1f(mTexelHeightUniformLocation, 1.0f / height);\n\t}\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/core/filter/advanced/MagicHefeFilter.java",
    "content": "package com.zero.magicshow.core.filter.advanced;\n\nimport android.opengl.GLES20;\n\nimport com.zero.magicshow.R;\nimport com.zero.magicshow.core.filter.base.gpuimage.GPUImageFilter;\nimport com.zero.magicshow.common.utils.MagicParams;\nimport com.zero.magicshow.common.utils.OpenGlUtils;\n\npublic class MagicHefeFilter extends GPUImageFilter{\n\tprivate int[] inputTextureHandles = {-1,-1,-1,-1};\n\tprivate int[] inputTextureUniformLocations = {-1,-1,-1,-1};\n    private int mGLStrengthLocation;\n\n\tpublic MagicHefeFilter(){\n\t\tsuper(NO_FILTER_VERTEX_SHADER, OpenGlUtils.readShaderFromRawResource(R.raw.hefe));\n\t}\n\t\n\tprotected void onDestroy() {\n        super.onDestroy();\n        GLES20.glDeleteTextures(inputTextureHandles.length, inputTextureHandles, 0);\n        for(int i = 0; i < inputTextureHandles.length; i++)\n        \tinputTextureHandles[i] = -1;\n    }\n\t\n\tprotected void onDrawArraysAfter(){\n\t\tfor(int i = 0; i < inputTextureHandles.length\n\t\t\t\t&& inputTextureHandles[i] != OpenGlUtils.NO_TEXTURE; i++){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3));\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0);\n\t\t}\n\t}\n\t  \n\tprotected void onDrawArraysPre(){\n\t\tfor(int i = 0; i < inputTextureHandles.length \n\t\t\t\t&& inputTextureHandles[i] != OpenGlUtils.NO_TEXTURE; i++){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3) );\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, inputTextureHandles[i]);\n\t\t\tGLES20.glUniform1i(inputTextureUniformLocations[i], (i+3));\n\t\t}\n\t}\n\t\n\tprotected void onInit(){\n\t\tsuper.onInit();\n\t\tfor(int i=0; i < inputTextureUniformLocations.length; i++)\n\t\t\tinputTextureUniformLocations[i] = GLES20.glGetUniformLocation(getProgram(), \"inputImageTexture\"+(2+i));\n\t\tmGLStrengthLocation = GLES20.glGetUniformLocation(mGLProgId,\n\t\t\t\t\"strength\");\n\t}\n\t\n\tprotected void onInitialized(){\n\t\tsuper.onInitialized();\n\t\tsetFloat(mGLStrengthLocation, 1.0f);\n\t    runOnDraw(new Runnable(){\n\t\t    public void run(){\n\t\t    \tinputTextureHandles[0] = OpenGlUtils.loadTexture(MagicParams.context, \"filter/edgeburn.png\");\n\t\t\t\tinputTextureHandles[1] = OpenGlUtils.loadTexture(MagicParams.context, \"filter/hefemap.png\");\n\t\t\t\tinputTextureHandles[2] = OpenGlUtils.loadTexture(MagicParams.context, \"filter/hefemetal.png\");\n\t\t\t\tinputTextureHandles[3] = OpenGlUtils.loadTexture(MagicParams.context, \"filter/hefesoftlight.png\");\n\t\t    }\n\t    });\n\t}\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/core/filter/advanced/MagicHudsonFilter.java",
    "content": "package com.zero.magicshow.core.filter.advanced;\n\nimport android.opengl.GLES20;\n\nimport com.zero.magicshow.R;\nimport com.zero.magicshow.core.filter.base.gpuimage.GPUImageFilter;\nimport com.zero.magicshow.common.utils.MagicParams;\nimport com.zero.magicshow.common.utils.OpenGlUtils;\n\npublic class MagicHudsonFilter extends GPUImageFilter{\n\tprivate int[] inputTextureHandles = {-1,-1,-1};\n\tprivate int[] inputTextureUniformLocations = {-1,-1,-1};\n    private int mGLStrengthLocation;\n\n\tpublic MagicHudsonFilter(){\n\t\tsuper(NO_FILTER_VERTEX_SHADER, OpenGlUtils.readShaderFromRawResource(R.raw.hudson));\n\t}\n\t\n\tprotected void onDestroy() {\n        super.onDestroy();\n        GLES20.glDeleteTextures(inputTextureHandles.length, inputTextureHandles, 0);\n        for(int i = 0; i < inputTextureHandles.length; i++)\n        \tinputTextureHandles[i] = -1;\n    }\n\t\n\tprotected void onDrawArraysAfter(){\n\t\tfor(int i = 0; i < inputTextureHandles.length\n\t\t\t\t&& inputTextureHandles[i] != OpenGlUtils.NO_TEXTURE; i++){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3));\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0);\n\t\t}\n\t}\n\t  \n\tprotected void onDrawArraysPre(){\n\t\tfor(int i = 0; i < inputTextureHandles.length \n\t\t\t\t&& inputTextureHandles[i] != OpenGlUtils.NO_TEXTURE; i++){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3) );\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, inputTextureHandles[i]);\n\t\t\tGLES20.glUniform1i(inputTextureUniformLocations[i], (i+3));\n\t\t}\n\t}\n\t\n\tprotected void onInit(){\n\t\tsuper.onInit();\n\t\tfor(int i=0; i < inputTextureUniformLocations.length; i++)\n\t\t\tinputTextureUniformLocations[i] = GLES20.glGetUniformLocation(getProgram(), \"inputImageTexture\"+(2+i));\n\t\tmGLStrengthLocation = GLES20.glGetUniformLocation(mGLProgId,\n\t\t\t\t\"strength\");\n\t}\n\t\n\tprotected void onInitialized(){\n\t\tsuper.onInitialized();\n\t\tsetFloat(mGLStrengthLocation, 1.0f);\n\t    runOnDraw(new Runnable(){\n\t\t    public void run(){\n\t\t    \tinputTextureHandles[0] = OpenGlUtils.loadTexture(MagicParams.context, \"filter/hudsonbackground.png\");\n\t\t\t\tinputTextureHandles[1] = OpenGlUtils.loadTexture(MagicParams.context, \"filter/overlaymap.png\");\n\t\t\t\tinputTextureHandles[2] = OpenGlUtils.loadTexture(MagicParams.context, \"filter/hudsonmap.png\");\n\t\t    }\n\t    });\n\t}\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/core/filter/advanced/MagicImageAdjustFilter.java",
    "content": "package com.zero.magicshow.core.filter.advanced;\n\nimport com.zero.magicshow.core.filter.base.MagicBaseGroupFilter;\nimport com.zero.magicshow.core.filter.base.gpuimage.GPUImageBrightnessFilter;\nimport com.zero.magicshow.core.filter.base.gpuimage.GPUImageContrastFilter;\nimport com.zero.magicshow.core.filter.base.gpuimage.GPUImageExposureFilter;\nimport com.zero.magicshow.core.filter.base.gpuimage.GPUImageFilter;\nimport com.zero.magicshow.core.filter.base.gpuimage.GPUImageHueFilter;\nimport com.zero.magicshow.core.filter.base.gpuimage.GPUImageSaturationFilter;\nimport com.zero.magicshow.core.filter.base.gpuimage.GPUImageSharpenFilter;\nimport com.zero.magicshow.core.filter.utils.MagicFilterType;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\npublic class MagicImageAdjustFilter extends MagicBaseGroupFilter{\n\t\n\tpublic MagicImageAdjustFilter() {\n\t\tsuper(initFilters());\n\t}\n\t\n\tprivate static List<GPUImageFilter> initFilters(){\n\t\tList<GPUImageFilter> filters = new ArrayList<GPUImageFilter>();\n\t\tfilters.add(new GPUImageContrastFilter());\n\t\tfilters.add(new GPUImageBrightnessFilter());\n\t\tfilters.add(new GPUImageExposureFilter());\n\t\tfilters.add(new GPUImageHueFilter());\n\t\tfilters.add(new GPUImageSaturationFilter());\n\t\tfilters.add(new GPUImageSharpenFilter());\n\t\treturn filters;\t\t\n\t}\n\n\tpublic void setImageFilter(float range,MagicFilterType type){\n\t\tswitch (type){\n\t\t\tcase CONTRAST:\n\t\t\t\tsetContrast(range);\n\t\t\t\tbreak;\n\t\t\tcase BRIGHTNESS:\n\t\t\t\tsetBrightness(range);\n\t\t\t\tbreak;\n\t\t\tcase EXPOSURE:\n\t\t\t\tsetExposure(range);\n\t\t\t\tbreak;\n\t\t\tcase HUE:\n\t\t\t\tsetHue(range);\n\t\t\t\tbreak;\n\t\t\tcase SATURATION:\n\t\t\t\tsetSaturation(range);\n\t\t\t\tbreak;\n\t\t\tcase SHARPEN:\n\t\t\t\tsetSharpness(range);\n\t\t\t\tbreak;\n\t\t}\n\t}\n\tpublic void setSharpness(final float range){\n\t\t((GPUImageSharpenFilter) filters.get(5)).setSharpness(range);\n\t}\n\t\n\tpublic void setHue(final float range){\n\t\t((GPUImageHueFilter) filters.get(3)).setHue(range);\n\t}\n\t\n\tpublic void setBrightness(final float range){\n\t\t((GPUImageBrightnessFilter) filters.get(1)).setBrightness(range);\n\t}\n\t\n\tpublic void setContrast(final float range){\n\t\t((GPUImageContrastFilter) filters.get(0)).setContrast(range);\n\t}\n\t\n\tpublic void setSaturation(final float range){\n\t\t((GPUImageSaturationFilter) filters.get(4)).setSaturation(range);\n\t}\n\t\n\tpublic void setExposure(final float range){\n\t\t((GPUImageExposureFilter) filters.get(2)).setExposure(range);\n\t}\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/core/filter/advanced/MagicInkwellFilter.java",
    "content": "package com.zero.magicshow.core.filter.advanced;\n\nimport android.opengl.GLES20;\n\nimport com.zero.magicshow.R;\nimport com.zero.magicshow.core.filter.base.gpuimage.GPUImageFilter;\nimport com.zero.magicshow.common.utils.MagicParams;\nimport com.zero.magicshow.common.utils.OpenGlUtils;\n\npublic class MagicInkwellFilter extends GPUImageFilter{\n\tprivate int[] inputTextureHandles = {-1};\n\tprivate int[] inputTextureUniformLocations = {-1};\n    private int mGLStrengthLocation;\n\n\tpublic MagicInkwellFilter(){\n\t\tsuper(NO_FILTER_VERTEX_SHADER, OpenGlUtils.readShaderFromRawResource(R.raw.inkwell));\n\t}\n\t\n\tpublic void onDestroy() {\n        super.onDestroy();\n        GLES20.glDeleteTextures(1, inputTextureHandles, 0);\n        for(int i = 0; i < inputTextureHandles.length; i++)\n        \tinputTextureHandles[i] = -1;\n    }\n\t\n\tprotected void onDrawArraysAfter(){\n\t\tfor(int i = 0; i < inputTextureHandles.length\n\t\t\t\t&& inputTextureHandles[i] != OpenGlUtils.NO_TEXTURE; i++){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3));\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0);\n\t\t}\n\t}\n\t  \n\tprotected void onDrawArraysPre(){\n\t\tfor(int i = 0; i < inputTextureHandles.length \n\t\t\t\t&& inputTextureHandles[i] != OpenGlUtils.NO_TEXTURE; i++){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3) );\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, inputTextureHandles[i]);\n\t\t\tGLES20.glUniform1i(inputTextureUniformLocations[i], (i+3));\n\t\t}\n\t}\n\t\n\tprotected void onInit(){\n\t\tsuper.onInit();\n\t\tfor(int i=0; i < inputTextureUniformLocations.length; i++)\n\t\t\tinputTextureUniformLocations[i] = GLES20.glGetUniformLocation(getProgram(), \"inputImageTexture\"+(2+i));\n\t\tmGLStrengthLocation = GLES20.glGetUniformLocation(mGLProgId,\n\t\t\t\t\"strength\");\n\t}\n\t\n\tprotected void onInitialized(){\n\t\tsuper.onInitialized();\n\t\tsetFloat(mGLStrengthLocation, 1.0f);\n\t    runOnDraw(new Runnable(){\n\t\t    public void run(){\n\t\t    \tinputTextureHandles[0] = OpenGlUtils.loadTexture(MagicParams.context, \"filter/inkwellmap.png\");\n\t\t    }\n\t    });\n\t}\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/core/filter/advanced/MagicKevinFilter.java",
    "content": "package com.zero.magicshow.core.filter.advanced;\n\nimport android.opengl.GLES20;\n\nimport com.zero.magicshow.R;\nimport com.zero.magicshow.core.filter.base.gpuimage.GPUImageFilter;\nimport com.zero.magicshow.common.utils.MagicParams;\nimport com.zero.magicshow.common.utils.OpenGlUtils;\n\npublic class MagicKevinFilter extends GPUImageFilter{\n\tprivate int[] inputTextureHandles = {-1};\n\tprivate int[] inputTextureUniformLocations = {-1};\n\tprivate int mGLStrengthLocation;\n\n\tpublic MagicKevinFilter(){\n\t\tsuper(NO_FILTER_VERTEX_SHADER, OpenGlUtils.readShaderFromRawResource(R.raw.kevin_new));\n\t}\n\t\n\tprotected void onDestroy() {\n        super.onDestroy();\n        GLES20.glDeleteTextures(1, inputTextureHandles, 0);\n        for(int i = 0; i < inputTextureHandles.length; i++)\n        \tinputTextureHandles[i] = -1;\n    }\n\t\n\tprotected void onDrawArraysAfter(){\n\t\tfor(int i = 0; i < inputTextureHandles.length\n\t\t\t\t&& inputTextureHandles[i] != OpenGlUtils.NO_TEXTURE; i++){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3));\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0);\n\t\t}\n\t}\n\t  \n\tprotected void onDrawArraysPre(){\n\t\tfor(int i = 0; i < inputTextureHandles.length \n\t\t\t\t&& inputTextureHandles[i] != OpenGlUtils.NO_TEXTURE; i++){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3) );\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, inputTextureHandles[i]);\n\t\t\tGLES20.glUniform1i(inputTextureUniformLocations[i], (i+3));\n\t\t}\n\t}\n\t\n\tprotected void onInit(){\n\t\tsuper.onInit();\t\t\n\t\tfor(int i=0; i < inputTextureUniformLocations.length; i++)\n\t\t\tinputTextureUniformLocations[i] = GLES20.glGetUniformLocation(getProgram(), \"inputImageTexture\"+(2+i));\n\t\tmGLStrengthLocation = GLES20.glGetUniformLocation(mGLProgId,\n\t\t\t\t\"strength\");\n\t}\n\t\n\tprotected void onInitialized(){\n\t\tsuper.onInitialized();\n\t\tsetFloat(mGLStrengthLocation, 1.0f);\n\t    runOnDraw(new Runnable(){\n\t\t    public void run(){\n\t\t    \tinputTextureHandles[0] = OpenGlUtils.loadTexture(MagicParams.context, \"filter/kelvinmap.png\");\n\t\t    }\n\t    });\n\t}\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/core/filter/advanced/MagicLatteFilter.java",
    "content": "package com.zero.magicshow.core.filter.advanced;\n\nimport android.opengl.GLES20;\n\nimport com.zero.magicshow.R;\nimport com.zero.magicshow.core.filter.base.gpuimage.GPUImageFilter;\nimport com.zero.magicshow.common.utils.OpenGlUtils;\n\nimport java.nio.ByteBuffer;\n\npublic class MagicLatteFilter extends GPUImageFilter{\n\tprivate int[] mToneCurveTexture = {-1};\n\tprivate int mToneCurveTextureUniformLocation;\n\t  \n\tpublic MagicLatteFilter(){\n\t\tsuper(NO_FILTER_VERTEX_SHADER, OpenGlUtils.readShaderFromRawResource(R.raw.latte));\n\t}\n\t\n\tprotected void onDestroy(){\n\t\tsuper.onDestroy();\n\t    GLES20.glDeleteTextures(1, mToneCurveTexture, 0);\n\t    mToneCurveTexture[0] = -1;\n\t}\n\t  \n\tprotected void onDrawArraysAfter(){\n\t\tif (mToneCurveTexture[0] != -1){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE3);\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0);\n\t    }\n\t}\n\t  \n\tprotected void onDrawArraysPre(){\n\t\tif (mToneCurveTexture[0] != -1){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE3);\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mToneCurveTexture[0]);\n\t\t\tGLES20.glUniform1i(mToneCurveTextureUniformLocation, 3);\n\t    }\n\t}\n\t  \n\tprotected void onInit(){\n\t\tsuper.onInit();\n\t    mToneCurveTextureUniformLocation = GLES20.glGetUniformLocation(mGLProgId, \"curve\");\n\t}\n\t  \n\tprotected void onInitialized(){\n\t\tsuper.onInitialized();\n\t    runOnDraw(new Runnable(){\n\t\t    public void run(){\n\t\t    \tGLES20.glGenTextures(1, mToneCurveTexture, 0);\n\t\t\t    GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mToneCurveTexture[0]);\n\t\t\t    GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t\t                GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);\n\t\t        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t\t                GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);\n\t\t        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t\t                GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);\n\t\t        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t\t                GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);\t\t\t\t\t\n\t\t        byte[] arrayOfByte = new byte[2048];\n\t\t        int[] arrayOfInt1 = { 5, 6, 8, 9, 11, 12, 14, 15, 16, 18, 19, 21, 22, 23, 25, 26, 28, 29, 30, 32, 33, 34, 36, 37, 39, 40, 41, 43, 44, 45, 46, 48, 49, 50, 52, 53, 54, 55, 56, 58, 59, 60, 61, 62, 64, 65, 66, 67, 68, 69, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 108, 109, 110, 111, 112, 113, 114, 115, 115, 116, 117, 118, 119, 120, 120, 121, 122, 123, 124, 125, 125, 126, 127, 128, 129, 130, 130, 131, 132, 133, 134, 134, 135, 136, 137, 137, 138, 139, 140, 141, 141, 142, 143, 144, 145, 145, 146, 147, 148, 148, 149, 150, 151, 151, 152, 153, 154, 155, 155, 156, 157, 158, 158, 159, 160, 161, 162, 162, 163, 164, 165, 166, 166, 167, 168, 169, 170, 170, 171, 172, 173, 174, 174, 175, 176, 177, 178, 178, 179, 180, 181, 182, 183, 183, 184, 185, 186, 187, 188, 189, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255 };\n\t\t        int[] arrayOfInt2 = { 5, 6, 8, 11, 12, 14, 15, 18, 19, 21, 22, 25, 26, 28, 29, 32, 33, 34, 36, 39, 40, 41, 43, 44, 46, 48, 49, 50, 52, 54, 55, 56, 58, 59, 61, 62, 64, 65, 66, 67, 69, 71, 72, 73, 74, 75, 76, 78, 79, 80, 81, 82, 83, 85, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 108, 108, 109, 110, 111, 112, 113, 114, 115, 115, 116, 117, 118, 119, 120, 120, 121, 122, 123, 125, 125, 126, 127, 128, 129, 130, 130, 131, 132, 133, 134, 134, 135, 136, 137, 137, 138, 139, 140, 141, 141, 142, 143, 144, 145, 145, 146, 147, 148, 148, 149, 149, 150, 151, 151, 152, 153, 154, 155, 155, 156, 157, 158, 158, 159, 160, 161, 162, 162, 163, 164, 165, 165, 166, 166, 167, 168, 169, 170, 170, 171, 172, 173, 174, 174, 175, 175, 176, 177, 178, 178, 179, 180, 181, 182, 183, 183, 184, 184, 185, 186, 187, 188, 189, 189, 190, 191, 192, 192, 193, 194, 195, 196, 197, 198, 198, 199, 199, 200, 201, 202, 203, 204, 205, 206, 206, 207, 208, 209, 210, 211, 212, 213, 213, 214, 215, 215, 216, 217, 218, 219, 219, 220, 221, 222, 223, 224, 225, 226, 226, 227, 228, 229, 230, 231, 232, 232, 233, 234, 235, 237, 238, 239, 240, 240, 241, 242, 243, 244, 245, 246, 246, 247, 248, 249, 250, 251, 252, 252, 253, 254, 255 };\n\t\t        int[] arrayOfInt3 = { 5, 6, 8, 11, 12, 14, 15, 16, 18, 21, 22, 23, 25, 26, 28, 30, 32, 33, 34, 36, 37, 40, 41, 43, 44, 45, 46, 49, 50, 52, 53, 54, 55, 58, 59, 60, 61, 62, 64, 66, 67, 68, 69, 71, 72, 73, 75, 76, 77, 78, 79, 80, 81, 83, 85, 86, 87, 88, 89, 90, 92, 93, 94, 95, 95, 96, 97, 98, 99, 101, 102, 103, 104, 105, 106, 107, 108, 108, 109, 111, 112, 113, 114, 115, 115, 116, 117, 118, 119, 120, 120, 121, 123, 124, 125, 125, 126, 127, 128, 129, 130, 130, 131, 132, 133, 134, 134, 135, 136, 137, 137, 138, 139, 140, 141, 141, 142, 143, 144, 145, 145, 146, 147, 148, 148, 149, 150, 151, 151, 152, 153, 154, 155, 155, 156, 156, 157, 158, 158, 159, 160, 161, 162, 162, 163, 164, 165, 165, 166, 166, 167, 168, 169, 170, 170, 170, 171, 172, 173, 174, 174, 175, 176, 176, 177, 178, 178, 179, 180, 180, 181, 182, 183, 183, 184, 184, 185, 186, 187, 188, 189, 189, 189, 190, 191, 192, 192, 193, 194, 195, 196, 196, 197, 198, 198, 199, 199, 200, 201, 202, 202, 203, 204, 205, 206, 206, 207, 208, 209, 209, 210, 211, 212, 213, 213, 214, 215, 215, 215, 216, 217, 218, 218, 219, 220, 221, 221, 222, 223, 224, 224, 225, 226, 227, 227, 228, 229, 230, 230, 231, 232, 233, 233, 234, 235, 237, 237, 238, 239, 240, 240, 241, 242, 243, 243, 244 };\n\t\t        for (int i = 0; i < 256; i++){\n\t\t          arrayOfByte[(i * 4)] = ((byte)arrayOfInt1[i]);\n\t\t          arrayOfByte[(1 + i * 4)] = ((byte)arrayOfInt2[i]);\n\t\t          arrayOfByte[(2 + i * 4)] = ((byte)arrayOfInt3[i]);\n\t\t          arrayOfByte[(3 + i * 4)] = -1;\n\t\t        }\n\t\t        int[] arrayOfInt4 = { 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 10, 12, 13, 14, 15, 16, 18, 19, 20, 21, 22, 24, 25, 26, 27, 28, 30, 31, 32, 33, 34, 36, 37, 38, 39, 40, 42, 43, 44, 45, 46, 48, 49, 50, 51, 52, 54, 55, 56, 57, 58, 60, 61, 62, 63, 64, 66, 67, 68, 69, 71, 72, 73, 74, 75, 77, 78, 79, 80, 81, 83, 84, 85, 86, 87, 89, 90, 91, 92, 93, 95, 96, 97, 98, 99, 101, 102, 103, 104, 105, 107, 108, 109, 110, 111, 113, 114, 115, 116, 117, 119, 120, 121, 122, 123, 125, 126, 127, 128, 129, 131, 132, 133, 134, 135, 137, 138, 139, 140, 141, 143, 144, 145, 146, 147, 149, 150, 151, 152, 153, 155, 156, 157, 158, 159, 161, 162, 163, 164, 165, 167, 168, 169, 170, 171, 173, 174, 175, 176, 177, 179, 180, 181, 182, 184, 185, 186, 187, 188, 190, 191, 192, 193, 194, 196, 197, 198, 199, 200, 202, 203, 204, 205, 206, 208, 209, 210, 211, 212, 214, 215, 216, 217, 218, 220, 221, 222, 223, 224, 226, 227, 228, 229, 230, 232, 233, 234, 235, 236, 238, 239, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240 };\n\t\t        int[] arrayOfInt5 = { 0, 1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 21, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 35, 36, 37, 38, 39, 41, 42, 43, 44, 46, 47, 48, 49, 51, 52, 53, 54, 56, 57, 58, 59, 61, 62, 63, 65, 66, 67, 69, 70, 71, 73, 74, 75, 77, 78, 79, 81, 82, 83, 85, 86, 87, 89, 90, 92, 93, 94, 96, 97, 99, 100, 101, 103, 104, 106, 107, 108, 110, 111, 113, 114, 116, 117, 119, 120, 121, 123, 124, 126, 127, 129, 130, 132, 133, 135, 136, 138, 139, 140, 142, 143, 145, 146, 147, 149, 150, 151, 153, 154, 155, 157, 158, 159, 160, 162, 163, 164, 165, 167, 168, 169, 170, 171, 173, 174, 175, 176, 177, 178, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 210, 211, 212, 213, 214, 215, 215, 216, 217, 218, 219, 219, 220, 221, 222, 222, 223, 224, 225, 225, 226, 227, 227, 228, 229, 229, 230, 231, 231, 232, 233, 233, 234, 234, 235, 236, 236, 237, 237, 238, 238, 239, 240, 240, 241, 241, 242, 242, 243, 243, 244, 244, 244, 245, 245, 246, 246, 247, 247, 247, 248, 248, 249, 249, 249, 250, 250, 250, 251, 251, 251, 252, 252, 252, 252, 253, 253, 253, 253, 254, 254, 254, 254, 255, 255, 255 };\n\t\t        int[] arrayOfInt6 = { 0, 0, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 8, 8, 8, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 20, 20, 20, 21, 21, 21, 22, 22, 23, 23, 23, 24, 24, 24, 25, 25, 25, 25, 26, 26, 27, 27, 28, 28, 28, 28, 29, 29, 30, 29, 31, 31, 31, 31, 32, 32, 33, 33, 34, 34, 34, 34, 35, 35, 36, 36, 37, 37, 37, 38, 38, 39, 39, 39, 40, 40, 40, 41, 42, 42, 43, 43, 44, 44, 45, 45, 45, 46, 47, 47, 48, 48, 49, 50, 51, 51, 52, 52, 53, 53, 54, 55, 55, 56, 57, 57, 58, 59, 60, 60, 61, 62, 63, 63, 64, 65, 66, 67, 68, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 88, 89, 90, 91, 93, 94, 95, 96, 97, 98, 100, 101, 103, 104, 105, 107, 108, 110, 111, 113, 115, 116, 118, 119, 120, 122, 123, 125, 127, 128, 130, 132, 134, 135, 137, 139, 141, 143, 144, 146, 148, 150, 152, 154, 156, 158, 160, 163, 165, 167, 169, 171, 173, 175, 178, 180, 182, 185, 187, 189, 192, 194, 197, 199, 201, 204, 206, 209, 211, 214, 216, 219, 221, 224, 226, 229, 232, 234, 236, 239, 241, 245, 247, 250, 252, 255 };\n\t\t        for (int j = 0; j < 256; j++){\n\t\t          arrayOfByte[(1024 + j * 4)] = ((byte)arrayOfInt5[j]);\n\t\t          arrayOfByte[(1 + (1024 + j * 4))] = ((byte)arrayOfInt4[j]);\n\t\t          arrayOfByte[(2 + (1024 + j * 4))] = ((byte)arrayOfInt6[j]);\n\t\t          arrayOfByte[(3 + (1024 + j * 4))] = -1;\n\t\t        }\n\t\t        GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, 256, 2, 0, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, ByteBuffer.wrap(arrayOfByte));\n\t\t    }\n\t    });\n\t}\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/core/filter/advanced/MagicLomoFilter.java",
    "content": "package com.zero.magicshow.core.filter.advanced;\n\nimport android.opengl.GLES20;\n\nimport com.zero.magicshow.R;\nimport com.zero.magicshow.core.filter.base.gpuimage.GPUImageFilter;\nimport com.zero.magicshow.common.utils.MagicParams;\nimport com.zero.magicshow.common.utils.OpenGlUtils;\n\npublic class MagicLomoFilter extends GPUImageFilter{\n\tprivate int[] inputTextureHandles = {-1,-1};\n\tprivate int[] inputTextureUniformLocations = {-1,-1};\n    private int mGLStrengthLocation;\n\n\tpublic MagicLomoFilter(){\n\t\tsuper(NO_FILTER_VERTEX_SHADER, OpenGlUtils.readShaderFromRawResource(R.raw.lomo));\n\t}\n\t\n\tprotected void onDestroy() {\n        super.onDestroy();\n        GLES20.glDeleteTextures(inputTextureHandles.length, inputTextureHandles, 0);\n        for(int i = 0; i < inputTextureHandles.length; i++)\n        \tinputTextureHandles[i] = -1;\n    }\n\t\n\tprotected void onDrawArraysAfter(){\n\t\tfor(int i = 0; i < inputTextureHandles.length\n\t\t\t\t&& inputTextureHandles[i] != OpenGlUtils.NO_TEXTURE; i++){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3));\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0);\n\t\t}\n\t}\n\t  \n\tprotected void onDrawArraysPre(){\n\t\tfor(int i = 0; i < inputTextureHandles.length \n\t\t\t\t&& inputTextureHandles[i] != OpenGlUtils.NO_TEXTURE; i++){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3) );\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, inputTextureHandles[i]);\n\t\t\tGLES20.glUniform1i(inputTextureUniformLocations[i], (i+3));\n\t\t}\n\t}\n\t\n\tprotected void onInit(){\n\t\tsuper.onInit();\n\t\tfor(int i=0; i < inputTextureUniformLocations.length; i++)\n\t\t\tinputTextureUniformLocations[i] = GLES20.glGetUniformLocation(getProgram(), \"inputImageTexture\"+(2+i));\n        mGLStrengthLocation = GLES20.glGetUniformLocation(mGLProgId,\n                \"strength\");\n\t}\n\t\n\tprotected void onInitialized(){\n\t\tsuper.onInitialized();\n        setFloat(mGLStrengthLocation, 1.0f);\n\t    runOnDraw(new Runnable(){\n\t\t    public void run(){\n\t\t    \tinputTextureHandles[0] = OpenGlUtils.loadTexture(MagicParams.context, \"filter/lomomap_new.png\");\n\t\t\t\tinputTextureHandles[1] = OpenGlUtils.loadTexture(MagicParams.context, \"filter/vignette_map.png\");\n\t\t    }\n\t    });\n\t}\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/core/filter/advanced/MagicN1977Filter.java",
    "content": "package com.zero.magicshow.core.filter.advanced;\n\nimport android.opengl.GLES20;\n\nimport com.zero.magicshow.R;\nimport com.zero.magicshow.core.filter.base.gpuimage.GPUImageFilter;\nimport com.zero.magicshow.common.utils.MagicParams;\nimport com.zero.magicshow.common.utils.OpenGlUtils;\n\npublic class MagicN1977Filter extends GPUImageFilter{\n\tprivate int[] inputTextureHandles = {-1,-1};\n\tprivate int[] inputTextureUniformLocations = {-1,-1};\n    private int mGLStrengthLocation;\n\n\tpublic MagicN1977Filter(){\n\t\tsuper(NO_FILTER_VERTEX_SHADER, OpenGlUtils.readShaderFromRawResource(R.raw.n1977));\n\t}\n\t\n\tprotected void onDrawArraysAfter(){\n\t\tfor(int i = 0; i < inputTextureHandles.length\n\t\t\t\t&& inputTextureHandles[i] != OpenGlUtils.NO_TEXTURE; i++){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3));\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0);\n\t\t}\n\t}\n\t  \n\tprotected void onDrawArraysPre(){\n\t\tfor(int i = 0; i < inputTextureHandles.length \n\t\t\t\t&& inputTextureHandles[i] != OpenGlUtils.NO_TEXTURE; i++){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3) );\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, inputTextureHandles[i]);\n\t\t\tGLES20.glUniform1i(inputTextureUniformLocations[i], (i+3));\n\t\t}\n\t}\n\t\n\tprotected void onInit(){\n\t\tsuper.onInit();\n\t\tfor(int i=0; i < inputTextureUniformLocations.length; i++)\n\t\t\tinputTextureUniformLocations[i] = GLES20.glGetUniformLocation(getProgram(), \"inputImageTexture\"+(2+i));\n\t\tmGLStrengthLocation = GLES20.glGetUniformLocation(mGLProgId,\n\t\t\t\t\"strength\");\n\t}\n\t\n\tprotected void onInitialized(){\n\t\tsuper.onInitialized();\n\t\tsetFloat(mGLStrengthLocation, 1.0f);\n\t    runOnDraw(new Runnable(){\n\t\t    public void run(){\n\t\t    \tinputTextureHandles[0] = OpenGlUtils.loadTexture(MagicParams.context, \"filter/n1977map.png\");\n\t\t\t\tinputTextureHandles[1] = OpenGlUtils.loadTexture(MagicParams.context, \"filter/n1977blowout.png\");\n\t\t    }\n\t    });\n\t}\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/core/filter/advanced/MagicNashvilleFilter.java",
    "content": "package com.zero.magicshow.core.filter.advanced;\n\nimport android.opengl.GLES20;\n\nimport com.zero.magicshow.R;\nimport com.zero.magicshow.core.filter.base.gpuimage.GPUImageFilter;\nimport com.zero.magicshow.common.utils.MagicParams;\nimport com.zero.magicshow.common.utils.OpenGlUtils;\n\npublic class MagicNashvilleFilter extends GPUImageFilter{\n\tprivate int[] inputTextureHandles = {-1};\n\tprivate int[] inputTextureUniformLocations = {-1};\n    private int mGLStrengthLocation;\n\n\tpublic MagicNashvilleFilter(){\n\t\tsuper(NO_FILTER_VERTEX_SHADER, OpenGlUtils.readShaderFromRawResource(R.raw.nashville));\n\t}\n\t\n\tpublic void onDestroy() {\n        super.onDestroy();\n        GLES20.glDeleteTextures(1, inputTextureHandles, 0);\n        for(int i = 0; i < inputTextureHandles.length; i++)\n        \tinputTextureHandles[i] = -1;\n    }\n\t\n\tprotected void onDrawArraysAfter(){\n\t\tfor(int i = 0; i < inputTextureHandles.length\n\t\t\t\t&& inputTextureHandles[i] != OpenGlUtils.NO_TEXTURE; i++){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3));\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0);\n\t\t}\n\t}\n\t  \n\tprotected void onDrawArraysPre(){\n\t\tfor(int i = 0; i < inputTextureHandles.length \n\t\t\t\t&& inputTextureHandles[i] != OpenGlUtils.NO_TEXTURE; i++){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3) );\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, inputTextureHandles[i]);\n\t\t\tGLES20.glUniform1i(inputTextureUniformLocations[i], (i+3));\n\t\t}\n\t}\n\t\n\tpublic void onInit(){\n\t\tsuper.onInit();\n\t\tfor(int i=0; i < inputTextureUniformLocations.length; i++)\n\t\t\tinputTextureUniformLocations[i] = GLES20.glGetUniformLocation(getProgram(), \"inputImageTexture\"+(2+i));\n\t\tmGLStrengthLocation = GLES20.glGetUniformLocation(mGLProgId,\n\t\t\t\t\"strength\");\n\t}\n\t\n\tpublic void onInitialized(){\n\t\tsuper.onInitialized();\n\t\tsetFloat(mGLStrengthLocation, 1.0f);\n\t    runOnDraw(new Runnable(){\n\t\t    public void run(){\n\t\t    \tinputTextureHandles[0] = OpenGlUtils.loadTexture(MagicParams.context, \"filter/nashvillemap.png\");\n\t\t    }\n\t    });\n\t}\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/core/filter/advanced/MagicNostalgiaFilter.java",
    "content": "package com.zero.magicshow.core.filter.advanced;\n\nimport android.opengl.GLES20;\n\nimport com.zero.magicshow.R;\nimport com.zero.magicshow.core.filter.base.gpuimage.GPUImageFilter;\nimport com.zero.magicshow.common.utils.OpenGlUtils;\n\nimport java.nio.ByteBuffer;\n\npublic class MagicNostalgiaFilter extends GPUImageFilter{\n\tprivate int mBlurSizeUniformLocation;\n\tprivate int mTexelWidthUniformLocation;\n\tprivate int mTexelHeightUniformLocation;\n\tprivate int[] mToneCurveTexture = { -1 };\n\tprivate int[] mToneCurveTexture2 = { -1 };\n\tprivate int mToneCurveTextureUniformLocation;\n\tprivate int mToneCurveTextureUniformLocation2;\n\t  \n\tpublic MagicNostalgiaFilter(){\n\t\tsuper(NO_FILTER_VERTEX_SHADER, OpenGlUtils.readShaderFromRawResource(R.raw.nostalgia));\n\t}\n\t\n\tpublic void onDestroy(){\n\t\tsuper.onDestroy();\n\t    GLES20.glDeleteTextures(1, mToneCurveTexture, 0);\n\t    mToneCurveTexture[0] = -1;\n\t    GLES20.glDeleteTextures(1, mToneCurveTexture2, 0);\n\t    mToneCurveTexture2[0] = -1;\n\t}\n\t  \n\tprotected void onDrawArraysAfter(){\n\t\tif (mToneCurveTexture[0] != -1){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE3);\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0);\n\t    }\n\t\tif (mToneCurveTexture2[0] != -1){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE4);\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0);\n\t    }\n\t}\n\t  \n\tprotected void onDrawArraysPre(){\n\t\tif (mToneCurveTexture[0] != -1){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE3);\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mToneCurveTexture[0]);\n\t\t\tGLES20.glUniform1i(mToneCurveTextureUniformLocation, 3);\n\t    }\n\t\tif (mToneCurveTexture2[0] != -1){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE4);\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mToneCurveTexture[0]);\n\t\t\tGLES20.glUniform1i(mToneCurveTextureUniformLocation2, 4);\n\t    }\n\t\tGLES20.glUniform1f(mBlurSizeUniformLocation, 1.0F);\n\t}\n\t  \n\tpublic void onInit(){\n\t\tsuper.onInit();\n\t    mToneCurveTextureUniformLocation = GLES20.glGetUniformLocation(mGLProgId, \"curve\");\n        mToneCurveTextureUniformLocation2 = GLES20.glGetUniformLocation(mGLProgId, \"curve2\");\n        mTexelWidthUniformLocation = GLES20.glGetUniformLocation(getProgram(), \"texelWidthOffset\");\n        mTexelHeightUniformLocation = GLES20.glGetUniformLocation(getProgram(), \"texelHeightOffset\");\n        mBlurSizeUniformLocation = GLES20.glGetUniformLocation(getProgram(), \"blurSize\");\n\t}\n\t  \n\tpublic void onInitialized(){\n\t\tsuper.onInitialized();\n\t    runOnDraw(new Runnable(){\n\t\t    public void run(){\n\t\t    \tGLES20.glGenTextures(1, mToneCurveTexture, 0);\n\t\t\t    GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mToneCurveTexture[0]);\n\t\t\t    GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t\t                GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);\n\t\t        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t\t                GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);\n\t\t        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t\t                GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);\n\t\t        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t\t                GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);\t\t\t\t\t\n\t\t        byte[] arrayOfByte1 = new byte[2048];\n\t\t        int[] arrayOfInt1 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 5, 6, 8, 9, 11, 13, 15, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 39, 41, 43, 45, 47, 49, 50, 52, 54, 56, 57, 59, 61, 62, 64, 66, 68, 69, 71, 72, 74, 76, 77, 79, 80, 82, 84, 85, 87, 88, 90, 91, 93, 94, 96, 97, 98, 100, 101, 103, 104, 106, 107, 108, 110, 111, 112, 114, 115, 116, 118, 119, 120, 122, 123, 124, 125, 127, 128, 129, 130, 131, 133, 134, 135, 136, 137, 138, 140, 141, 142, 143, 144, 145, 146, 147, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 174, 175, 176, 177, 178, 179, 180, 181, 182, 182, 183, 184, 185, 186, 187, 188, 188, 189, 190, 191, 192, 193, 193, 194, 195, 196, 197, 197, 198, 199, 200, 201, 201, 202, 203, 204, 204, 205, 206, 207, 207, 208, 209, 210, 210, 211, 212, 213, 213, 214, 215, 216, 216, 217, 218, 219, 219, 220, 221, 221, 222, 223, 224, 224, 225, 226, 226, 227, 228, 228, 229, 230, 231, 231, 232, 233, 233, 234, 235, 235, 236, 237, 237, 238, 239, 240, 240, 241, 242, 242, 243, 244, 244, 245, 246, 246, 247, 248, 248, 249, 250, 250, 251, 252, 252, 253, 254, 254, 255 };\n\t\t        int[] arrayOfInt2 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 3, 4, 6, 7, 9, 10, 12, 13, 14, 16, 17, 19, 20, 22, 23, 24, 26, 27, 29, 30, 32, 33, 34, 36, 37, 39, 40, 42, 43, 44, 46, 47, 49, 50, 52, 53, 54, 56, 57, 59, 60, 61, 63, 64, 66, 67, 69, 70, 71, 73, 74, 75, 77, 78, 80, 81, 82, 84, 85, 87, 88, 89, 91, 92, 93, 95, 96, 97, 99, 100, 101, 103, 104, 105, 107, 108, 109, 111, 112, 113, 115, 116, 117, 119, 120, 121, 122, 124, 125, 126, 127, 129, 130, 131, 132, 134, 135, 136, 137, 139, 140, 141, 142, 144, 145, 146, 147, 148, 149, 151, 152, 153, 154, 155, 156, 158, 159, 160, 161, 162, 163, 164, 165, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 198, 199, 200, 201, 202, 203, 204, 204, 205, 206, 207, 208, 209, 209, 210, 211, 212, 213, 213, 214, 215, 216, 216, 217, 218, 219, 219, 220, 221, 222, 222, 223, 224, 225, 225, 226, 227, 227, 228, 229, 229, 230, 231, 231, 232, 233, 233, 234, 235, 235, 236, 237, 237, 238, 239, 239, 240, 241, 241, 242, 243, 243, 244, 244, 245, 246, 246, 247, 248, 248, 249, 249, 250, 251, 251, 252, 253, 253, 254, 254, 255 };\n\t\t        int[] arrayOfInt3 = { 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 31, 33, 35, 37, 39, 41, 43, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 65, 67, 69, 71, 73, 75, 76, 78, 80, 82, 84, 85, 87, 89, 91, 92, 94, 96, 98, 99, 101, 102, 104, 106, 107, 109, 110, 112, 114, 115, 117, 118, 119, 121, 122, 124, 125, 126, 128, 129, 130, 132, 133, 134, 135, 137, 138, 139, 140, 141, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 166, 167, 168, 169, 170, 171, 171, 172, 173, 174, 175, 175, 176, 177, 178, 178, 179, 180, 181, 181, 182, 183, 184, 184, 185, 186, 186, 187, 188, 189, 189, 190, 191, 191, 192, 193, 193, 194, 195, 195, 196, 197, 197, 198, 199, 200, 200, 201, 202, 202, 203, 204, 204, 205, 206, 206, 207, 208, 208, 209, 210, 210, 211, 212, 212, 213, 214, 214, 215, 216, 216, 217, 218, 218, 219, 220, 220, 221, 221, 222, 223, 223, 224, 225, 225, 226, 227, 227, 228, 229, 229, 230, 231, 231, 232, 233, 233, 234, 234, 235, 236, 236, 237, 238, 238, 239, 240, 240, 241, 242, 242, 243, 243, 244, 245, 245, 246, 247, 247, 248, 249, 249, 250, 251, 251, 252, 252, 253, 254, 254, 255 };\n\t\t        int[] arrayOfInt4 = { 0, 0, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 8, 8, 8, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 20, 20, 20, 21, 21, 21, 22, 22, 23, 23, 23, 24, 24, 24, 25, 25, 25, 25, 26, 26, 27, 27, 28, 28, 28, 28, 29, 29, 30, 29, 31, 31, 31, 31, 32, 32, 33, 33, 34, 34, 34, 34, 35, 35, 36, 36, 37, 37, 37, 38, 38, 39, 39, 39, 40, 40, 40, 41, 42, 42, 43, 43, 44, 44, 45, 45, 45, 46, 47, 47, 48, 48, 49, 50, 51, 51, 52, 52, 53, 53, 54, 55, 55, 56, 57, 57, 58, 59, 60, 60, 61, 62, 63, 63, 64, 65, 66, 67, 68, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 88, 89, 90, 91, 93, 94, 95, 96, 97, 98, 100, 101, 103, 104, 105, 107, 108, 110, 111, 113, 115, 116, 118, 119, 120, 122, 123, 125, 127, 128, 130, 132, 134, 135, 137, 139, 141, 143, 144, 146, 148, 150, 152, 154, 156, 158, 160, 163, 165, 167, 169, 171, 173, 175, 178, 180, 182, 185, 187, 189, 192, 194, 197, 199, 201, 204, 206, 209, 211, 214, 216, 219, 221, 224, 226, 229, 232, 234, 236, 239, 241, 245, 247, 250, 252, 255 };\n\t\t        for (int i = 0; i < 256; i++){\n\t\t          arrayOfByte1[(0 + i * 4)] = ((byte)arrayOfInt1[i]);\n\t\t          arrayOfByte1[(1 + i * 4)] = ((byte)arrayOfInt2[i]);\n\t\t          arrayOfByte1[(2 + i * 4)] = ((byte)arrayOfInt3[i]);\n\t\t          arrayOfByte1[(3 + i * 4)] = ((byte)arrayOfInt4[i]);\n\t\t        }\n\t\t        int[] arrayOfInt5 = { 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 30, 32, 33, 34, 35, 37, 38, 39, 41, 42, 43, 44, 46, 47, 48, 50, 51, 52, 53, 55, 56, 57, 58, 60, 61, 62, 64, 65, 66, 67, 69, 70, 71, 72, 74, 75, 76, 77, 79, 80, 81, 82, 84, 85, 86, 87, 88, 90, 91, 92, 93, 95, 96, 97, 98, 99, 101, 102, 103, 104, 105, 107, 108, 109, 110, 111, 112, 114, 115, 116, 117, 118, 119, 121, 122, 123, 124, 125, 126, 127, 128, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 174, 175, 176, 177, 178, 179, 180, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 198, 199, 200, 201, 202, 204, 205, 206, 207, 209, 210, 211, 213, 214, 215, 217, 218, 220, 221, 222, 224, 225, 227, 228, 230, 231, 233, 234, 235, 237, 238, 240, 241, 243, 244, 246, 247, 249, 250, 252, 253, 255 };\n\t\t        int[] arrayOfInt6 = { 0, 3, 6, 8, 11, 14, 16, 18, 21, 24, 26, 29, 30, 33, 35, 37, 39, 41, 43, 45, 47, 49, 50, 52, 53, 54, 56, 58, 59, 61, 62, 63, 65, 65, 66, 68, 69, 70, 72, 73, 74, 75, 76, 77, 78, 79, 80, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 112, 113, 114, 115, 115, 116, 117, 118, 119, 120, 121, 122, 123, 123, 124, 125, 126, 127, 127, 128, 129, 130, 131, 132, 133, 134, 135, 135, 135, 136, 137, 138, 139, 140, 140, 141, 142, 143, 144, 145, 146, 146, 147, 147, 148, 149, 149, 150, 151, 152, 153, 154, 154, 155, 156, 157, 158, 158, 159, 159, 160, 161, 161, 162, 163, 164, 164, 165, 166, 167, 167, 168, 169, 170, 170, 170, 171, 172, 173, 173, 174, 175, 176, 176, 177, 178, 179, 179, 180, 181, 181, 182, 182, 183, 183, 184, 185, 186, 186, 187, 188, 188, 189, 190, 191, 191, 192, 193, 193, 194, 194, 194, 195, 196, 197, 197, 198, 199, 199, 200, 201, 201, 202, 203, 203, 204, 205, 205, 206, 206, 207, 207, 208, 209, 209, 210, 211, 211, 212, 213, 213, 214, 215, 215, 216, 217, 217, 217, 217, 218, 219, 219, 220, 221, 221, 222, 223, 223, 224, 225, 225, 226, 227, 227, 228, 228, 229, 229, 229, 230, 231, 231, 232, 232, 233, 234, 234, 235 };\n\t\t        int[] arrayOfInt7 = { 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 89, 90, 91, 92, 93, 94, 96, 97, 98, 99, 100, 102, 103, 104, 106, 107, 108, 109, 111, 112, 113, 115, 116, 118, 119, 120, 122, 123, 125, 126, 128, 129, 131, 132, 134, 135, 137, 139, 140, 142, 143, 145, 147, 148, 150, 152, 153, 155, 156, 158, 160, 161, 163, 164, 166, 167, 169, 170, 172, 173, 175, 176, 178, 179, 180, 182, 183, 185, 186, 188, 189, 190, 192, 193, 194, 196, 197, 199, 200, 201, 203, 204, 205, 206, 208, 209, 210, 212, 213, 214, 216, 217, 218, 219, 221, 222, 223, 224, 226, 227, 228, 229, 231, 232, 233, 234, 236, 237, 238, 239, 240, 242, 243, 244, 245, 247, 248, 249, 250, 251, 253, 254, 255 };\n\t\t        for (int j = 0; j < 256; j++){\n\t\t          arrayOfByte1[(0 + (1024 + j * 4))] = ((byte)arrayOfInt5[j]);\n\t\t          arrayOfByte1[(1 + (1024 + j * 4))] = ((byte)arrayOfInt6[j]);\n\t\t          arrayOfByte1[(2 + (1024 + j * 4))] = ((byte)arrayOfInt7[j]);\n\t\t          arrayOfByte1[(3 + (1024 + j * 4))] = ((byte)arrayOfInt4[j]);\n\t\t        }\n\t\t        GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, 256, 2, 0, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, ByteBuffer.wrap(arrayOfByte1));\n\t\t        GLES20.glGenTextures(1, mToneCurveTexture2, 0);\n\t\t\t    GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mToneCurveTexture2[0]);\n\t\t\t    GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t\t                GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);\n\t\t        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t\t                GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);\n\t\t        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t\t                GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);\n\t\t        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t\t                GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);\n\t\t        byte[] arrayOfByte2 = new byte[1024];\n\t\t        int[] arrayOfInt8 = { 0, 0, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 8, 8, 8, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 20, 20, 20, 21, 21, 21, 22, 22, 23, 23, 23, 24, 24, 24, 25, 25, 25, 25, 26, 26, 27, 27, 28, 28, 28, 28, 29, 29, 30, 29, 31, 31, 31, 31, 32, 32, 33, 33, 34, 34, 34, 34, 35, 35, 36, 36, 37, 37, 37, 38, 38, 39, 39, 39, 40, 40, 40, 41, 42, 42, 43, 43, 44, 44, 45, 45, 45, 46, 47, 47, 48, 48, 49, 50, 51, 51, 52, 52, 53, 53, 54, 55, 55, 56, 57, 57, 58, 59, 60, 60, 61, 62, 63, 63, 64, 65, 66, 67, 68, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 88, 89, 90, 91, 93, 94, 95, 96, 97, 98, 100, 101, 103, 104, 105, 107, 108, 110, 111, 113, 115, 116, 118, 119, 120, 122, 123, 125, 127, 128, 130, 132, 134, 135, 137, 139, 141, 143, 144, 146, 148, 150, 152, 154, 156, 158, 160, 163, 165, 167, 169, 171, 173, 175, 178, 180, 182, 185, 187, 189, 192, 194, 197, 199, 201, 204, 206, 209, 211, 214, 216, 219, 221, 224, 226, 229, 232, 234, 236, 239, 241, 245, 247, 250, 252, 255 };\n\t\t        int[] arrayOfInt9 = { 42, 43, 43, 44, 45, 45, 46, 47, 48, 48, 49, 50, 50, 51, 52, 52, 53, 54, 55, 55, 56, 57, 57, 58, 59, 60, 60, 61, 62, 62, 63, 64, 65, 65, 66, 67, 67, 68, 69, 70, 70, 71, 72, 72, 73, 74, 75, 75, 76, 77, 78, 78, 79, 80, 81, 81, 82, 83, 84, 84, 85, 86, 87, 87, 88, 89, 90, 91, 91, 92, 93, 94, 94, 95, 96, 97, 98, 98, 99, 100, 101, 102, 103, 103, 104, 105, 106, 107, 108, 108, 109, 110, 111, 112, 113, 113, 114, 115, 116, 117, 118, 119, 120, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 201, 202, 203, 204, 205, 206, 207, 207, 208, 209, 210, 211, 212, 212, 213, 214, 215, 216, 217, 217, 218, 219, 220, 221, 221, 222, 223, 224, 224, 225, 226, 227, 228, 228, 229, 230, 231, 231, 232, 233, 234, 234, 235, 236, 237, 237, 238, 239, 240, 240, 241, 242, 243, 243, 244, 245, 246, 246, 247, 248, 248, 249, 250, 251, 251, 252, 253, 254, 254, 255 };\n\t\t        int[] arrayOfInt10 = { 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 198, 199, 200, 201, 202, 203, 204, 205, 205, 206, 207, 208, 209, 210, 211, 211, 212, 213, 214, 215, 215, 216, 217, 218, 219, 219, 220, 221, 222, 222, 223, 224, 225, 225, 226, 227, 227, 228, 229, 230, 230, 231, 232, 232, 233, 234, 234, 235, 236, 236, 237, 238, 238, 239, 240, 240, 241, 241, 242, 243, 243, 244, 245, 245, 246, 246, 247, 248, 248, 249, 250, 250, 251, 251, 252, 253, 253, 254, 254, 255 };\n\t\t        int[] arrayOfInt11 = { 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 174, 175, 176, 177, 178, 179, 180, 181, 182, 182, 183, 184, 185, 186, 187, 188, 189, 190, 190, 191, 192, 193, 194, 195, 196, 197, 197, 198, 199, 200, 201, 202, 203, 203, 204, 205, 206, 207, 208, 209, 209, 210, 211, 212, 213, 214, 214, 215, 216, 217, 218, 219, 219, 220, 221, 222, 223, 224, 224, 225, 226, 227, 228, 229, 229, 230, 231, 232, 233, 234, 234, 235, 236, 237, 238, 239, 239, 240, 241, 242, 243, 244, 244, 245, 246, 247, 248, 248, 249, 250, 251, 252, 253, 253, 254, 255 };\n\t\t        for (int k = 0; k < 256; k++){\n\t\t          arrayOfByte2[(0 + k * 4)] = ((byte)arrayOfInt9[k]);\n\t\t          arrayOfByte2[(1 + k * 4)] = ((byte)arrayOfInt10[k]);\n\t\t          arrayOfByte2[(2 + k * 4)] = ((byte)arrayOfInt11[k]);\n\t\t          arrayOfByte2[(3 + k * 4)] = ((byte)arrayOfInt8[k]);\n\t\t        }\n\t\t        GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, 256, 1, 0, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, ByteBuffer.wrap(arrayOfByte2));\n\t\t    }\n\t    });\n\t}\n\t\n\tpublic void onInputSizeChanged(int width, int height) {\n        super.onInputSizeChanged(width, height);\n        GLES20.glUniform1f(mTexelWidthUniformLocation, (1.0f / (float)width));\n        GLES20.glUniform1f(mTexelHeightUniformLocation, (1.0f / (float)height));\n    }\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/core/filter/advanced/MagicPixarFilter.java",
    "content": "package com.zero.magicshow.core.filter.advanced;\n\nimport android.opengl.GLES20;\n\nimport com.zero.magicshow.R;\nimport com.zero.magicshow.core.filter.base.gpuimage.GPUImageFilter;\nimport com.zero.magicshow.common.utils.MagicParams;\nimport com.zero.magicshow.common.utils.OpenGlUtils;\n\npublic class MagicPixarFilter extends GPUImageFilter{\n\tprivate int[] inputTextureHandles = {-1};\n\tprivate int[] inputTextureUniformLocations = {-1};\n    private int mGLStrengthLocation;\n\n\tpublic MagicPixarFilter(){\n\t\tsuper(NO_FILTER_VERTEX_SHADER, OpenGlUtils.readShaderFromRawResource(R.raw.pixar));\n\t}\n\t\n\tpublic void onDestroy() {\n        super.onDestroy();\n        GLES20.glDeleteTextures(1, inputTextureHandles, 0);\n        for(int i = 0; i < inputTextureHandles.length; i++)\n        \tinputTextureHandles[i] = -1;\n    }\n\t\n\tprotected void onDrawArraysAfter(){\n\t\tfor(int i = 0; i < inputTextureHandles.length\n\t\t\t\t&& inputTextureHandles[i] != OpenGlUtils.NO_TEXTURE; i++){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3));\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0);\n\t\t}\n\t}\n\t  \n\tprotected void onDrawArraysPre(){\n\t\tfor(int i = 0; i < inputTextureHandles.length \n\t\t\t\t&& inputTextureHandles[i] != OpenGlUtils.NO_TEXTURE; i++){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3) );\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, inputTextureHandles[i]);\n\t\t\tGLES20.glUniform1i(inputTextureUniformLocations[i], (i+3));\n\t\t}\n\t}\n\t\n\tpublic void onInit(){\n\t\tsuper.onInit();\n\t\tfor(int i=0; i < inputTextureUniformLocations.length; i++)\n\t\t\tinputTextureUniformLocations[i] = GLES20.glGetUniformLocation(getProgram(), \"inputImageTexture\"+(2+i));\n\t\tmGLStrengthLocation = GLES20.glGetUniformLocation(mGLProgId,\n\t\t\t\t\"strength\");\n\t}\n\t\n\tpublic void onInitialized(){\n\t\tsuper.onInitialized();\n\t\tsetFloat(mGLStrengthLocation, 1.0f);\n\t    runOnDraw(new Runnable(){\n\t\t    public void run(){\n\t\t    \tinputTextureHandles[0] = OpenGlUtils.loadTexture(MagicParams.context, \"filter/pixar_curves.png\");\n\t\t    }\n\t    });\n\t}\n}"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/core/filter/advanced/MagicRiseFilter.java",
    "content": "package com.zero.magicshow.core.filter.advanced;\n\nimport android.opengl.GLES20;\n\nimport com.zero.magicshow.R;\nimport com.zero.magicshow.core.filter.base.gpuimage.GPUImageFilter;\nimport com.zero.magicshow.common.utils.MagicParams;\nimport com.zero.magicshow.common.utils.OpenGlUtils;\n\npublic class MagicRiseFilter extends GPUImageFilter{\n\tprivate int[] inputTextureHandles = {-1,-1,-1};\n\tprivate int[] inputTextureUniformLocations = {-1,-1,-1};\n\t\n\tpublic MagicRiseFilter(){\n\t\tsuper(NO_FILTER_VERTEX_SHADER, OpenGlUtils.readShaderFromRawResource(R.raw.rise));\n\t}\n\t\n\tpublic void onDestroy() {\n        super.onDestroy();\n        GLES20.glDeleteTextures(inputTextureHandles.length, inputTextureHandles, 0);\n        for(int i = 0; i < inputTextureHandles.length; i++)\n        \tinputTextureHandles[i] = -1;\n    }\n\t\n\tprotected void onDrawArraysAfter(){\n\t\tfor(int i = 0; i < inputTextureHandles.length\n\t\t\t\t&& inputTextureHandles[i] != OpenGlUtils.NO_TEXTURE; i++){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3));\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0);\n\t\t}\n\t}\n\t  \n\tprotected void onDrawArraysPre(){\n\t\tfor(int i = 0; i < inputTextureHandles.length \n\t\t\t\t&& inputTextureHandles[i] != OpenGlUtils.NO_TEXTURE; i++){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3) );\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, inputTextureHandles[i]);\n\t\t\tGLES20.glUniform1i(inputTextureUniformLocations[i], (i+3));\n\t\t}\n\t}\n\t\n\tpublic void onInit(){\n\t\tsuper.onInit();\n\t\tfor(int i=0; i < inputTextureUniformLocations.length; i++){\n\t\t\tinputTextureUniformLocations[i] = GLES20.glGetUniformLocation(getProgram(), \"inputImageTexture\"+(2+i));\n\t\t}\n\t}\n\t\n\tpublic void onInitialized(){\n\t\tsuper.onInitialized();\n\t    runOnDraw(new Runnable(){\n\t\t    public void run(){\n\t\t    \tinputTextureHandles[0] = OpenGlUtils.loadTexture(MagicParams.context, \"filter/blackboard1024.png\");\n\t\t\t\tinputTextureHandles[1] = OpenGlUtils.loadTexture(MagicParams.context, \"filter/overlaymap.png\");\n\t\t\t\tinputTextureHandles[2] = OpenGlUtils.loadTexture(MagicParams.context, \"filter/risemap.png\");\n\t\t    }\n\t    });\n\t}\n}"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/core/filter/advanced/MagicRomanceFilter.java",
    "content": "package com.zero.magicshow.core.filter.advanced;\n\nimport android.opengl.GLES20;\n\nimport com.zero.magicshow.R;\nimport com.zero.magicshow.core.filter.base.gpuimage.GPUImageFilter;\nimport com.zero.magicshow.common.utils.OpenGlUtils;\n\nimport java.nio.ByteBuffer;\n\npublic class MagicRomanceFilter extends GPUImageFilter{\n\t\n\tprivate int[] mToneCurveTexture = {-1};\n\tprivate int mToneCurveTextureUniformLocation;\n\t  \n\tpublic MagicRomanceFilter(){\n\t\tsuper(NO_FILTER_VERTEX_SHADER, OpenGlUtils.readShaderFromRawResource(R.raw.romance));\n\t}\n\t\n\tpublic void onDestroy(){\n\t\tsuper.onDestroy();\n\t    GLES20.glDeleteTextures(1, mToneCurveTexture, 0);\n\t    mToneCurveTexture[0] = -1;\n\t}\n\t  \n\tprotected void onDrawArraysAfter(){\n\t\tif (mToneCurveTexture[0] != -1){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE3);\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0);\n\t    }\n\t}\n\t  \n\tprotected void onDrawArraysPre(){\n\t\tif (mToneCurveTexture[0] != -1){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE3);\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mToneCurveTexture[0]);\n\t\t\tGLES20.glUniform1i(mToneCurveTextureUniformLocation, 3);\n\t    }\n\t}\n\t  \n\tpublic void onInit(){\n\t\tsuper.onInit();\n\t    mToneCurveTextureUniformLocation = GLES20.glGetUniformLocation(mGLProgId, \"curve\");\n\t}\n\t  \n\tpublic void onInitialized(){\n\t\tsuper.onInitialized();\n\t    runOnDraw(new Runnable(){\n\t\t    public void run(){\n\t\t    \tGLES20.glGenTextures(1, mToneCurveTexture, 0);\n\t\t\t    GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mToneCurveTexture[0]);\n\t\t\t    GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t\t                GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);\n\t\t        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t\t                GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);\n\t\t        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t\t                GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);\n\t\t        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t\t                GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);\t\t\t\t\n\t\t\t\tbyte[] romance_arrayOfByte = new byte[1024];\n\t\t        int[] romance_arrayOfInt1 = { 46, 46, 46, 46, 47, 47, 47, 47, 47, 47, 48, 48, 48, 48, 48, 48, 49, 49, 49, 49, 49, 50, 50, 50, 50, 51, 51, 51, 51, 52, 52, 52, 52, 53, 53, 53, 54, 54, 54, 55, 55, 56, 56, 56, 57, 57, 58, 58, 59, 59, 60, 60, 61, 61, 62, 62, 63, 63, 64, 65, 65, 66, 67, 67, 68, 69, 69, 70, 71, 72, 73, 73, 74, 75, 76, 77, 78, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 100, 101, 102, 103, 104, 105, 106, 107, 109, 110, 111, 112, 113, 114, 116, 117, 118, 119, 120, 122, 123, 124, 125, 127, 128, 129, 130, 131, 133, 134, 135, 136, 138, 139, 140, 141, 143, 144, 145, 146, 148, 149, 150, 151, 153, 154, 155, 156, 158, 159, 160, 161, 162, 164, 165, 166, 167, 169, 170, 171, 172, 173, 175, 176, 177, 178, 179, 180, 182, 183, 184, 185, 186, 187, 188, 189, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 211, 212, 213, 214, 215, 216, 217, 218, 218, 219, 220, 221, 222, 222, 223, 224, 225, 226, 226, 227, 228, 229, 229, 230, 231, 232, 232, 233, 234, 234, 235, 236, 237, 237, 238, 239, 239, 240, 241, 241, 242, 243, 243, 244, 245, 245, 246, 247, 247, 248, 249, 249, 250, 251, 251, 252, 252, 253, 254, 254, 255 };\n\t\t        int[] romance_arrayOfInt2 = { 0, 1, 1, 2, 3, 4, 4, 5, 6, 6, 7, 8, 9, 9, 10, 11, 12, 12, 13, 14, 14, 15, 16, 17, 17, 18, 19, 20, 20, 21, 22, 23, 23, 24, 25, 26, 26, 27, 28, 29, 30, 30, 31, 32, 33, 33, 34, 35, 36, 37, 38, 38, 39, 40, 41, 42, 43, 43, 44, 45, 46, 47, 48, 49, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 111, 112, 113, 114, 115, 116, 117, 118, 120, 121, 122, 123, 124, 125, 126, 128, 129, 130, 131, 132, 133, 134, 136, 137, 138, 139, 140, 141, 142, 144, 145, 146, 147, 148, 149, 151, 152, 153, 154, 155, 156, 157, 159, 160, 161, 162, 163, 164, 166, 167, 168, 169, 170, 171, 172, 174, 175, 176, 177, 178, 179, 180, 181, 183, 184, 185, 186, 187, 188, 189, 190, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255 };\n\t\t        int[] romance_arrayOfInt3 = { 0, 2, 3, 5, 7, 8, 10, 12, 13, 15, 17, 18, 20, 21, 23, 25, 26, 28, 30, 31, 33, 34, 36, 38, 39, 41, 42, 44, 45, 47, 48, 50, 51, 53, 54, 56, 57, 59, 60, 62, 63, 65, 66, 67, 69, 70, 72, 73, 74, 76, 77, 78, 79, 81, 82, 83, 84, 86, 87, 88, 89, 90, 91, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 106, 107, 108, 109, 110, 111, 112, 112, 113, 114, 115, 116, 116, 117, 118, 119, 119, 120, 121, 122, 122, 123, 124, 124, 125, 126, 126, 127, 128, 128, 129, 130, 130, 131, 131, 132, 133, 133, 134, 134, 135, 136, 136, 137, 137, 138, 139, 139, 140, 140, 141, 141, 142, 143, 143, 144, 144, 145, 146, 146, 147, 147, 148, 149, 149, 150, 150, 151, 152, 152, 153, 154, 154, 155, 155, 156, 157, 157, 158, 159, 159, 160, 161, 162, 162, 163, 164, 164, 165, 166, 167, 168, 168, 169, 170, 171, 172, 172, 173, 174, 175, 176, 177, 177, 178, 179, 180, 181, 182, 183, 184, 185, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 242, 243, 244, 245, 246, 247, 248, 249, 251, 252, 253, 254, 255 };\n\t\t        int[] romance_arrayOfInt4 = { 0, 0, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 8, 8, 8, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 20, 20, 20, 21, 21, 21, 22, 22, 23, 23, 23, 24, 24, 24, 25, 25, 25, 25, 26, 26, 27, 27, 28, 28, 28, 28, 29, 29, 30, 29, 31, 31, 31, 31, 32, 32, 33, 33, 34, 34, 34, 34, 35, 35, 36, 36, 37, 37, 37, 38, 38, 39, 39, 39, 40, 40, 40, 41, 42, 42, 43, 43, 44, 44, 45, 45, 45, 46, 47, 47, 48, 48, 49, 50, 51, 51, 52, 52, 53, 53, 54, 55, 55, 56, 57, 57, 58, 59, 60, 60, 61, 62, 63, 63, 64, 65, 66, 67, 68, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 88, 89, 90, 91, 93, 94, 95, 96, 97, 98, 100, 101, 103, 104, 105, 107, 108, 110, 111, 113, 115, 116, 118, 119, 120, 122, 123, 125, 127, 128, 130, 132, 134, 135, 137, 139, 141, 143, 144, 146, 148, 150, 152, 154, 156, 158, 160, 163, 165, 167, 169, 171, 173, 175, 178, 180, 182, 185, 187, 189, 192, 194, 197, 199, 201, 204, 206, 209, 211, 214, 216, 219, 221, 224, 226, 229, 232, 234, 236, 239, 241, 245, 247, 250, 252, 255 };\n\t\t        for (int i = 0; i < 256; i++){\n\t\t        \tromance_arrayOfByte[(i * 4)] = ((byte)romance_arrayOfInt1[i]);\n\t\t        \tromance_arrayOfByte[(1 + i * 4)] = ((byte)romance_arrayOfInt2[i]);\n\t\t        \tromance_arrayOfByte[(2 + i * 4)] = ((byte)romance_arrayOfInt3[i]);\n\t\t        \tromance_arrayOfByte[(3 + i * 4)] = ((byte)romance_arrayOfInt4[i]);\n\t\t        }\n\t\t        GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, 256, 1, 0, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, ByteBuffer.wrap(romance_arrayOfByte));\n\t\t    }\n\t    });\n\t}\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/core/filter/advanced/MagicSakuraFilter.java",
    "content": "package com.zero.magicshow.core.filter.advanced;\n\nimport android.opengl.GLES20;\n\nimport com.zero.magicshow.R;\nimport com.zero.magicshow.core.filter.base.gpuimage.GPUImageFilter;\nimport com.zero.magicshow.common.utils.OpenGlUtils;\n\nimport java.nio.ByteBuffer;\n\npublic class MagicSakuraFilter extends GPUImageFilter{\n\tprivate int[] mToneCurveTexture = {-1};\n\tprivate int mToneCurveTextureUniformLocation;\n\tprivate int mTexelHeightUniformLocation;\n\tprivate int mTexelWidthUniformLocation;\n\t\n\tpublic MagicSakuraFilter(){\n\t\tsuper(NO_FILTER_VERTEX_SHADER, OpenGlUtils.readShaderFromRawResource(R.raw.romance));\n\t}\n\t\n\tpublic void onDestroy(){\n\t\tsuper.onDestroy();\n\t    GLES20.glDeleteTextures(1, mToneCurveTexture, 0);\n\t    mToneCurveTexture[0] = -1;\n\t}\n\t  \n\tprotected void onDrawArraysAfter(){\n\t\tif (mToneCurveTexture[0] != -1){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE3);\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0);\n\t    }\n\t}\n\t  \n\tprotected void onDrawArraysPre(){\n\t\tif (mToneCurveTexture[0] != -1){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE3);\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mToneCurveTexture[0]);\n\t\t\tGLES20.glUniform1i(mToneCurveTextureUniformLocation, 3);\n\t    }\n\t}\n\t  \n\tpublic void onInit(){\n\t\tsuper.onInit();\n\t    mToneCurveTextureUniformLocation = GLES20.glGetUniformLocation(mGLProgId, \"curve\");\n        mTexelWidthUniformLocation = GLES20.glGetUniformLocation(getProgram(), \"texelWidthOffset\");\n        mTexelHeightUniformLocation = GLES20.glGetUniformLocation(getProgram(), \"texelHeightOffset\");\n\t}\n\t  \n\tpublic void onInitialized(){\n\t\tsuper.onInitialized();\n\t    runOnDraw(new Runnable(){\n\t\t    public void run(){\n\t\t    \tGLES20.glGenTextures(1, mToneCurveTexture, 0);\n\t\t\t    GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mToneCurveTexture[0]);\n\t\t\t    GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t\t                GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);\n\t\t        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t\t                GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);\n\t\t        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t\t                GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);\n\t\t        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t\t                GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);\t\t\t\t\t\n\t\t        byte[] arrayOfByte = new byte[1024];\n\t\t        int[] arrayOfInt = { 95, 95, 96, 97, 97, 98, 99, 99, 100, 101, 101, 102, 103, 104, 104, 105, 106, 106, 107, 108, 108, 109, 110, 111, 111, 112, 113, 113, 114, 115, 115, 116, 117, 117, 118, 119, 120, 120, 121, 122, 122, 123, 124, 124, 125, 126, 127, 127, 128, 129, 129, 130, 131, 131, 132, 133, 133, 134, 135, 136, 136, 137, 138, 138, 139, 140, 140, 141, 142, 143, 143, 144, 145, 145, 146, 147, 147, 148, 149, 149, 150, 151, 152, 152, 153, 154, 154, 155, 156, 156, 157, 158, 159, 159, 160, 161, 161, 162, 163, 163, 164, 165, 165, 166, 167, 168, 168, 169, 170, 170, 171, 172, 172, 173, 174, 175, 175, 176, 177, 177, 178, 179, 179, 180, 181, 181, 182, 183, 184, 184, 185, 186, 186, 187, 188, 188, 189, 190, 191, 191, 192, 193, 193, 194, 195, 195, 196, 197, 197, 198, 199, 200, 200, 201, 202, 202, 203, 204, 204, 205, 206, 207, 207, 208, 209, 209, 210, 211, 211, 212, 213, 213, 214, 215, 216, 216, 217, 218, 218, 219, 220, 220, 221, 222, 223, 223, 224, 225, 225, 226, 227, 227, 228, 229, 229, 230, 231, 232, 232, 233, 234, 234, 235, 236, 236, 237, 238, 239, 239, 240, 241, 241, 242, 243, 243, 244, 245, 245, 246, 247, 248, 248, 249, 250, 250, 251, 252, 252, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 };\n\t\t        for (int i = 0; i < 256; i++)\n\t\t        {\n\t\t          arrayOfByte[(i * 4)] = ((byte)arrayOfInt[i]);\n\t\t          arrayOfByte[(1 + i * 4)] = ((byte)arrayOfInt[i]);\n\t\t          arrayOfByte[(2 + i * 4)] = ((byte)arrayOfInt[i]);\n\t\t          arrayOfByte[(3 + i * 4)] = ((byte)arrayOfInt[i]);\n\t\t        }\n\t\t        GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, 256, 1, 0, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, ByteBuffer.wrap(arrayOfByte));\n\t\t    }\n\t    });\n\t}\n\t\n\tpublic void onInputSizeChanged(int width, int height) {\n        super.onInputSizeChanged(width, height);\n        GLES20.glUniform1f(mTexelWidthUniformLocation, (1.0f / (float)width));\n        GLES20.glUniform1f(mTexelHeightUniformLocation, (1.0f / (float)height));\n    }\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/core/filter/advanced/MagicSierraFilter.java",
    "content": "package com.zero.magicshow.core.filter.advanced;\n\nimport android.opengl.GLES20;\n\nimport com.zero.magicshow.R;\nimport com.zero.magicshow.core.filter.base.gpuimage.GPUImageFilter;\nimport com.zero.magicshow.common.utils.MagicParams;\nimport com.zero.magicshow.common.utils.OpenGlUtils;\n\npublic class MagicSierraFilter extends GPUImageFilter{\n\tprivate int[] inputTextureHandles = {-1,-1,-1};\n\tprivate int[] inputTextureUniformLocations = {-1,-1,-1};\n    private int mGLStrengthLocation;\n\n\tpublic MagicSierraFilter(){\n\t\tsuper(NO_FILTER_VERTEX_SHADER, OpenGlUtils.readShaderFromRawResource(R.raw.sierra));\n\t}\n\t\n\tpublic void onDestroy() {\n        super.onDestroy();\n        GLES20.glDeleteTextures(inputTextureHandles.length, inputTextureHandles, 0);\n        for(int i = 0; i < inputTextureHandles.length; i++)\n        \tinputTextureHandles[i] = -1;\n    }\n\t\n\tprotected void onDrawArraysAfter(){\n\t\tfor(int i = 0; i < inputTextureHandles.length\n\t\t\t\t&& inputTextureHandles[i] != OpenGlUtils.NO_TEXTURE; i++){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3));\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0);\n\t\t}\n\t}\n\t  \n\tprotected void onDrawArraysPre(){\n\t\tfor(int i = 0; i < inputTextureHandles.length \n\t\t\t\t&& inputTextureHandles[i] != OpenGlUtils.NO_TEXTURE; i++){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3) );\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, inputTextureHandles[i]);\n\t\t\tGLES20.glUniform1i(inputTextureUniformLocations[i], (i+3));\n\t\t}\n\t}\n\t\n\tpublic void onInit(){\n\t\tsuper.onInit();\n\t\tfor(int i = 0; i < inputTextureUniformLocations.length; i++)\n\t\t\tinputTextureUniformLocations[i] = GLES20.glGetUniformLocation(getProgram(), \"inputImageTexture\"+(2+i));\n\t\tmGLStrengthLocation = GLES20.glGetUniformLocation(mGLProgId,\n\t\t\t\t\"strength\");\n\t}\n\t\n\tpublic void onInitialized(){\n\t\tsuper.onInitialized();\n\t\tsetFloat(mGLStrengthLocation, 1.0f);\n\t    runOnDraw(new Runnable(){\n\t\t    public void run(){\n\t\t    \tinputTextureHandles[0] = OpenGlUtils.loadTexture(MagicParams.context, \"filter/sierravignette.png\");\n\t\t\t\tinputTextureHandles[1] = OpenGlUtils.loadTexture(MagicParams.context, \"filter/overlaymap.png\");\n\t\t\t\tinputTextureHandles[2] = OpenGlUtils.loadTexture(MagicParams.context, \"filter/sierramap.png\");\n\t\t    }\n\t    });\n\t}\n}"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/core/filter/advanced/MagicSketchFilter.java",
    "content": "package com.zero.magicshow.core.filter.advanced;\n\nimport android.opengl.GLES20;\n\nimport com.zero.magicshow.R;\nimport com.zero.magicshow.core.filter.base.gpuimage.GPUImageFilter;\nimport com.zero.magicshow.common.utils.OpenGlUtils;\n\npublic class MagicSketchFilter extends GPUImageFilter{\n\t\n\tprivate int mSingleStepOffsetLocation;\n\t//0.0 - 1.0\n\tprivate int mStrengthLocation;\n\t\n\tpublic MagicSketchFilter(){\n\t\tsuper(NO_FILTER_VERTEX_SHADER, OpenGlUtils.readShaderFromRawResource(R.raw.sketch));\n\t}\n\t\n\tprotected void onInit() {\n        super.onInit();\n        mSingleStepOffsetLocation = GLES20.glGetUniformLocation(getProgram(), \"singleStepOffset\");\n        mStrengthLocation = GLES20.glGetUniformLocation(getProgram(), \"strength\");\n    }\n    \n    protected void onDestroy() {\n        super.onDestroy();\n    }\n    \n    private void setTexelSize(final float w, final float h) {\n\t\tsetFloatVec2(mSingleStepOffsetLocation, new float[] {1.0f / w, 1.0f / h});\n\t}\n\n    protected void onInitialized(){\n        super.onInitialized();\n        setFloat(mStrengthLocation, 0.5f);\n    }\n\n\t@Override\n    public void onInputSizeChanged(final int width, final int height) {\n        super.onInputSizeChanged(width, height);\n        setTexelSize(width, height);\n    }\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/core/filter/advanced/MagicSkinWhitenFilter.java",
    "content": "package com.zero.magicshow.core.filter.advanced;\n\nimport android.opengl.GLES20;\n\nimport com.zero.magicshow.R;\nimport com.zero.magicshow.core.filter.base.gpuimage.GPUImageFilter;\nimport com.zero.magicshow.common.utils.OpenGlUtils;\n\nimport java.nio.ByteBuffer;\n\npublic class MagicSkinWhitenFilter extends GPUImageFilter {\n\tprivate int mTexelHeightUniformLocation;\n\tprivate int mTexelWidthUniformLocation;\n    private int mToneCurveTextureUniformLocation;\n    private int[] mToneCurveTexture = new int[] {-1};\n    \n    public MagicSkinWhitenFilter() {\n    \tsuper(NO_FILTER_VERTEX_SHADER, OpenGlUtils.readShaderFromRawResource(R.raw.skinwhiten));\n    }\n    \n    public void onInit() {\n        super.onInit();\n        mToneCurveTextureUniformLocation = GLES20.glGetUniformLocation(getProgram(), \"curve\");\n        mTexelWidthUniformLocation = GLES20.glGetUniformLocation(getProgram(), \"texelWidthOffset\");\n        mTexelHeightUniformLocation = GLES20.glGetUniformLocation(getProgram(), \"texelHeightOffset\");\n\n    }\n    \n    public void onDestroy() {\n        super.onDestroy();\n        GLES20.glDeleteTextures(1, mToneCurveTexture, 0);\n        mToneCurveTexture[0] = -1;\n    }\n    \n    public void onInitialized() {\n        super.onInitialized();\n        runOnDraw(new Runnable() {\n            \n            public void run() {\t\t        \n\t\t        GLES20.glActiveTexture(GLES20.GL_TEXTURE3);\n\t\t\t    GLES20.glGenTextures(1, mToneCurveTexture, 0);\n\t\t\t    GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mToneCurveTexture[0]);\n\t\t\t    GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t\t                GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);\n\t\t        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t\t                GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);\n\t\t        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t\t                GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);\n\t\t        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t\t                GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);\t\t        \n\t\t        byte[] arrayOfByte = new byte[1024];\n\t\t        int[] arrayOfInt1 = { 95, 95, 96, 97, 97, 98, 99, 99, 100, 101, 101, 102, 103, 104, 104, 105, 106, 106, 107, 108, 108, 109, 110, 111, 111, 112, 113, 113, 114, 115, 115, 116, 117, 117, 118, 119, 120, 120, 121, 122, 122, 123, 124, 124, 125, 126, 127, 127, 128, 129, 129, 130, 131, 131, 132, 133, 133, 134, 135, 136, 136, 137, 138, 138, 139, 140, 140, 141, 142, 143, 143, 144, 145, 145, 146, 147, 147, 148, 149, 149, 150, 151, 152, 152, 153, 154, 154, 155, 156, 156, 157, 158, 159, 159, 160, 161, 161, 162, 163, 163, 164, 165, 165, 166, 167, 168, 168, 169, 170, 170, 171, 172, 172, 173, 174, 175, 175, 176, 177, 177, 178, 179, 179, 180, 181, 181, 182, 183, 184, 184, 185, 186, 186, 187, 188, 188, 189, 190, 191, 191, 192, 193, 193, 194, 195, 195, 196, 197, 197, 198, 199, 200, 200, 201, 202, 202, 203, 204, 204, 205, 206, 207, 207, 208, 209, 209, 210, 211, 211, 212, 213, 213, 214, 215, 216, 216, 217, 218, 218, 219, 220, 220, 221, 222, 223, 223, 224, 225, 225, 226, 227, 227, 228, 229, 229, 230, 231, 232, 232, 233, 234, 234, 235, 236, 236, 237, 238, 239, 239, 240, 241, 241, 242, 243, 243, 244, 245, 245, 246, 247, 248, 248, 249, 250, 250, 251, 252, 252, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 };\n\t\t        int[] arrayOfInt2 = { 0, 0, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 8, 8, 8, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 20, 20, 20, 21, 21, 21, 22, 22, 23, 23, 23, 24, 24, 24, 25, 25, 25, 25, 26, 26, 27, 27, 28, 28, 28, 28, 29, 29, 30, 29, 31, 31, 31, 31, 32, 32, 33, 33, 34, 34, 34, 34, 35, 35, 36, 36, 37, 37, 37, 38, 38, 39, 39, 39, 40, 40, 40, 41, 42, 42, 43, 43, 44, 44, 45, 45, 45, 46, 47, 47, 48, 48, 49, 50, 51, 51, 52, 52, 53, 53, 54, 55, 55, 56, 57, 57, 58, 59, 60, 60, 61, 62, 63, 63, 64, 65, 66, 67, 68, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 88, 89, 90, 91, 93, 94, 95, 96, 97, 98, 100, 101, 103, 104, 105, 107, 108, 110, 111, 113, 115, 116, 118, 119, 120, 122, 123, 125, 127, 128, 130, 132, 134, 135, 137, 139, 141, 143, 144, 146, 148, 150, 152, 154, 156, 158, 160, 163, 165, 167, 169, 171, 173, 175, 178, 180, 182, 185, 187, 189, 192, 194, 197, 199, 201, 204, 206, 209, 211, 214, 216, 219, 221, 224, 226, 229, 232, 234, 236, 239, 241, 245, 247, 250, 252, 255 };\n\t\t        for (int i = 0; i < 256; i++){\n\t\t          arrayOfByte[(i * 4)] = ((byte)arrayOfInt1[i]);\n\t\t          arrayOfByte[(1 + i * 4)] = ((byte)arrayOfInt1[i]);\n\t\t          arrayOfByte[(2 + i * 4)] = ((byte)arrayOfInt2[i]);\n\t\t          arrayOfByte[(3 + i * 4)] = -1;\n\t\t        }\n                GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, 256, 1, 0, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, ByteBuffer.wrap(arrayOfByte));\n            }\n        });\n    }\n    \n    protected void onDrawArraysPre() {\n        super.onDrawArraysPre();\n        if(mToneCurveTexture[0] != -1) {\n        \tGLES20.glActiveTexture(GLES20.GL_TEXTURE3);\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mToneCurveTexture[0]);\n\t\t\tGLES20.glUniform1i(this.mToneCurveTextureUniformLocation, 3);\n        }\n    }\n    \n    public void onInputSizeChanged(int width, int height) {\n        super.onInputSizeChanged(width, height);\n        GLES20.glUniform1f(mTexelWidthUniformLocation, (1.0f / (float)width));\n        GLES20.glUniform1f(mTexelHeightUniformLocation, (1.0f / (float)height));\n    }\n    \n    protected void onDrawArraysAfter() {\n        super.onDrawArraysAfter();\n        if(mToneCurveTexture[0] != -1) {\n        \tGLES20.glActiveTexture(GLES20.GL_TEXTURE3);\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0);\n        }\n    }\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/core/filter/advanced/MagicSunriseFilter.java",
    "content": "package com.zero.magicshow.core.filter.advanced;\n\nimport android.opengl.GLES20;\n\nimport com.zero.magicshow.R;\nimport com.zero.magicshow.core.filter.base.gpuimage.GPUImageFilter;\nimport com.zero.magicshow.common.utils.MagicParams;\nimport com.zero.magicshow.common.utils.OpenGlUtils;\n\nimport java.nio.ByteBuffer;\n\npublic class MagicSunriseFilter extends GPUImageFilter{\n\tprivate int mMaskGrey1TextureId = -1;\n\tprivate int mMaskGrey1UniformLocation;\n\tprivate int mMaskGrey2TextureId = -1;\n\tprivate int mMaskGrey2UniformLocation;\n\tprivate int mMaskGrey3TextureId = -1;\n\tprivate int mMaskGrey3UniformLocation;\n\tprivate int[] mToneCurveTexture = { -1 };\n\tprivate int mToneCurveTextureUniformLocation;\n\t\n\tpublic MagicSunriseFilter(){\n\t\tsuper(NO_FILTER_VERTEX_SHADER, OpenGlUtils.readShaderFromRawResource(R.raw.sunrise));\n\t}\n\t\n\tprotected void onDestroy(){\n\t\tsuper.onDestroy();\n\t    GLES20.glDeleteTextures(1, mToneCurveTexture, 0);\n\t    mToneCurveTexture[0] = -1;\n\t    GLES20.glDeleteTextures(1, new int[]{mMaskGrey1TextureId}, 0);\n\t    mMaskGrey1TextureId = -1;\n\t    GLES20.glDeleteTextures(1, new int[]{mMaskGrey2TextureId}, 0);\n\t    mMaskGrey2TextureId = -1;\n\t    GLES20.glDeleteTextures(1, new int[]{mMaskGrey3TextureId}, 0);\n\t    mMaskGrey3TextureId = -1;\n\t}\n\t  \n\tprotected void onDrawArraysAfter(){\n\t\tif (mToneCurveTexture[0] != -1){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE3);\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0);\n\t    }\n\t\tif (mMaskGrey1TextureId != -1){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE4);\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0);\n\t    }\n\t    if (mMaskGrey2TextureId != -1){\n\t    \tGLES20.glActiveTexture(GLES20.GL_TEXTURE5);\n\t    \tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);\n\t    \tGLES20.glActiveTexture(GLES20.GL_TEXTURE0);\n\t    }\n\t    if (mMaskGrey3TextureId != -1){\n\t    \tGLES20.glActiveTexture(GLES20.GL_TEXTURE6);\n\t    \tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);\n\t    \tGLES20.glActiveTexture(GLES20.GL_TEXTURE0);\n\t    }\n\t}\n\t  \n\tprotected void onDrawArraysPre(){\n\t\tif (mToneCurveTexture[0] != -1){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE3);\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mToneCurveTexture[0]);\n\t\t\tGLES20.glUniform1i(mToneCurveTextureUniformLocation, 3);\n\t    }\n\t\tif (mMaskGrey1TextureId != -1){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE4);\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mMaskGrey1TextureId);\n\t\t\tGLES20.glUniform1i(mMaskGrey1UniformLocation, 4);\n\t    }\n\t    if (mMaskGrey2TextureId != -1){\n\t    \tGLES20.glActiveTexture(GLES20.GL_TEXTURE5);\n\t    \tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mMaskGrey2TextureId);\n\t     \tGLES20.glUniform1i(mMaskGrey2UniformLocation, 5);\n\t    }\n\t    if (mMaskGrey3TextureId != -1){\n\t    \tGLES20.glActiveTexture(GLES20.GL_TEXTURE6);\n\t    \tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mMaskGrey3TextureId);\n\t     \tGLES20.glUniform1i(mMaskGrey3UniformLocation, 6);\n\t    }\n\t}\n\t  \n\tprotected void onInit(){\n\t\tsuper.onInit();\n\t    mToneCurveTextureUniformLocation = GLES20.glGetUniformLocation(mGLProgId, \"curve\");\n        mMaskGrey1UniformLocation = GLES20.glGetUniformLocation(getProgram(), \"grey1Frame\");\n        mMaskGrey2UniformLocation = GLES20.glGetUniformLocation(getProgram(), \"grey2Frame\");\n        mMaskGrey3UniformLocation = GLES20.glGetUniformLocation(getProgram(), \"grey3Frame\");\n\t}\n\t  \n\tpublic void onInitialized(){\n\t\tsuper.onInitialized();\n\t    runOnDraw(new Runnable(){\n\t\t    public void run(){\n\t\t    \tGLES20.glActiveTexture(GLES20.GL_TEXTURE3);\n\t\t    \tGLES20.glGenTextures(1, mToneCurveTexture, 0);\n\t\t\t    GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mToneCurveTexture[0]);\n\t\t\t    GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t\t                GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);\n\t\t        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t\t                GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);\n\t\t        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t\t                GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);\n\t\t        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t\t                GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);\n\t\t        byte[] arrayOfByte = new byte[2048];\n\t\t        int[] arrayOfInt1 = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20, 21, 22, 23, 25, 26, 27, 28, 30, 31, 32, 34, 35, 36, 38, 39, 41, 42, 44, 45, 47, 49, 50, 52, 54, 55, 57, 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, 79, 81, 83, 85, 87, 89, 92, 94, 96, 98, 101, 103, 105, 107, 110, 111, 113, 115, 118, 120, 122, 124, 126, 129, 131, 133, 135, 137, 139, 141, 143, 145, 147, 149, 150, 152, 154, 156, 158, 159, 161, 162, 164, 166, 167, 169, 170, 172, 173, 174, 176, 177, 178, 180, 181, 182, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 200, 201, 202, 203, 203, 204, 205, 205, 207, 208, 208, 209, 209, 210, 210, 211, 211, 212, 212, 213, 213, 213, 214, 214, 215, 215, 215, 216, 216, 216, 216, 217, 217, 217, 218, 218, 218, 218, 219, 219, 219, 219, 219, 220, 220, 220, 220, 220, 220, 221, 221, 221, 221, 221, 222, 222, 222, 222, 222, 223, 223, 223, 223, 223, 224, 224, 224, 224, 224, 225, 225, 225, 225, 226, 226, 226, 227, 227, 227, 228, 228, 228, 229, 229, 230, 230, 230, 231, 231, 232, 232, 233, 233, 234, 234, 235, 235, 236, 236, 237, 238, 238, 239, 239, 241, 241, 242, 243, 243, 244, 245, 245, 246, 246, 247, 248, 248, 249, 250, 250, 251, 252, 252, 253, 254, 254, 255 };\n\t\t        int[] arrayOfInt2 = { 0, 1, 3, 4, 5, 7, 8, 10, 11, 12, 14, 15, 17, 18, 19, 21, 22, 24, 25, 27, 28, 30, 31, 33, 34, 36, 37, 39, 40, 42, 44, 45, 47, 48, 50, 52, 54, 55, 57, 59, 61, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 83, 85, 87, 90, 92, 94, 96, 98, 101, 103, 105, 107, 110, 111, 113, 115, 117, 119, 122, 124, 126, 128, 130, 132, 134, 136, 138, 140, 142, 143, 145, 147, 149, 150, 152, 154, 155, 157, 158, 160, 161, 163, 164, 165, 167, 168, 169, 171, 172, 173, 174, 175, 176, 177, 179, 180, 181, 182, 183, 184, 184, 185, 186, 187, 188, 189, 190, 190, 191, 192, 193, 193, 194, 195, 195, 196, 197, 197, 198, 198, 199, 199, 200, 200, 201, 201, 202, 202, 203, 203, 204, 204, 205, 205, 205, 207, 207, 208, 208, 208, 209, 209, 210, 210, 210, 211, 211, 211, 212, 212, 212, 213, 213, 213, 214, 214, 214, 215, 215, 215, 216, 216, 216, 217, 217, 217, 218, 218, 219, 219, 219, 220, 220, 220, 221, 221, 222, 222, 222, 223, 223, 224, 224, 225, 225, 225, 226, 226, 227, 227, 228, 228, 228, 229, 229, 230, 230, 231, 231, 232, 232, 233, 233, 234, 234, 235, 235, 236, 236, 236, 237, 237, 238, 238, 239, 239, 241, 241, 242, 242, 243, 244, 244, 245, 245, 246, 246, 247, 247, 248, 248, 249, 249, 250, 250, 251, 251, 252, 252, 253, 253, 254, 254, 255 };\n\t\t        int[] arrayOfInt3 = { 0, 1, 3, 4, 5, 6, 8, 9, 10, 11, 13, 14, 15, 17, 18, 19, 21, 22, 23, 25, 26, 28, 29, 30, 32, 33, 35, 36, 38, 39, 41, 43, 44, 46, 47, 49, 51, 53, 54, 56, 58, 60, 62, 64, 66, 68, 69, 71, 73, 76, 78, 80, 82, 83, 85, 87, 89, 91, 93, 95, 97, 100, 102, 104, 106, 108, 110, 111, 113, 115, 117, 119, 121, 123, 125, 127, 129, 130, 132, 134, 136, 138, 139, 141, 143, 145, 146, 148, 150, 151, 153, 155, 156, 158, 159, 161, 162, 164, 165, 167, 168, 169, 171, 172, 173, 175, 176, 177, 179, 180, 181, 182, 183, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 200, 201, 202, 203, 204, 204, 205, 207, 207, 208, 209, 209, 210, 210, 211, 212, 212, 213, 213, 214, 214, 215, 215, 215, 216, 216, 217, 217, 217, 218, 218, 218, 219, 219, 219, 220, 220, 220, 220, 221, 221, 221, 221, 222, 222, 222, 222, 223, 223, 223, 223, 224, 224, 224, 224, 224, 225, 225, 225, 225, 225, 226, 226, 226, 226, 227, 227, 227, 227, 228, 228, 228, 228, 229, 229, 229, 230, 230, 230, 231, 231, 231, 232, 232, 233, 233, 233, 234, 234, 235, 235, 235, 236, 236, 237, 237, 238, 238, 239, 239, 241, 241, 242, 242, 243, 243, 244, 244, 245, 245, 246, 247, 247, 248, 248, 249, 249, 250, 250, 251, 252, 252, 253, 253, 254, 254, 255 };\n\t\t        int[] arrayOfInt4 = { 0, 0, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 8, 8, 8, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 20, 20, 20, 21, 21, 21, 22, 22, 23, 23, 23, 24, 24, 24, 25, 25, 25, 25, 26, 26, 27, 27, 28, 28, 28, 28, 29, 29, 30, 29, 31, 31, 31, 31, 32, 32, 33, 33, 34, 34, 34, 34, 35, 35, 36, 36, 37, 37, 37, 38, 38, 39, 39, 39, 40, 40, 40, 41, 42, 42, 43, 43, 44, 44, 45, 45, 45, 46, 47, 47, 48, 48, 49, 50, 51, 51, 52, 52, 53, 53, 54, 55, 55, 56, 57, 57, 58, 59, 60, 60, 61, 62, 63, 63, 64, 65, 66, 67, 68, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 88, 89, 90, 91, 93, 94, 95, 96, 97, 98, 100, 101, 103, 104, 105, 107, 108, 110, 111, 113, 115, 116, 118, 119, 120, 122, 123, 125, 127, 128, 130, 132, 134, 135, 137, 139, 141, 143, 144, 146, 148, 150, 152, 154, 156, 158, 160, 163, 165, 167, 169, 171, 173, 175, 178, 180, 182, 185, 187, 189, 192, 194, 197, 199, 201, 204, 206, 209, 211, 214, 216, 219, 221, 224, 226, 229, 232, 234, 236, 239, 241, 245, 247, 250, 252, 255 };\n\t\t        for (int i = 0; i < 256; i++){\n\t\t          arrayOfByte[(i * 4)] = ((byte)arrayOfInt1[i]);\n\t\t          arrayOfByte[(1 + i * 4)] = ((byte)arrayOfInt2[i]);\n\t\t          arrayOfByte[(2 + i * 4)] = ((byte)arrayOfInt3[i]);\n\t\t          arrayOfByte[(3 + i * 4)] = ((byte)arrayOfInt4[i]);\n\t\t        }\n\t\t        int[] arrayOfInt5 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 5, 6, 7, 8, 9, 10, 12, 13, 14, 15, 16, 17, 19, 20, 21, 22, 23, 24, 26, 27, 28, 29, 30, 31, 32, 34, 35, 36, 37, 38, 39, 41, 42, 43, 44, 45, 46, 48, 49, 50, 51, 52, 53, 54, 56, 57, 58, 59, 60, 61, 63, 64, 65, 66, 67, 68, 70, 71, 72, 73, 74, 75, 77, 78, 79, 80, 81, 82, 83, 85, 86, 87, 88, 89, 90, 92, 93, 94, 95, 96, 97, 99, 100, 101, 102, 103, 104, 105, 107, 108, 109, 110, 111, 112, 114, 115, 116, 117, 118, 119, 121, 122, 123, 124, 125, 126, 128, 129, 130, 131, 132, 133, 134, 136, 137, 138, 139, 140, 141, 143, 144, 145, 146, 147, 148, 150, 151, 152, 153, 154, 155, 156, 158, 159, 160, 161, 162, 163, 165, 166, 167, 168, 169, 170, 172, 173, 174, 175, 176, 177, 178, 180, 181, 182, 183, 184, 185, 187, 188, 189, 190, 191, 192, 194, 195, 196, 197, 198, 199, 201, 202, 203, 204, 205, 206, 207, 209, 210, 211, 212, 213, 214, 216, 217, 218, 219, 220, 221, 223, 224, 225, 226, 227, 228, 230, 231, 232, 233, 234, 235, 236, 238, 239, 240, 241, 242, 243, 245, 246, 247, 248, 249, 250, 252, 253, 254, 255 };\n\t\t        int[] arrayOfInt6 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 4, 5, 6, 7, 9, 10, 11, 12, 14, 15, 16, 17, 19, 20, 21, 22, 24, 25, 26, 27, 29, 30, 31, 32, 34, 35, 36, 37, 39, 40, 41, 42, 44, 45, 46, 47, 49, 50, 51, 52, 53, 55, 56, 57, 58, 60, 61, 62, 63, 65, 66, 67, 68, 70, 71, 72, 73, 75, 76, 77, 78, 80, 81, 82, 83, 85, 86, 87, 88, 90, 91, 92, 93, 95, 96, 97, 98, 100, 101, 102, 103, 104, 106, 107, 108, 109, 111, 112, 113, 114, 116, 117, 118, 119, 121, 122, 123, 124, 126, 127, 128, 129, 131, 132, 133, 134, 136, 137, 138, 139, 141, 142, 143, 144, 146, 147, 148, 149, 151, 152, 153, 154, 155, 157, 158, 159, 160, 162, 163, 164, 165, 167, 168, 169, 170, 172, 173, 174, 175, 177, 178, 179, 180, 182, 183, 184, 185, 187, 188, 189, 190, 192, 193, 194, 195, 197, 198, 199, 200, 202, 203, 204, 205, 206, 208, 209, 210, 211, 213, 214, 215, 216, 218, 219, 220, 221, 223, 224, 225, 226, 228, 229, 230, 231, 233, 234, 235, 236, 238, 239, 240, 241, 243, 244, 245, 246, 248, 249, 250, 251, 253, 254, 255 };\n\t\t        int[] arrayOfInt7 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 18, 20, 21, 22, 23, 24, 25, 26, 28, 29, 30, 31, 32, 33, 34, 36, 37, 38, 39, 40, 41, 43, 44, 45, 46, 47, 48, 49, 51, 52, 53, 54, 55, 56, 57, 59, 60, 61, 62, 63, 64, 65, 67, 68, 69, 70, 71, 72, 74, 75, 76, 77, 78, 79, 80, 82, 83, 84, 85, 86, 87, 88, 90, 91, 92, 93, 94, 95, 96, 98, 99, 100, 101, 102, 103, 105, 106, 107, 108, 109, 110, 111, 113, 114, 115, 116, 117, 118, 119, 121, 122, 123, 124, 125, 126, 128, 129, 130, 131, 132, 133, 134, 136, 137, 138, 139, 140, 141, 142, 144, 145, 146, 147, 148, 149, 150, 152, 153, 154, 155, 156, 157, 159, 160, 161, 162, 163, 164, 165, 167, 168, 169, 170, 171, 172, 173, 175, 176, 177, 178, 179, 180, 181, 183, 184, 185, 186, 187, 188, 190, 191, 192, 193, 194, 195, 196, 198, 199, 200, 201, 202, 203, 204, 206, 207, 208, 209, 210, 211, 213, 214, 215, 216, 217, 218, 219, 221, 222, 223, 224, 225, 226, 227, 229, 230, 231, 232, 233, 234, 235, 237, 238, 239, 240, 241, 242, 244, 245, 246, 247, 248, 249, 250, 252, 253, 254, 255 };\n\t\t        int[] arrayOfInt8 = { 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 12, 12, 13, 14, 14, 15, 15, 16, 17, 17, 18, 19, 19, 20, 21, 22, 22, 23, 24, 24, 25, 26, 27, 27, 28, 29, 30, 31, 31, 32, 33, 34, 34, 35, 36, 37, 38, 39, 39, 40, 41, 42, 43, 44, 44, 45, 46, 47, 48, 49, 50, 51, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 126, 127, 128, 129, 130, 131, 132, 134, 135, 136, 137, 138, 139, 140, 142, 143, 144, 145, 146, 147, 149, 150, 151, 152, 153, 155, 156, 157, 158, 159, 160, 162, 163, 164, 165, 166, 168, 169, 170, 171, 173, 174, 175, 176, 177, 179, 180, 181, 182, 184, 185, 186, 187, 189, 190, 191, 192, 194, 195, 196, 197, 199, 200, 201, 202, 204, 205, 206, 208, 209, 210, 211, 213, 214, 215, 217, 218, 219, 221, 222, 223, 224, 226, 227, 228, 230, 231, 232, 234, 235, 236, 238, 239, 240, 242, 243, 244, 246, 247, 248, 250, 251, 252, 254, 255 };\n\t\t        for (int j = 0; j < 256; j++){\n\t\t          arrayOfByte[(1024 + j * 4)] = ((byte)arrayOfInt5[j]);\n\t\t          arrayOfByte[(1 + (1024 + j * 4))] = ((byte)arrayOfInt6[j]);\n\t\t          arrayOfByte[(2 + (1024 + j * 4))] = ((byte)arrayOfInt7[j]);\n\t\t          arrayOfByte[(3 + (1024 + j * 4))] = ((byte)arrayOfInt8[j]);\n\t\t        }\n\t\t        GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, 256, 2, 0, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, ByteBuffer.wrap(arrayOfByte));\n\t\t        GLES20.glActiveTexture(GLES20.GL_TEXTURE4);\n\t\t        mMaskGrey1TextureId = OpenGlUtils.loadTexture(MagicParams.context, \"filter/amaro_mask1.jpg\");\n\t\t        GLES20.glActiveTexture(GLES20.GL_TEXTURE5);\n\t\t        mMaskGrey2TextureId = OpenGlUtils.loadTexture(MagicParams.context, \"filter/amaro_mask2.jpg\");\n\t\t        GLES20.glActiveTexture(GLES20.GL_TEXTURE6);\n\t\t        mMaskGrey3TextureId = OpenGlUtils.loadTexture(MagicParams.context, \"filter/toy_mask1.jpg\");\n\t\t    }\n\t    });\n\t}\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/core/filter/advanced/MagicSunsetFilter.java",
    "content": "package com.zero.magicshow.core.filter.advanced;\n\nimport android.opengl.GLES20;\n\nimport com.zero.magicshow.R;\nimport com.zero.magicshow.core.filter.base.gpuimage.GPUImageFilter;\nimport com.zero.magicshow.common.utils.MagicParams;\nimport com.zero.magicshow.common.utils.OpenGlUtils;\n\nimport java.nio.ByteBuffer;\n\npublic class MagicSunsetFilter extends GPUImageFilter{\n\tprivate int mMaskGrey1TextureId = -1;\n\tprivate int mMaskGrey1UniformLocation;\n\tprivate int mMaskGrey2TextureId = -1;\n\tprivate int mMaskGrey2UniformLocation;\n\tprivate int[] mToneCurveTexture = { -1 };\n\tprivate int mToneCurveTextureUniformLocation;\n\t\n\tpublic MagicSunsetFilter(){\n\t\tsuper(NO_FILTER_VERTEX_SHADER, OpenGlUtils.readShaderFromRawResource(R.raw.sunset));\n\t}\n\t\n\tpublic void onDestroy(){\n\t\tsuper.onDestroy();\n\t    GLES20.glDeleteTextures(3, new int[]{mToneCurveTexture[0], mMaskGrey1TextureId, mMaskGrey2TextureId}, 0);\t    \n\t    mToneCurveTexture[0] = -1;\n\t    mMaskGrey1TextureId = -1;\n\t    mMaskGrey2TextureId = -1;\n\t}\n\t  \n\tprotected void onDrawArraysAfter(){\n\t\tif (mToneCurveTexture[0] != -1){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE3);\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0);\n\t    }\n\t\tif (mMaskGrey1TextureId != -1){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE4);\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0);\n\t    }\n\t    if (mMaskGrey2TextureId != -1){\n\t    \tGLES20.glActiveTexture(GLES20.GL_TEXTURE5);\n\t    \tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);\n\t    \tGLES20.glActiveTexture(GLES20.GL_TEXTURE0);\n\t    }\n\t}\n\t  \n\tprotected void onDrawArraysPre(){\n\t\tif (mToneCurveTexture[0] != -1){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE3);\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mToneCurveTexture[0]);\n\t\t\tGLES20.glUniform1i(mToneCurveTextureUniformLocation, 3);\n\t    }\n\t\tif (mMaskGrey1TextureId != -1){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE4);\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mMaskGrey1TextureId);\n\t\t\tGLES20.glUniform1i(mMaskGrey1UniformLocation, 4);\n\t    }\n\t    if (mMaskGrey2TextureId != -1){\n\t    \tGLES20.glActiveTexture(GLES20.GL_TEXTURE5);\n\t    \tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mMaskGrey2TextureId);\n\t     \tGLES20.glUniform1i(mMaskGrey2UniformLocation, 5);\n\t    }\n\t}\n\t  \n\tpublic void onInit(){\n\t\tsuper.onInit();\n\t    mToneCurveTextureUniformLocation = GLES20.glGetUniformLocation(mGLProgId, \"curve\");\n        mMaskGrey1UniformLocation = GLES20.glGetUniformLocation(getProgram(), \"grey1Frame\");\n        mMaskGrey2UniformLocation = GLES20.glGetUniformLocation(getProgram(), \"grey2Frame\");\n\t}\n\t  \n\tpublic void onInitialized(){\n\t\tsuper.onInitialized();\n\t    runOnDraw(new Runnable(){\n\t\t    public void run(){\n\t\t    \tGLES20.glGenTextures(1, mToneCurveTexture, 0);\n\t\t\t    GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mToneCurveTexture[0]);\n\t\t\t    GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t\t                GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);\n\t\t        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t\t                GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);\n\t\t        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t\t                GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);\n\t\t        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t\t                GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);\n\t\t    \tbyte[] arrayOfByte = new byte[2048];\n\t\t        int[] arrayOfInt1 = { 0, 1, 2, 3, 5, 5, 7, 8, 9, 10, 11, 12, 13, 15, 16, 16, 18, 19, 20, 21, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 35, 36, 38, 39, 40, 41, 42, 44, 45, 47, 48, 49, 51, 52, 54, 55, 56, 59, 60, 62, 63, 64, 66, 67, 70, 71, 72, 74, 76, 78, 79, 80, 83, 84, 85, 88, 89, 90, 93, 94, 95, 98, 99, 100, 102, 104, 106, 107, 108, 109, 112, 113, 114, 116, 117, 118, 119, 120, 122, 124, 125, 126, 128, 129, 130, 131, 132, 132, 133, 135, 136, 137, 138, 139, 140, 141, 142, 142, 143, 145, 146, 147, 148, 148, 149, 150, 151, 151, 152, 153, 154, 155, 155, 156, 157, 157, 158, 159, 160, 160, 161, 162, 162, 163, 164, 165, 165, 166, 167, 167, 168, 169, 169, 170, 171, 171, 172, 173, 173, 174, 175, 175, 176, 177, 177, 178, 178, 179, 179, 180, 181, 181, 182, 183, 183, 184, 185, 185, 186, 187, 188, 188, 189, 190, 190, 191, 192, 193, 193, 194, 194, 194, 195, 196, 197, 197, 198, 199, 200, 201, 201, 202, 203, 204, 204, 205, 206, 207, 208, 208, 208, 209, 210, 211, 212, 212, 213, 214, 215, 216, 217, 218, 218, 219, 220, 221, 222, 222, 223, 224, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 234, 235, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 247, 248, 248, 249, 250, 251, 252, 253, 254, 255 };\n\t\t        int[] arrayOfInt2 = { 0, 1, 2, 3, 4, 5, 6, 7, 9, 9, 10, 12, 12, 13, 14, 16, 16, 17, 19, 20, 20, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 35, 36, 37, 39, 40, 41, 42, 43, 44, 46, 47, 49, 50, 51, 53, 54, 56, 57, 59, 61, 62, 64, 65, 66, 69, 70, 72, 73, 76, 77, 78, 80, 82, 84, 85, 87, 89, 90, 93, 94, 95, 98, 99, 100, 103, 104, 106, 108, 109, 111, 112, 114, 116, 117, 118, 120, 122, 123, 124, 125, 126, 129, 130, 131, 132, 133, 135, 136, 137, 138, 139, 140, 141, 142, 143, 145, 146, 147, 148, 149, 150, 151, 152, 152, 153, 154, 155, 156, 157, 158, 158, 159, 160, 161, 162, 162, 163, 164, 165, 165, 166, 167, 167, 168, 169, 170, 170, 171, 172, 172, 173, 173, 174, 175, 175, 176, 177, 177, 178, 178, 178, 179, 179, 180, 181, 181, 182, 182, 183, 184, 184, 185, 185, 186, 187, 187, 188, 188, 189, 190, 190, 191, 191, 192, 193, 193, 194, 194, 194, 195, 195, 196, 197, 197, 198, 199, 199, 200, 201, 202, 202, 203, 204, 204, 205, 206, 207, 208, 208, 208, 209, 210, 210, 211, 212, 213, 214, 215, 215, 216, 217, 218, 219, 220, 221, 222, 222, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 234, 235, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 248, 249, 250, 251, 252, 253, 254, 255 };\n\t\t        int[] arrayOfInt3 = { 0, 1, 2, 3, 4, 5, 5, 7, 8, 9, 9, 11, 12, 12, 13, 14, 16, 16, 17, 18, 20, 20, 21, 22, 23, 25, 25, 26, 27, 29, 30, 31, 31, 32, 34, 35, 36, 37, 39, 40, 41, 41, 42, 44, 45, 46, 47, 48, 50, 51, 52, 53, 54, 56, 57, 59, 60, 61, 63, 64, 65, 66, 67, 69, 71, 72, 73, 74, 76, 78, 79, 80, 82, 83, 84, 85, 88, 89, 90, 92, 93, 94, 95, 98, 99, 100, 102, 103, 104, 106, 107, 108, 111, 112, 113, 114, 116, 117, 118, 119, 120, 122, 123, 124, 125, 126, 128, 129, 130, 131, 132, 133, 135, 136, 137, 138, 139, 140, 141, 142, 143, 145, 146, 147, 147, 148, 149, 150, 151, 152, 153, 154, 154, 155, 156, 157, 158, 159, 159, 160, 161, 162, 162, 163, 164, 165, 166, 166, 167, 168, 169, 169, 170, 171, 172, 172, 173, 174, 175, 175, 176, 177, 178, 178, 178, 179, 179, 180, 181, 182, 182, 183, 184, 185, 185, 186, 187, 188, 188, 189, 190, 191, 191, 192, 193, 194, 194, 194, 195, 196, 197, 198, 198, 199, 200, 201, 202, 203, 203, 204, 205, 206, 207, 208, 208, 209, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 222, 223, 224, 225, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 235, 236, 237, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 248, 249, 250, 251, 252, 253, 254, 255 };\n\t\t        int[] arrayOfInt4 = { 0, 1, 3, 4, 6, 7, 9, 10, 12, 13, 14, 16, 17, 19, 20, 21, 23, 24, 26, 27, 28, 30, 31, 32, 34, 35, 36, 38, 39, 40, 42, 43, 44, 45, 47, 48, 49, 51, 52, 53, 54, 55, 57, 58, 59, 60, 62, 63, 64, 65, 66, 67, 69, 70, 71, 72, 73, 74, 75, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 115, 116, 117, 118, 119, 120, 121, 121, 122, 123, 124, 125, 126, 126, 127, 128, 129, 130, 130, 131, 132, 133, 134, 135, 135, 136, 137, 138, 139, 140, 141, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 230, 231, 232, 233, 234, 235, 235, 236, 237, 238, 239, 239, 240, 241, 242, 243, 243, 244, 245, 245, 246, 247, 247, 248, 249, 249, 250, 251, 251, 252, 252, 253, 253, 254, 254, 255 };\n\t\t        for (int i = 0; i < 256; i++)\n\t\t        {\n\t\t          arrayOfByte[(i * 4)] = ((byte)arrayOfInt1[i]);\n\t\t          arrayOfByte[(1 + i * 4)] = ((byte)arrayOfInt2[i]);\n\t\t          arrayOfByte[(2 + i * 4)] = ((byte)arrayOfInt3[i]);\n\t\t          arrayOfByte[(3 + i * 4)] = ((byte)arrayOfInt4[i]);\n\t\t        }\n\t\t        int[] arrayOfInt5 = { 0, 0, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 8, 8, 8, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 20, 20, 20, 21, 21, 21, 22, 22, 23, 23, 23, 24, 24, 24, 25, 25, 25, 25, 26, 26, 27, 27, 28, 28, 28, 28, 29, 29, 30, 29, 31, 31, 31, 31, 32, 32, 33, 33, 34, 34, 34, 34, 35, 35, 36, 36, 37, 37, 37, 38, 38, 39, 39, 39, 40, 40, 40, 41, 42, 42, 43, 43, 44, 44, 45, 45, 45, 46, 47, 47, 48, 48, 49, 50, 51, 51, 52, 52, 53, 53, 54, 55, 55, 56, 57, 57, 58, 59, 60, 60, 61, 62, 63, 63, 64, 65, 66, 67, 68, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 88, 89, 90, 91, 93, 94, 95, 96, 97, 98, 100, 101, 103, 104, 105, 107, 108, 110, 111, 113, 115, 116, 118, 119, 120, 122, 123, 125, 127, 128, 130, 132, 134, 135, 137, 139, 141, 143, 144, 146, 148, 150, 152, 154, 156, 158, 160, 163, 165, 167, 169, 171, 173, 175, 178, 180, 182, 185, 187, 189, 192, 194, 197, 199, 201, 204, 206, 209, 211, 214, 216, 219, 221, 224, 226, 229, 232, 234, 236, 239, 241, 245, 247, 250, 252, 255 };\n\t\t        for (int j = 0; j < 256; j++)\n\t\t        {\n\t\t          arrayOfByte[(1024 + j * 4)] = ((byte)arrayOfInt5[j]);\n\t\t          arrayOfByte[(1 + (1024 + j * 4))] = ((byte)arrayOfInt5[j]);\n\t\t          arrayOfByte[(2 + (1024 + j * 4))] = ((byte)arrayOfInt5[j]);\n\t\t          arrayOfByte[(3 + (1024 + j * 4))] = -1;\n\t\t        }\n\t\t        GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, 256, 2, 0, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, ByteBuffer.wrap(arrayOfByte));\n\t\t        mMaskGrey1TextureId = OpenGlUtils.loadTexture(MagicParams.context, \"filter/rise_mask1.jpg\");\n\t\t        mMaskGrey2TextureId = OpenGlUtils.loadTexture(MagicParams.context, \"filter/rise_mask2.jpg\");\n\t\t    }\n\t    });\n\t}\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/core/filter/advanced/MagicSutroFilter.java",
    "content": "package com.zero.magicshow.core.filter.advanced;\n\nimport android.opengl.GLES20;\n\nimport com.zero.magicshow.R;\nimport com.zero.magicshow.core.filter.base.gpuimage.GPUImageFilter;\nimport com.zero.magicshow.common.utils.MagicParams;\nimport com.zero.magicshow.common.utils.OpenGlUtils;\n\npublic class MagicSutroFilter extends GPUImageFilter{\n\tprivate int[] inputTextureHandles = {-1,-1,-1,-1,-1};\n\tprivate int[] inputTextureUniformLocations = {-1,-1,-1,-1,-1};\n    private int mGLStrengthLocation;\n\n\tpublic MagicSutroFilter(){\n\t\tsuper(NO_FILTER_VERTEX_SHADER, OpenGlUtils.readShaderFromRawResource(R.raw.sutro));\n\t}\n\t\n\tpublic void onDestroy() {\n        super.onDestroy();\n        GLES20.glDeleteTextures(inputTextureHandles.length, inputTextureHandles, 0);\n        for(int i = 0; i < inputTextureHandles.length; i++)\n        \tinputTextureHandles[i] = -1;\n    }\n\t\n\tprotected void onDrawArraysAfter(){\n\t\tfor(int i = 0; i < inputTextureHandles.length\n\t\t\t\t&& inputTextureHandles[i] != OpenGlUtils.NO_TEXTURE; i++){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3));\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0);\n\t\t}\n\t}\n\t  \n\tprotected void onDrawArraysPre(){\n\t\tfor(int i = 0; i < inputTextureHandles.length \n\t\t\t\t&& inputTextureHandles[i] != OpenGlUtils.NO_TEXTURE; i++){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3) );\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, inputTextureHandles[i]);\n\t\t\tGLES20.glUniform1i(inputTextureUniformLocations[i], (i+3));\n\t\t}\n\t}\n\t\n\tpublic void onInit(){\n\t\tsuper.onInit();\n\t\tfor(int i=0; i < inputTextureUniformLocations.length; i++)\n\t\t\tinputTextureUniformLocations[i] = GLES20.glGetUniformLocation(getProgram(), \"inputImageTexture\"+(2+i));\n\t\tmGLStrengthLocation = GLES20.glGetUniformLocation(mGLProgId,\n\t\t\t\t\"strength\");\n\t}\n\t\n\tpublic void onInitialized(){\n\t\tsuper.onInitialized();\n\t\tsetFloat(mGLStrengthLocation, 1.0f);\n\t    runOnDraw(new Runnable(){\n\t\t    public void run(){\n\t\t    \tinputTextureHandles[0] = OpenGlUtils.loadTexture(MagicParams.context, \"filter/vignette_map.png\");\n\t\t\t\tinputTextureHandles[1] = OpenGlUtils.loadTexture(MagicParams.context, \"filter/sutrometal.png\");\n\t\t\t\tinputTextureHandles[2] = OpenGlUtils.loadTexture(MagicParams.context, \"filter/softlight.png\");\n\t\t\t\tinputTextureHandles[3] = OpenGlUtils.loadTexture(MagicParams.context, \"filter/sutroedgeburn.png\");\n\t\t\t\tinputTextureHandles[4] = OpenGlUtils.loadTexture(MagicParams.context, \"filter/sutrocurves.png\");\n\t\t    }\n\t    });\n\t}\n}"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/core/filter/advanced/MagicSweetsFilter.java",
    "content": "package com.zero.magicshow.core.filter.advanced;\n\nimport android.opengl.GLES20;\n\nimport com.zero.magicshow.R;\nimport com.zero.magicshow.core.filter.base.gpuimage.GPUImageFilter;\nimport com.zero.magicshow.common.utils.MagicParams;\nimport com.zero.magicshow.common.utils.OpenGlUtils;\n\nimport java.nio.ByteBuffer;\n\npublic class MagicSweetsFilter extends GPUImageFilter{\n\tprivate int[] mToneCurveTexture = {-1};\n\tprivate int mToneCurveTextureUniformLocation;\n\tprivate int mMaskGrey1TextureId = -1;\n\tprivate int mMaskGrey1UniformLocation;\n\tprivate int mLowPerformanceUniformLocation;\n\t\n\tpublic MagicSweetsFilter(){\n\t\tsuper(NO_FILTER_VERTEX_SHADER, OpenGlUtils.readShaderFromRawResource(R.raw.sweets));\n\t}\n\t\n\tpublic void onDestroy(){\n\t\tsuper.onDestroy();\n\t    GLES20.glDeleteTextures(2, new int[]{mToneCurveTexture[0], mMaskGrey1TextureId}, 0);\n\t    mToneCurveTexture[0] = -1;\n\t    mMaskGrey1TextureId = -1;\n\t}\n\t  \n\tprotected void onDrawArraysAfter(){\n\t\tif (mToneCurveTexture[0] != -1){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE3);\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0);\n\t    }\n\t\tif (mMaskGrey1TextureId != -1){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE4);\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0);\n\t    }\n\t}\n\t  \n\tprotected void onDrawArraysPre(){\n\t\tif (mToneCurveTexture[0] != -1){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE3);\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mToneCurveTexture[0]);\n\t\t\tGLES20.glUniform1i(mToneCurveTextureUniformLocation, 3);\n\t    }\n\t\tif (mMaskGrey1TextureId != -1){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE4);\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mMaskGrey1TextureId);\n\t\t\tGLES20.glUniform1i(mMaskGrey1UniformLocation, 4);\n\t    }\n\t}\n\t  \n\tpublic void onInit(){\n\t\tsuper.onInit();\n\t    mToneCurveTextureUniformLocation = GLES20.glGetUniformLocation(mGLProgId, \"curve\");\n        mMaskGrey1UniformLocation = GLES20.glGetUniformLocation(getProgram(), \"grey1Frame\");\n        mLowPerformanceUniformLocation = GLES20.glGetUniformLocation(getProgram(), \"lowPerformance\");\n        setInteger(mLowPerformanceUniformLocation, 1);\n\t}\n\t  \n\tpublic void onInitialized(){\n\t\tsuper.onInitialized();\n\t    runOnDraw(new Runnable(){\n\t\t    public void run(){\n\t\t    \tGLES20.glGenTextures(1, mToneCurveTexture, 0);\n\t\t\t    GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mToneCurveTexture[0]);\n\t\t\t    GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t\t                GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);\n\t\t        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t\t                GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);\n\t\t        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t\t                GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);\n\t\t        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t\t                GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);\t\t\t\t\n\t\t        byte[] arrayOfByte = new byte[1024];\n\t\t        int[] arrayOfInt = { 0, 1, 2, 2, 3, 4, 5, 6, 6, 7, 8, 9, 10, 10, 11, 12, 13, 14, 14, 15, 16, 17, 18, 19, 19, 20, 21, 22, 23, 24, 24, 25, 26, 27, 28, 29, 30, 30, 31, 32, 33, 34, 35, 36, 37, 38, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 71, 72, 73, 74, 75, 76, 77, 79, 80, 81, 82, 83, 84, 86, 87, 88, 89, 90, 92, 93, 94, 95, 96, 98, 99, 100, 101, 103, 104, 105, 106, 108, 109, 110, 111, 113, 114, 115, 116, 118, 119, 120, 121, 123, 124, 125, 126, 128, 129, 130, 132, 133, 134, 135, 137, 138, 139, 140, 142, 143, 144, 145, 147, 148, 149, 150, 152, 153, 154, 155, 157, 158, 159, 160, 161, 163, 164, 165, 166, 167, 169, 170, 171, 172, 173, 174, 176, 177, 178, 179, 180, 181, 182, 183, 184, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 209, 210, 211, 212, 213, 214, 215, 216, 217, 217, 218, 219, 220, 221, 222, 222, 223, 224, 225, 226, 227, 227, 228, 229, 230, 230, 231, 232, 233, 234, 234, 235, 236, 237, 237, 238, 239, 240, 240, 241, 242, 243, 243, 244, 245, 246, 246, 247, 248, 248, 249, 250, 251, 251, 252, 253, 254, 254, 255 };\n\t\t        for (int i = 0; i < 256; i++){\n\t\t          arrayOfByte[(i * 4)] = ((byte)arrayOfInt[i]);\n\t\t          arrayOfByte[(1 + i * 4)] = ((byte)arrayOfInt[i]);\n\t\t          arrayOfByte[(2 + i * 4)] = ((byte)arrayOfInt[i]);\n\t\t          arrayOfByte[(3 + i * 4)] = ((byte)i);\n\t\t        }\n\t\t        GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, 256, 1, 0, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, ByteBuffer.wrap(arrayOfByte));\n\t\t        mMaskGrey1TextureId = OpenGlUtils.loadTexture(MagicParams.context, \"filter/rise_mask2.jpg\");\n\t\t    }\n\t    });\n\t}\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/core/filter/advanced/MagicTenderFilter.java",
    "content": "package com.zero.magicshow.core.filter.advanced;\n\nimport android.opengl.GLES20;\n\nimport com.zero.magicshow.R;\nimport com.zero.magicshow.core.filter.base.gpuimage.GPUImageFilter;\nimport com.zero.magicshow.common.utils.MagicParams;\nimport com.zero.magicshow.common.utils.OpenGlUtils;\n\nimport java.nio.ByteBuffer;\n\npublic class MagicTenderFilter extends GPUImageFilter{\n\tprivate int[] mToneCurveTexture = {-1};\n\tprivate int mToneCurveTextureUniformLocation;\n\tprivate int mMaskGrey1TextureId = -1;\n\tprivate int mMaskGrey1UniformLocation;\n\t\n\tpublic MagicTenderFilter(){\n\t\tsuper(NO_FILTER_VERTEX_SHADER, OpenGlUtils.readShaderFromRawResource(R.raw.tender));\n\t}\n\t\n\tpublic void onDestroy(){\n\t\tsuper.onDestroy();\n\t    GLES20.glDeleteTextures(2, new int[]{mToneCurveTexture[0], mMaskGrey1TextureId}, 0);\n\t    mToneCurveTexture[0] = -1;\n\t    mMaskGrey1TextureId = -1;\n\t}\n\t  \n\tprotected void onDrawArraysAfter(){\n\t\tif (mToneCurveTexture[0] != -1){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE3);\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0);\n\t    }\n\t\tif (mMaskGrey1TextureId != -1){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE4);\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0);\n\t    }\n\t}\n\t  \n\tprotected void onDrawArraysPre(){\n\t\tif (mToneCurveTexture[0] != -1){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE3);\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mToneCurveTexture[0]);\n\t\t\tGLES20.glUniform1i(mToneCurveTextureUniformLocation, 3);\n\t    }\n\t\tif (mMaskGrey1TextureId != -1){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE4);\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mMaskGrey1TextureId);\n\t\t\tGLES20.glUniform1i(mMaskGrey1UniformLocation, 4);\n\t    }\n\t}\n\t  \n\tpublic void onInit(){\n\t\tsuper.onInit();\n\t    mToneCurveTextureUniformLocation = GLES20.glGetUniformLocation(mGLProgId, \"curve\");\n        mMaskGrey1UniformLocation = GLES20.glGetUniformLocation(getProgram(), \"grey1Frame\");\n\t}\n\t  \n\tpublic void onInitialized(){\n\t\tsuper.onInitialized();\n\t    runOnDraw(new Runnable(){\n\t\t    public void run(){\n\t\t    \tGLES20.glGenTextures(1, mToneCurveTexture, 0);\n\t\t\t    GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mToneCurveTexture[0]);\n\t\t\t    GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t\t                GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);\n\t\t        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t\t                GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);\n\t\t        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t\t                GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);\n\t\t        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t\t                GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);\t\t\t\t\t\n\t\t        byte[] arrayOfByte = new byte[1024];\n\t\t        int[] arrayOfInt1 = { 10, 12, 14, 15, 17, 19, 21, 22, 24, 26, 28, 29, 31, 33, 35, 38, 40, 41, 43, 45, 47, 48, 50, 52, 53, 55, 57, 58, 60, 61, 63, 65, 66, 68, 69, 71, 72, 74, 75, 77, 79, 80, 81, 83, 84, 86, 87, 89, 92, 93, 94, 96, 97, 99, 100, 101, 103, 104, 105, 107, 108, 109, 110, 112, 113, 114, 116, 117, 118, 119, 120, 122, 123, 124, 125, 126, 127, 129, 130, 131, 132, 133, 134, 135, 136, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 158, 159, 160, 161, 162, 163, 164, 165, 166, 166, 167, 168, 169, 170, 171, 171, 172, 173, 174, 175, 175, 176, 177, 178, 179, 179, 180, 181, 182, 182, 183, 184, 184, 185, 186, 187, 187, 188, 189, 189, 190, 191, 191, 192, 193, 193, 194, 195, 195, 196, 196, 197, 198, 198, 199, 200, 200, 201, 201, 202, 202, 203, 204, 204, 205, 205, 206, 206, 207, 207, 208, 209, 209, 210, 210, 211, 211, 212, 212, 213, 213, 214, 214, 215, 215, 216, 216, 216, 217, 217, 218, 218, 219, 219, 219, 220, 220, 221, 221, 222, 222, 223, 223, 224, 224, 224, 225, 225, 226, 226, 227, 227, 227, 228, 228, 229, 229, 230, 230, 230, 231, 231, 232, 232, 232, 233, 233, 234, 234, 234, 234, 235, 235, 236, 236, 236, 237, 237, 238, 238, 238, 239, 239, 240, 240, 240, 241, 241, 242, 242 };\n\t\t        int[] arrayOfInt2 = { 10, 12, 14, 15, 17, 19, 19, 21, 22, 24, 26, 28, 29, 31, 33, 35, 36, 36, 38, 40, 41, 43, 45, 47, 48, 50, 52, 52, 53, 55, 57, 58, 60, 61, 63, 65, 66, 68, 69, 69, 71, 72, 74, 75, 77, 79, 80, 81, 83, 84, 86, 86, 87, 89, 90, 92, 93, 94, 96, 97, 99, 100, 101, 103, 103, 104, 105, 107, 108, 109, 110, 112, 113, 114, 116, 117, 118, 119, 120, 122, 122, 123, 124, 125, 126, 127, 129, 130, 131, 132, 133, 134, 135, 136, 138, 139, 140, 141, 142, 143, 144, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 158, 159, 160, 161, 162, 163, 164, 165, 166, 166, 167, 168, 169, 170, 171, 171, 172, 173, 174, 175, 175, 176, 177, 178, 179, 179, 180, 181, 182, 182, 183, 184, 184, 185, 186, 187, 187, 188, 189, 190, 191, 191, 192, 193, 193, 194, 195, 195, 196, 196, 197, 198, 198, 199, 200, 200, 201, 201, 202, 202, 204, 204, 205, 205, 206, 206, 207, 207, 208, 209, 209, 210, 210, 211, 211, 212, 213, 213, 214, 214, 215, 215, 216, 216, 217, 217, 218, 218, 219, 219, 220, 220, 221, 221, 222, 222, 223, 223, 224, 224, 224, 225, 226, 226, 227, 227, 227, 228, 228, 229, 229, 230, 230, 231, 231, 232, 232, 232, 233, 233, 234, 234, 234, 235, 236, 236, 236, 237, 237, 238, 238, 238, 239, 239, 240, 240, 241, 241, 242, 242 };\n\t\t        int[] arrayOfInt3 = { 10, 12, 12, 14, 15, 15, 17, 17, 19, 21, 21, 22, 24, 24, 26, 28, 28, 29, 31, 31, 33, 33, 35, 36, 36, 38, 40, 40, 41, 43, 43, 45, 47, 47, 48, 50, 52, 52, 53, 55, 55, 57, 58, 58, 60, 61, 63, 63, 65, 66, 68, 68, 69, 71, 71, 72, 74, 75, 77, 77, 79, 80, 81, 81, 83, 84, 86, 87, 87, 89, 90, 92, 93, 94, 94, 96, 97, 99, 100, 101, 103, 103, 104, 105, 107, 108, 109, 110, 112, 113, 113, 114, 116, 117, 118, 119, 120, 122, 123, 124, 125, 126, 127, 129, 130, 130, 131, 132, 133, 134, 135, 136, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 154, 155, 156, 157, 158, 158, 159, 160, 161, 162, 163, 164, 165, 166, 166, 167, 169, 170, 171, 171, 172, 173, 174, 175, 175, 176, 178, 179, 179, 180, 181, 182, 182, 183, 184, 185, 186, 187, 187, 188, 189, 190, 191, 191, 192, 193, 193, 195, 195, 196, 196, 197, 198, 199, 200, 200, 201, 201, 202, 203, 204, 204, 205, 206, 206, 207, 207, 209, 209, 210, 210, 211, 212, 212, 213, 213, 214, 215, 215, 216, 217, 217, 218, 218, 219, 219, 220, 220, 221, 222, 222, 223, 223, 224, 224, 225, 225, 226, 227, 227, 227, 228, 229, 229, 230, 230, 231, 231, 232, 232, 233, 233, 234, 234, 235, 235, 236, 236, 237, 238, 238, 238, 239, 240, 240, 240, 241, 242, 242 };\n\t\t        int[] arrayOfInt4 = { 0, 0, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 8, 8, 8, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 20, 20, 20, 21, 21, 21, 22, 22, 23, 23, 23, 24, 24, 24, 25, 25, 25, 25, 26, 26, 27, 27, 28, 28, 28, 28, 29, 29, 30, 29, 31, 31, 31, 31, 32, 32, 33, 33, 34, 34, 34, 34, 35, 35, 36, 36, 37, 37, 37, 38, 38, 39, 39, 39, 40, 40, 40, 41, 42, 42, 43, 43, 44, 44, 45, 45, 45, 46, 47, 47, 48, 48, 49, 50, 51, 51, 52, 52, 53, 53, 54, 55, 55, 56, 57, 57, 58, 59, 60, 60, 61, 62, 63, 63, 64, 65, 66, 67, 68, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 88, 89, 90, 91, 93, 94, 95, 96, 97, 98, 100, 101, 103, 104, 105, 107, 108, 110, 111, 113, 115, 116, 118, 119, 120, 122, 123, 125, 127, 128, 130, 132, 134, 135, 137, 139, 141, 143, 144, 146, 148, 150, 152, 154, 156, 158, 160, 163, 165, 167, 169, 171, 173, 175, 178, 180, 182, 185, 187, 189, 192, 194, 197, 199, 201, 204, 206, 209, 211, 214, 216, 219, 221, 224, 226, 229, 232, 234, 236, 239, 241, 245, 247, 250, 252, 255 };\n\t\t        for (int i = 0; i < 256; i++){\n\t\t          arrayOfByte[(i * 4)] = ((byte)arrayOfInt1[i]);\n\t\t          arrayOfByte[(1 + i * 4)] = ((byte)arrayOfInt2[i]);\n\t\t          arrayOfByte[(2 + i * 4)] = ((byte)arrayOfInt3[i]);\n\t\t          arrayOfByte[(3 + i * 4)] = ((byte)arrayOfInt4[i]);\n\t\t        }\n\t\t        GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, 256, 1, 0, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, ByteBuffer.wrap(arrayOfByte));\n\t\t        mMaskGrey1TextureId = OpenGlUtils.loadTexture(MagicParams.context, \"filter/bluevintage_mask1.jpg\");\n\t\t    }\n\t    });\n\t}\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/core/filter/advanced/MagicToasterFilter.java",
    "content": "package com.zero.magicshow.core.filter.advanced;\n\nimport android.opengl.GLES20;\n\nimport com.zero.magicshow.R;\nimport com.zero.magicshow.core.filter.base.gpuimage.GPUImageFilter;\nimport com.zero.magicshow.common.utils.MagicParams;\nimport com.zero.magicshow.common.utils.OpenGlUtils;\n\npublic class MagicToasterFilter extends GPUImageFilter{\n\tprivate int[] inputTextureHandles = {-1,-1,-1,-1,-1};\n\tprivate int[] inputTextureUniformLocations = {-1,-1,-1,-1,-1};\n    private int mGLStrengthLocation;\n\n\tpublic MagicToasterFilter(){\n\t\tsuper(NO_FILTER_VERTEX_SHADER, OpenGlUtils.readShaderFromRawResource(R.raw.toaster2_filter_shader));\n\t}\n\t\n\tpublic void onDestroy() {\n        super.onDestroy();\n        GLES20.glDeleteTextures(inputTextureHandles.length, inputTextureHandles, 0);\n        for(int i = 0; i < inputTextureHandles.length; i++)\n        \tinputTextureHandles[i] = -1;\n    }\n\t\n\tprotected void onDrawArraysAfter(){\n\t\tfor(int i = 0; i < inputTextureHandles.length\n\t\t\t\t&& inputTextureHandles[i] != OpenGlUtils.NO_TEXTURE; i++){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3));\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0);\n\t\t}\n\t}\n\t  \n\tprotected void onDrawArraysPre(){\n\t\tfor(int i = 0; i < inputTextureHandles.length \n\t\t\t\t&& inputTextureHandles[i] != OpenGlUtils.NO_TEXTURE; i++){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3) );\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, inputTextureHandles[i]);\n\t\t\tGLES20.glUniform1i(inputTextureUniformLocations[i], (i+3));\n\t\t}\n\t}\n\t\n\tpublic void onInit(){\n\t\tsuper.onInit();\n\t\tfor(int i = 0; i < inputTextureUniformLocations.length; i++)\n\t\t\tinputTextureUniformLocations[i] = GLES20.glGetUniformLocation(getProgram(), \"inputImageTexture\"+(2+i));\n\t\tmGLStrengthLocation = GLES20.glGetUniformLocation(mGLProgId,\n\t\t\t\t\"strength\");\n\t}\n\t\n\tpublic void onInitialized(){\n\t\tsuper.onInitialized();\n\t\tsetFloat(mGLStrengthLocation, 1.0f);\n\t    runOnDraw(new Runnable(){\n\t\t    public void run(){\n\t\t    \tinputTextureHandles[0] = OpenGlUtils.loadTexture(MagicParams.context, \"filter/toastermetal.png\");\n\t\t\t\tinputTextureHandles[1] = OpenGlUtils.loadTexture(MagicParams.context, \"filter/toastersoftlight.png\");\n\t\t\t\tinputTextureHandles[2] = OpenGlUtils.loadTexture(MagicParams.context, \"filter/toastercurves.png\");\n\t\t\t\tinputTextureHandles[3] = OpenGlUtils.loadTexture(MagicParams.context, \"filter/toasteroverlaymapwarm.png\");\n\t\t\t\tinputTextureHandles[4] = OpenGlUtils.loadTexture(MagicParams.context, \"filter/toastercolorshift.png\");\n\t\t    }\n\t    });\n\t}\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/core/filter/advanced/MagicValenciaFilter.java",
    "content": "package com.zero.magicshow.core.filter.advanced;\n\nimport android.opengl.GLES20;\n\nimport com.zero.magicshow.R;\nimport com.zero.magicshow.core.filter.base.gpuimage.GPUImageFilter;\nimport com.zero.magicshow.common.utils.MagicParams;\nimport com.zero.magicshow.common.utils.OpenGlUtils;\n\npublic class MagicValenciaFilter extends GPUImageFilter{\n\tprivate int[] inputTextureHandles = {-1,-1};\n\tprivate int[] inputTextureUniformLocations = {-1,-1};\n\tprivate int mGLStrengthLocation;\n\n\tpublic MagicValenciaFilter(){\n\t\tsuper(NO_FILTER_VERTEX_SHADER, OpenGlUtils.readShaderFromRawResource(R.raw.valencia));\n\t}\n\t\n\tprotected void onDrawArraysAfter(){\n\t\tfor(int i = 0; i < inputTextureHandles.length\n\t\t\t\t&& inputTextureHandles[i] != OpenGlUtils.NO_TEXTURE; i++){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3));\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0);\n\t\t}\n\t}\n\t  \n\tprotected void onDrawArraysPre(){\n\t\tfor(int i = 0; i < inputTextureHandles.length \n\t\t\t\t&& inputTextureHandles[i] != OpenGlUtils.NO_TEXTURE; i++){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3) );\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, inputTextureHandles[i]);\n\t\t\tGLES20.glUniform1i(inputTextureUniformLocations[i], (i+3));\n\t\t}\n\t}\n\t\n\tpublic void onInit(){\n\t\tsuper.onInit();\n\t\tfor(int i = 0; i < inputTextureUniformLocations.length; i++)\n\t\t\tinputTextureUniformLocations[i] = GLES20.glGetUniformLocation(getProgram(), \"inputImageTexture\"+(2+i));\n\t\tmGLStrengthLocation = GLES20.glGetUniformLocation(mGLProgId,\n\t\t\t\t\"strength\");\n\t}\n\t\n\tpublic void onDestroy() {\n        super.onDestroy();\n        GLES20.glDeleteTextures(inputTextureHandles.length, inputTextureHandles, 0);\n        for(int i = 0; i < inputTextureHandles.length; i++)\n        \tinputTextureHandles[i] = -1;\n    }\n\t\n\tpublic void onInitialized(){\n\t\tsuper.onInitialized();\n\t\tsetFloat(mGLStrengthLocation, 1.0f);\n\t    runOnDraw(new Runnable(){\n\t\t    public void run(){\n\t\t    \tinputTextureHandles[0] = OpenGlUtils.loadTexture(MagicParams.context, \"filter/valenciamap.png\");\n\t\t\t\tinputTextureHandles[1] = OpenGlUtils.loadTexture(MagicParams.context, \"filter/valenciagradientmap.png\");\n\t\t    }\n\t    });\n\t}\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/core/filter/advanced/MagicWaldenFilter.java",
    "content": "package com.zero.magicshow.core.filter.advanced;\n\nimport android.opengl.GLES20;\n\nimport com.zero.magicshow.R;\nimport com.zero.magicshow.core.filter.base.gpuimage.GPUImageFilter;\nimport com.zero.magicshow.common.utils.MagicParams;\nimport com.zero.magicshow.common.utils.OpenGlUtils;\n\npublic class MagicWaldenFilter extends GPUImageFilter{\n\tprivate int[] inputTextureHandles = {-1,-1};\n\tprivate int[] inputTextureUniformLocations = {-1,-1};\n\tprivate int mGLStrengthLocation;\n\n\tpublic MagicWaldenFilter(){\n\t\tsuper(NO_FILTER_VERTEX_SHADER, OpenGlUtils.readShaderFromRawResource(R.raw.walden));\n\t}\n\t\n\tpublic void onDestroy() {\n        super.onDestroy();\n        GLES20.glDeleteTextures(inputTextureHandles.length, inputTextureHandles, 0);\n        for(int i = 0; i < inputTextureHandles.length; i++)\n        \tinputTextureHandles[i] = -1;\n    }\n\t\n\tprotected void onDrawArraysAfter(){\n\t\tfor(int i = 0; i < inputTextureHandles.length\n\t\t\t\t&& inputTextureHandles[i] != OpenGlUtils.NO_TEXTURE; i++){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3));\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0);\n\t\t}\n\t}\n\t  \n\tprotected void onDrawArraysPre(){\n\t\tfor(int i = 0; i < inputTextureHandles.length \n\t\t\t\t&& inputTextureHandles[i] != OpenGlUtils.NO_TEXTURE; i++){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3) );\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, inputTextureHandles[i]);\n\t\t\tGLES20.glUniform1i(inputTextureUniformLocations[i], (i+3));\n\t\t}\n\t}\n\t\n\tpublic void onInit(){\n\t\tsuper.onInit();\n\t\tfor(int i = 0; i < inputTextureUniformLocations.length; i++)\n\t\t\tinputTextureUniformLocations[i] = GLES20.glGetUniformLocation(getProgram(), \"inputImageTexture\"+(2+i));\n\t\tmGLStrengthLocation = GLES20.glGetUniformLocation(mGLProgId,\n\t\t\t\t\"strength\");\n\t}\n\t\n\tpublic void onInitialized(){\n\t\tsuper.onInitialized();\n\t\tsetFloat(mGLStrengthLocation, 1.0f);\n\t    runOnDraw(new Runnable(){\n\t\t    public void run(){\n\t\t    \tinputTextureHandles[0] = OpenGlUtils.loadTexture(MagicParams.context, \"filter/walden_map.png\");\n\t\t\t\tinputTextureHandles[1] = OpenGlUtils.loadTexture(MagicParams.context, \"filter/vignette_map.png\");\n\t\t    }\n\t    });\n\t}\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/core/filter/advanced/MagicWarmFilter.java",
    "content": "package com.zero.magicshow.core.filter.advanced;\n\nimport android.opengl.GLES20;\n\nimport com.zero.magicshow.R;\nimport com.zero.magicshow.core.filter.base.gpuimage.GPUImageFilter;\nimport com.zero.magicshow.common.utils.MagicParams;\nimport com.zero.magicshow.common.utils.OpenGlUtils;\n\nimport java.nio.ByteBuffer;\n\npublic class MagicWarmFilter extends GPUImageFilter{\n\tprivate int[] mToneCurveTexture = {-1};\n\tprivate int mToneCurveTextureUniformLocation;\n\tprivate int mMaskGrey1TextureId = -1;\n\tprivate int mMaskGrey1UniformLocation;\n\tprivate int mMaskGrey2TextureId = -1;\n\tprivate int mMaskGrey2UniformLocation;\n\t\n\tpublic MagicWarmFilter(){\n\t\tsuper(NO_FILTER_VERTEX_SHADER, OpenGlUtils.readShaderFromRawResource(R.raw.warm));\n\t}\n\t\n\tpublic void onDestroy(){\n\t\tsuper.onDestroy();\n\t    GLES20.glDeleteTextures(3, new int[]{mToneCurveTexture[0], mMaskGrey1TextureId, mMaskGrey2TextureId}, 0);\n\t    mToneCurveTexture[0] = -1;\n\t    mMaskGrey1TextureId = -1;\n\t    mMaskGrey2TextureId = -1;\n\t}\n\t  \n\tprotected void onDrawArraysAfter(){\n\t\tif (mToneCurveTexture[0] != -1){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE3);\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0);\n\t    }\n\t\tif (mMaskGrey1TextureId != -1){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE4);\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0);\n\t    }\n\t\tif (mMaskGrey2TextureId != -1){\n\t    \tGLES20.glActiveTexture(GLES20.GL_TEXTURE5);\n\t    \tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);\n\t    \tGLES20.glActiveTexture(GLES20.GL_TEXTURE0);\n\t    }\n\t}\n\t  \n\tprotected void onDrawArraysPre(){\n\t\tif (mToneCurveTexture[0] != -1){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE3);\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mToneCurveTexture[0]);\n\t\t\tGLES20.glUniform1i(mToneCurveTextureUniformLocation, 3);\n\t    }\n\t\tif (mMaskGrey1TextureId != -1){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE4);\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mMaskGrey1TextureId);\n\t\t\tGLES20.glUniform1i(mMaskGrey1UniformLocation, 4);\n\t    }\n\t\tif (mMaskGrey2TextureId != -1){\n\t    \tGLES20.glActiveTexture(GLES20.GL_TEXTURE5);\n\t    \tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mMaskGrey2TextureId);\n\t     \tGLES20.glUniform1i(mMaskGrey2UniformLocation, 5);\n\t    }\n\t}\n\t  \n\tpublic void onInit(){\n\t\tsuper.onInit();\n\t    mToneCurveTextureUniformLocation = GLES20.glGetUniformLocation(mGLProgId, \"curve\");\n        mMaskGrey1UniformLocation = GLES20.glGetUniformLocation(getProgram(), \"layerImage\");\n        mMaskGrey2UniformLocation = GLES20.glGetUniformLocation(getProgram(), \"greyFrame\");\n\t}\n\t  \n\tpublic void onInitialized(){\n\t\tsuper.onInitialized();\n\t    runOnDraw(new Runnable(){\n\t\t    public void run(){\n\t\t    \tGLES20.glGenTextures(1, mToneCurveTexture, 0);\n\t\t\t    GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mToneCurveTexture[0]);\n\t\t\t    GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t\t                GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);\n\t\t        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t\t                GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);\n\t\t        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t\t                GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);\n\t\t        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t\t                GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);\t\t\t\t\n\t\t        byte[] arrayOfByte = new byte[2048];\n\t\t        int[] arrayOfInt1 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 6, 9, 12, 14, 17, 20, 23, 25, 28, 31, 33, 35, 38, 40, 42, 44, 46, 48, 50, 52, 53, 55, 57, 58, 60, 61, 63, 64, 65, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 80, 81, 82, 83, 83, 84, 85, 85, 86, 87, 87, 88, 88, 89, 90, 90, 91, 91, 92, 93, 93, 94, 94, 95, 96, 96, 97, 98, 99, 99, 100, 101, 102, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 114, 115, 116, 117, 119, 120, 121, 123, 124, 126, 127, 128, 130, 131, 133, 135, 136, 138, 139, 141, 143, 144, 146, 148, 149, 151, 153, 154, 156, 158, 159, 161, 163, 165, 166, 168, 170, 172, 173, 175, 177, 179, 180, 182, 184, 185, 187, 189, 190, 192, 194, 195, 197, 199, 200, 202, 203, 205, 207, 208, 210, 211, 213, 214, 215, 217, 218, 219, 221, 222, 223, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 238, 239, 240, 241, 241, 242, 243, 243, 244, 244, 245, 245, 246, 246, 247, 247, 248, 248, 249, 249, 249, 250, 250, 250, 251, 251, 251, 251, 252, 252, 252, 252, 253, 253, 253, 253, 253, 253, 254, 254, 254, 254, 254, 254, 254, 254, 255, 255, 255, 255, 255, 255 };\n\t\t        int[] arrayOfInt2 = { 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 87, 88, 89, 90, 91, 92, 93, 94, 95, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 235, 236, 237, 238, 239, 240, 241, 242 };\n\t\t        int[] arrayOfInt3 = { 9, 10, 11, 11, 12, 13, 14, 15, 16, 16, 17, 18, 19, 20, 21, 21, 22, 23, 24, 25, 26, 26, 27, 28, 29, 30, 31, 31, 32, 33, 34, 35, 36, 36, 37, 38, 39, 40, 40, 41, 42, 43, 44, 45, 45, 46, 47, 48, 49, 50, 50, 51, 52, 53, 54, 55, 55, 56, 57, 58, 59, 60, 60, 61, 62, 63, 64, 65, 66, 66, 67, 68, 69, 70, 71, 71, 72, 73, 74, 75, 76, 76, 77, 78, 79, 80, 81, 81, 82, 83, 84, 85, 86, 87, 87, 88, 89, 90, 91, 92, 93, 93, 94, 95, 96, 97, 98, 98, 99, 100, 101, 102, 103, 104, 104, 105, 106, 107, 108, 109, 110, 110, 111, 112, 113, 114, 115, 116, 116, 117, 118, 119, 120, 121, 122, 123, 123, 124, 125, 126, 127, 128, 129, 130, 130, 131, 132, 133, 134, 135, 136, 137, 137, 138, 139, 140, 141, 142, 143, 144, 144, 145, 146, 147, 148, 149, 150, 151, 152, 152, 153, 154, 155, 156, 157, 158, 159, 160, 160, 161, 162, 163, 164, 165, 166, 167, 168, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 225, 226, 227, 228, 229, 230 };\n\t\t        int[] arrayOfInt4 = { 0, 0, 1, 1, 2, 2, 3, 3, 4, 5, 5, 6, 6, 7, 7, 8, 9, 9, 10, 11, 12, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 28, 29, 30, 31, 33, 34, 35, 37, 38, 40, 41, 42, 44, 45, 47, 48, 50, 51, 53, 54, 56, 58, 59, 61, 62, 64, 65, 67, 69, 70, 72, 73, 75, 77, 78, 80, 82, 83, 85, 86, 88, 90, 91, 93, 94, 96, 98, 99, 101, 102, 104, 105, 107, 108, 110, 111, 113, 114, 116, 117, 119, 120, 122, 123, 124, 126, 127, 129, 130, 131, 133, 134, 136, 137, 138, 140, 141, 142, 144, 145, 146, 147, 149, 150, 151, 153, 154, 155, 156, 157, 159, 160, 161, 162, 163, 165, 166, 167, 168, 169, 170, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 203, 204, 205, 206, 207, 208, 208, 209, 210, 211, 212, 212, 213, 214, 215, 216, 216, 217, 218, 218, 219, 220, 221, 221, 222, 223, 223, 224, 225, 225, 226, 227, 227, 228, 228, 229, 230, 230, 231, 231, 232, 233, 233, 234, 234, 235, 235, 236, 236, 237, 238, 238, 239, 239, 240, 240, 241, 241, 242, 242, 243, 243, 244, 244, 245, 245, 246, 246, 247, 247, 248, 248, 249, 249, 249, 250, 250, 251, 251, 252, 252, 253, 253, 254, 254, 255, 255 };\n\t\t        for (int i = 0; i < 256; i++){\n\t\t          arrayOfByte[(i * 4)] = ((byte)arrayOfInt1[i]);\n\t\t          arrayOfByte[(1 + i * 4)] = ((byte)arrayOfInt2[i]);\n\t\t          arrayOfByte[(2 + i * 4)] = ((byte)arrayOfInt3[i]);\n\t\t          arrayOfByte[(3 + i * 4)] = ((byte)arrayOfInt4[i]);\n\t\t        }\n\t\t        int[] arrayOfInt5 = { 0, 1, 1, 2, 3, 4, 4, 5, 6, 6, 7, 8, 8, 9, 10, 11, 11, 11, 12, 13, 13, 14, 15, 15, 16, 17, 18, 18, 19, 20, 21, 21, 22, 23, 24, 24, 25, 26, 27, 28, 28, 28, 29, 30, 31, 31, 32, 33, 34, 35, 36, 36, 37, 38, 39, 39, 40, 41, 41, 42, 43, 44, 45, 46, 47, 47, 48, 49, 50, 51, 52, 53, 54, 55, 55, 56, 57, 58, 59, 60, 61, 62, 63, 63, 64, 65, 66, 68, 69, 70, 71, 71, 72, 73, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 86, 87, 88, 89, 90, 92, 93, 94, 95, 95, 97, 98, 99, 100, 102, 103, 104, 105, 106, 108, 109, 110, 111, 112, 114, 115, 116, 117, 118, 119, 122, 123, 124, 125, 126, 127, 129, 130, 131, 132, 133, 134, 135, 137, 138, 139, 141, 142, 143, 144, 145, 146, 148, 149, 150, 151, 152, 154, 155, 156, 157, 158, 159, 161, 162, 164, 165, 166, 167, 168, 169, 170, 171, 173, 174, 175, 176, 177, 178, 179, 180, 183, 184, 185, 186, 187, 188, 190, 191, 192, 193, 194, 195, 196, 198, 199, 200, 201, 202, 203, 205, 206, 207, 208, 209, 210, 212, 213, 214, 215, 216, 217, 219, 220, 221, 222, 223, 224, 226, 227, 228, 229, 230, 231, 233, 234, 235, 236, 237, 239, 240, 241, 242, 243, 243, 244, 246, 247, 248, 249, 250, 251, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255 };\n\t\t        int[] arrayOfInt6 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 11, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 28, 29, 30, 31, 32, 33, 34, 35, 37, 38, 39, 39, 40, 41, 42, 43, 44, 45, 46, 47, 47, 48, 49, 50, 51, 52, 53, 54, 55, 55, 56, 57, 58, 60, 61, 62, 63, 63, 64, 65, 66, 67, 68, 69, 70, 71, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 80, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 133, 134, 135, 136, 137, 138, 139, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 154, 155, 156, 157, 158, 159, 161, 162, 164, 165, 166, 167, 168, 169, 170, 171, 173, 174, 175, 176, 177, 178, 179, 180, 182, 183, 184, 185, 186, 187, 190, 191, 192, 193, 194, 195, 196, 198, 199, 200, 201, 202, 203, 205, 206, 207, 208, 209, 210, 212, 213, 214, 215, 216, 217, 220, 221, 222, 223, 224, 226, 227, 228, 229, 230, 231, 233, 234, 235, 236, 237, 239, 240, 241, 242, 243, 244, 246, 247, 249, 250, 251, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255 };\n\t\t        int[] arrayOfInt7 = { 45, 45, 46, 46, 47, 47, 47, 47, 48, 48, 49, 49, 50, 50, 50, 51, 51, 52, 52, 53, 53, 54, 54, 55, 55, 55, 55, 56, 56, 57, 57, 58, 58, 59, 59, 60, 60, 61, 61, 62, 62, 63, 63, 63, 63, 64, 64, 65, 65, 66, 66, 67, 67, 68, 69, 69, 70, 70, 71, 71, 71, 72, 72, 73, 73, 74, 75, 75, 76, 76, 77, 78, 78, 79, 79, 80, 80, 80, 81, 82, 82, 83, 84, 84, 85, 86, 87, 87, 88, 89, 89, 90, 91, 92, 92, 93, 94, 95, 95, 95, 96, 97, 98, 98, 99, 100, 101, 102, 103, 103, 104, 105, 106, 107, 108, 109, 110, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 135, 136, 137, 138, 139, 141, 142, 143, 144, 146, 147, 148, 149, 150, 151, 152, 154, 156, 157, 158, 159, 160, 161, 162, 165, 166, 167, 168, 169, 170, 171, 173, 175, 176, 177, 178, 179, 180, 182, 183, 184, 186, 187, 188, 190, 191, 192, 193, 194, 195, 196, 198, 199, 200, 201, 202, 203, 205, 206, 207, 208, 209, 210, 212, 213, 214, 215, 216, 217, 217, 219, 220, 221, 222, 223, 224, 226, 227, 227, 228, 229, 230, 231, 233, 234, 235, 235, 236, 237, 239, 240, 241, 241, 242, 243, 244, 246, 246, 247, 248, 249, 250, 251, 251, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 };\n\t\t        int[] arrayOfInt8 = { 0, 0, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 8, 8, 8, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 20, 20, 20, 21, 21, 21, 22, 22, 23, 23, 23, 24, 24, 24, 25, 25, 25, 25, 26, 26, 27, 27, 28, 28, 28, 28, 29, 29, 30, 29, 31, 31, 31, 31, 32, 32, 33, 33, 34, 34, 34, 34, 35, 35, 36, 36, 37, 37, 37, 38, 38, 39, 39, 39, 40, 40, 40, 41, 42, 42, 43, 43, 44, 44, 45, 45, 45, 46, 47, 47, 48, 48, 49, 50, 51, 51, 52, 52, 53, 53, 54, 55, 55, 56, 57, 57, 58, 59, 60, 60, 61, 62, 63, 63, 64, 65, 66, 67, 68, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 88, 89, 90, 91, 93, 94, 95, 96, 97, 98, 100, 101, 103, 104, 105, 107, 108, 110, 111, 113, 115, 116, 118, 119, 120, 122, 123, 125, 127, 128, 130, 132, 134, 135, 137, 139, 141, 143, 144, 146, 148, 150, 152, 154, 156, 158, 160, 163, 165, 167, 169, 171, 173, 175, 178, 180, 182, 185, 187, 189, 192, 194, 197, 199, 201, 204, 206, 209, 211, 214, 216, 219, 221, 224, 226, 229, 232, 234, 236, 239, 241, 245, 247, 250, 252, 255 };\n\t\t        for (int j = 0; j < 256; j++){\n\t\t          arrayOfByte[(1024 + j * 4)] = ((byte)arrayOfInt5[j]);\n\t\t          arrayOfByte[(1 + (1024 + j * 4))] = ((byte)arrayOfInt6[j]);\n\t\t          arrayOfByte[(2 + (1024 + j * 4))] = ((byte)arrayOfInt7[j]);\n\t\t          arrayOfByte[(3 + (1024 + j * 4))] = ((byte)arrayOfInt8[j]);\n\t\t        }\n\t\t        GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, 256, 2, 0, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, ByteBuffer.wrap(arrayOfByte));\n\t\t        mMaskGrey1TextureId = OpenGlUtils.loadTexture(MagicParams.context, \"filter/warm_layer1.jpg\");\n\t\t        mMaskGrey2TextureId = OpenGlUtils.loadTexture(MagicParams.context, \"filter/bluevintage_mask1.jpg\");\n\t\t    }\n\t    });\n\t}\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/core/filter/advanced/MagicWhiteCatFilter.java",
    "content": "package com.zero.magicshow.core.filter.advanced;\n\nimport android.opengl.GLES20;\n\nimport com.zero.magicshow.R;\nimport com.zero.magicshow.core.filter.base.gpuimage.GPUImageFilter;\nimport com.zero.magicshow.common.utils.OpenGlUtils;\n\nimport java.nio.ByteBuffer;\n\npublic class MagicWhiteCatFilter extends GPUImageFilter{\n\n\tprivate int[] mToneCurveTexture = {-1};\n\tprivate int mToneCurveTextureUniformLocation;\n\t  \n\tpublic MagicWhiteCatFilter(){\n\t\tsuper(NO_FILTER_VERTEX_SHADER, OpenGlUtils.readShaderFromRawResource(R.raw.whitecat));\n\t}\n\t\n\tpublic void onDestroy(){\n\t\tsuper.onDestroy();\n\t    GLES20.glDeleteTextures(1, mToneCurveTexture, 0);\n\t    mToneCurveTexture[0] = -1;\n\t}\n\t  \n\tprotected void onDrawArraysAfter(){\n\t\tif (mToneCurveTexture[0] != -1){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE3);\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0);\n\t    }\n\t}\n\t  \n\tprotected void onDrawArraysPre(){\n\t\tif (mToneCurveTexture[0] != -1){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE3);\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mToneCurveTexture[0]);\n\t\t\tGLES20.glUniform1i(mToneCurveTextureUniformLocation, 3);\n\t    }\n\t}\n\t  \n\tpublic void onInit(){\n\t\tsuper.onInit();\n\t    mToneCurveTextureUniformLocation = GLES20.glGetUniformLocation(mGLProgId, \"curve\");\n\t}\n\t  \n\tpublic void onInitialized(){\n\t\tsuper.onInitialized();\n\t    runOnDraw(new Runnable(){\n\t\t    public void run(){\n\t\t    \tGLES20.glGenTextures(1, mToneCurveTexture, 0);\n\t\t\t    GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mToneCurveTexture[0]);\n\t\t\t    GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t\t                GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);\n\t\t        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t\t                GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);\n\t\t        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t\t                GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);\n\t\t        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n\t\t                GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);\n\t\t        byte[] arrayOfByte = new byte[2048];\n\t\t        int[] arrayOfInt1 = { 0, 0, 0, 0, 0, 0, 0, 1, 2, 4, 5, 6, 7, 8, 10, 11, 12, 13, 14, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 28, 29, 30, 31, 32, 33, 35, 36, 37, 38, 39, 41, 42, 43, 44, 45, 46, 48, 49, 50, 51, 52, 54, 55, 56, 57, 58, 59, 61, 62, 63, 64, 65, 66, 67, 69, 70, 71, 72, 73, 74, 75, 77, 78, 79, 80, 81, 82, 83, 85, 86, 87, 88, 89, 90, 91, 92, 93, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 249, 250, 251, 252, 253, 254, 255, 255, 255, 255, 255, 255 };\n\t\t        int[] arrayOfInt2 = { 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 4, 4, 5, 6, 7, 8, 10, 11, 12, 12, 13, 14, 16, 17, 18, 19, 19, 20, 22, 23, 24, 25, 26, 26, 28, 29, 30, 31, 32, 33, 35, 35, 36, 37, 38, 39, 41, 42, 42, 43, 44, 45, 46, 48, 49, 50, 50, 51, 52, 54, 55, 56, 57, 58, 58, 59, 61, 62, 63, 64, 65, 66, 66, 67, 69, 70, 71, 72, 73, 74, 75, 75, 77, 78, 79, 80, 81, 82, 83, 85, 85, 86, 87, 88, 89, 90, 91, 92, 93, 93, 95, 96, 97, 98, 99, 100, 101, 102, 103, 103, 104, 105, 107, 108, 109, 110, 111, 112, 113, 114, 114, 115, 116, 117, 118, 119, 120, 121, 123, 124, 125, 126, 127, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 182, 183, 184, 185, 186, 187, 188, 189, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 217, 218, 219, 220, 221, 222, 223, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 236, 237, 238, 239, 240, 240 };\n\t\t        for (int i = 0; i < 256; i++){\n\t\t        \tarrayOfByte[(i * 4)] = ((byte)arrayOfInt1[i]);\n\t\t        \tarrayOfByte[(1 + i * 4)] = ((byte)arrayOfInt1[i]);\n\t\t        \tarrayOfByte[(2 + i * 4)] = ((byte)arrayOfInt2[i]);\n\t\t        \tarrayOfByte[(3 + i * 4)] = -1;\n\t\t        }\n\t\t        int[] arrayOfInt3 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 6, 9, 14, 17, 19, 22, 25, 27, 30, 34, 36, 39, 41, 43, 45, 49, 51, 52, 54, 55, 57, 58, 61, 63, 64, 65, 67, 68, 69, 72, 73, 75, 76, 77, 78, 81, 82, 83, 84, 86, 87, 88, 90, 91, 93, 94, 95, 96, 97, 99, 100, 101, 102, 103, 105, 106, 108, 109, 110, 111, 112, 113, 115, 116, 117, 118, 119, 120, 121, 123, 124, 125, 126, 126, 127, 128, 130, 131, 132, 133, 134, 135, 136, 138, 138, 139, 140, 141, 142, 144, 145, 146, 146, 147, 148, 149, 151, 152, 153, 153, 154, 155, 156, 158, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 168, 170, 171, 172, 172, 173, 174, 175, 176, 177, 178, 179, 180, 180, 181, 183, 183, 184, 185, 186, 186, 188, 189, 190, 190, 191, 192, 193, 194, 195, 196, 196, 197, 198, 199, 200, 201, 201, 202, 203, 204, 204, 206, 207, 207, 208, 209, 209, 211, 212, 212, 213, 214, 214, 215, 217, 217, 218, 219, 219, 220, 221, 222, 223, 224, 224, 225, 226, 227, 228, 228, 229, 230, 230, 231, 233, 233, 234, 235, 235, 236, 237, 238, 239, 239, 240, 241, 241, 242, 243, 244, 245, 245, 246, 247, 248, 249, 249, 250, 250, 251, 252, 253, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 };\n\t\t        int[] arrayOfInt4 = { 0, 2, 4, 6, 8, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 32, 34, 36, 38, 40, 42, 44, 46, 47, 49, 51, 53, 54, 56, 58, 60, 61, 63, 65, 66, 68, 70, 71, 73, 74, 76, 77, 79, 80, 82, 83, 85, 86, 88, 89, 91, 92, 93, 95, 96, 98, 99, 100, 101, 103, 104, 105, 107, 108, 109, 110, 111, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 124, 125, 126, 127, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 198, 199, 200, 201, 202, 203, 204, 205, 206, 206, 207, 208, 209, 210, 211, 212, 212, 213, 214, 215, 216, 216, 217, 218, 219, 219, 220, 221, 222, 222, 223, 224, 224, 225, 226, 226, 227, 228, 228, 229, 230, 230, 231, 232, 232, 233, 233, 234, 235, 235, 236, 236, 237, 237, 238, 238, 239, 239, 240, 240, 241, 241, 242, 242, 243, 243, 244, 244, 245, 245, 245, 246, 246, 247, 247, 247, 248, 248, 248, 249, 249, 249, 250, 250, 250, 251, 251, 251, 252, 252, 252, 252, 253, 253, 253, 253, 254, 254, 254, 254, 254, 255, 255, 255 };\n\t\t        int[] arrayOfInt5 = { 0, 0, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 8, 8, 8, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 20, 20, 20, 21, 21, 21, 22, 22, 23, 23, 23, 24, 24, 24, 25, 25, 25, 25, 26, 26, 27, 27, 28, 28, 28, 28, 29, 29, 30, 29, 31, 31, 31, 31, 32, 32, 33, 33, 34, 34, 34, 34, 35, 35, 36, 36, 37, 37, 37, 38, 38, 39, 39, 39, 40, 40, 40, 41, 42, 42, 43, 43, 44, 44, 45, 45, 45, 46, 47, 47, 48, 48, 49, 50, 51, 51, 52, 52, 53, 53, 54, 55, 55, 56, 57, 57, 58, 59, 60, 60, 61, 62, 63, 63, 64, 65, 66, 67, 68, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 88, 89, 90, 91, 93, 94, 95, 96, 97, 98, 100, 101, 103, 104, 105, 107, 108, 110, 111, 113, 115, 116, 118, 119, 120, 122, 123, 125, 127, 128, 130, 132, 134, 135, 137, 139, 141, 143, 144, 146, 148, 150, 152, 154, 156, 158, 160, 163, 165, 167, 169, 171, 173, 175, 178, 180, 182, 185, 187, 189, 192, 194, 197, 199, 201, 204, 206, 209, 211, 214, 216, 219, 221, 224, 226, 229, 232, 234, 236, 239, 241, 245, 247, 250, 252, 255 };\n\t\t        for (int j = 0; j < 256; j++){\n\t\t        \tarrayOfByte[(1024 + j * 4)] = ((byte)arrayOfInt4[j]);\n\t\t        \tarrayOfByte[(1 + (1024 + j * 4))] = ((byte)arrayOfInt3[j]);\n\t\t        \tarrayOfByte[(2 + (1024 + j * 4))] = ((byte)arrayOfInt5[j]);\n\t\t        \tarrayOfByte[(3 + (1024 + j * 4))] = -1;\n\t\t        }\n\t\t        GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, 256, 2, 0, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, ByteBuffer.wrap(arrayOfByte));\n\t\t    }\n\t    });\n\t}\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/core/filter/advanced/MagicXproIIFilter.java",
    "content": "package com.zero.magicshow.core.filter.advanced;\n\nimport android.opengl.GLES20;\n\nimport com.zero.magicshow.R;\nimport com.zero.magicshow.core.filter.base.gpuimage.GPUImageFilter;\nimport com.zero.magicshow.common.utils.MagicParams;\nimport com.zero.magicshow.common.utils.OpenGlUtils;\n\npublic class MagicXproIIFilter extends GPUImageFilter{\n\tprivate int[] inputTextureHandles = {-1,-1};\n\tprivate int[] inputTextureUniformLocations = {-1,-1};\n\tprivate int mGLStrengthLocation;\n\n\tpublic MagicXproIIFilter(){\n\t\tsuper(NO_FILTER_VERTEX_SHADER, OpenGlUtils.readShaderFromRawResource(R.raw.xproii_filter_shader));\n\t}\n\n\tpublic void onDestroy() {\n\t\tsuper.onDestroy();\n\t\tGLES20.glDeleteTextures(inputTextureHandles.length, inputTextureHandles, 0);\n\t\tfor(int i = 0; i < inputTextureHandles.length; i++)\n\t\t\tinputTextureHandles[i] = -1;\n\t}\n\n\tprotected void onDrawArraysAfter(){\n\t\tfor(int i = 0; i < inputTextureHandles.length\n\t\t\t\t&& inputTextureHandles[i] != OpenGlUtils.NO_TEXTURE; i++){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3));\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0);\n\t\t}\n\t}\n\n\tprotected void onDrawArraysPre(){\n\t\tfor(int i = 0; i < inputTextureHandles.length\n\t\t\t\t&& inputTextureHandles[i] != OpenGlUtils.NO_TEXTURE; i++){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0 + (i+3) );\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, inputTextureHandles[i]);\n\t\t\tGLES20.glUniform1i(inputTextureUniformLocations[i], (i + 3));\n\t\t}\n\t}\n\n\tpublic void onInit(){\n\t\tsuper.onInit();\n\t\tfor(int i = 0; i < inputTextureUniformLocations.length; i++)\n\t\t\tinputTextureUniformLocations[i] = GLES20.glGetUniformLocation(getProgram(), \"inputImageTexture\"+(2+i));\n\t\t\tmGLStrengthLocation = GLES20.glGetUniformLocation(mGLProgId,\n\t\t\t\t\"strength\");\n\t}\n\n\tpublic void onInitialized(){\n\t\tsuper.onInitialized();\n\t\tsetFloat(mGLStrengthLocation, 1.0f);\n\t\trunOnDraw(new Runnable(){\n\t\t\tpublic void run(){\n\t\t\t\tinputTextureHandles[0] = OpenGlUtils.loadTexture(MagicParams.context, \"filter/xpromap.png\");\n\t\t\t\tinputTextureHandles[1] = OpenGlUtils.loadTexture(MagicParams.context, \"filter/vignettemap_new.png\");\n\t\t\t}\n\t\t});\n\t}\n\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/core/filter/base/MagicBaseGroupFilter.java",
    "content": "package com.zero.magicshow.core.filter.base;\n\n\nimport android.graphics.Bitmap;\nimport android.opengl.GLES20;\n\nimport com.zero.magicshow.common.utils.OpenGlUtils;\nimport com.zero.magicshow.core.filter.base.gpuimage.GPUImageFilter;\n\nimport java.nio.FloatBuffer;\nimport java.nio.IntBuffer;\nimport java.util.List;\n\n\npublic class MagicBaseGroupFilter extends GPUImageFilter{\n\tprotected static int[] frameBuffers = null;\n    protected static int[] frameBufferTextures = null;\n    private int frameWidth = -1;\n    private int frameHeight = -1;\n    protected List<GPUImageFilter> filters;\n    \n    public MagicBaseGroupFilter(List<GPUImageFilter> filters){\n    \tthis.filters = filters;\n    }\n    \n\t@Override\n    public void onDestroy() {\n        for (GPUImageFilter filter : filters) {\n            filter.destroy();\n        }\n        destroyFramebuffers();\n    }\n    \n    @Override\n    public void init() {\n        for (GPUImageFilter filter : filters) {\n            filter.init();\n        }\n    }\n    \n    @Override\n    public void onInputSizeChanged(final int width, final int height) {\n        super.onInputSizeChanged(width, height);\n        int size = filters.size();\n        for (int i = 0; i < size; i++) {\n            filters.get(i).onInputSizeChanged(width, height);\n        }\n        if(frameBuffers != null && (frameWidth != width || frameHeight != height || frameBuffers.length != size-1)){\n\t\t\tdestroyFramebuffers();\n\t\t\tframeWidth = width;\n\t\t\tframeHeight = height;\n\t\t}\n        if (frameBuffers == null) {\n        \tframeBuffers = new int[size];\n            frameBufferTextures = new int[size];\n            for (int i = 0; i < size; i++) {\n                GLES20.glGenFramebuffers(1, frameBuffers, i);\n\n                GLES20.glGenTextures(1, frameBufferTextures, i);\n                GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, frameBufferTextures[i]);\n                GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, width, height, 0,\n                        GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, null);\n                //设置放大过滤为使用纹理中坐标最接近的若干个颜色，通过加权平均算法得到需要绘制的像素颜色\n                GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n                        GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);\n                //设置缩小过滤为使用纹理中坐标最接近的一个像素的颜色作为需要绘制的像素颜色\n                GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n                        GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);\n                //设置环绕方向S，截取纹理坐标到[1/2n,1-1/2n]。将导致永远不会与border融合\n                GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n                        GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);\n                //设置环绕方向T，截取纹理坐标到[1/2n,1-1/2n]。将导致永远不会与border融合\n                GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n                        GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);\n\n                GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, frameBuffers[i]);\n                GLES20.glFramebufferTexture2D(GLES20.GL_FRAMEBUFFER, GLES20.GL_COLOR_ATTACHMENT0,\n                        GLES20.GL_TEXTURE_2D, frameBufferTextures[i], 0);\n\n                GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);\n                GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, 0);\n            }\n        }\n    }\n\n//    public void onDisplaySizeChanged(final int width, final int height) {\n//        super.onDisplaySizeChanged(width, height);\n//        int size = filters.size();\n//        for (int i = 0; i < size; i++) {\n//            filters.get(i).onDisplaySizeChanged(width, height);\n//        }\n//    }\n    @Override\n    public int onDrawFrame(final int textureId, final FloatBuffer cubeBuffer,\n    \t\tfinal FloatBuffer textureBuffer) {\n    \tif (frameBuffers == null || frameBufferTextures == null) {\n            return OpenGlUtils.NOT_INIT;\n        }\n    \tint size = filters.size();\n        int previousTexture = textureId;\n        for (int i = 0; i < size; i++) {\n        \tGPUImageFilter filter = filters.get(i);\n            boolean isNotLast = i < size - 1;\n            if (isNotLast) {\n            \tGLES20.glViewport(0, 0, mIntputWidth, mIntputHeight);\n                GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, frameBuffers[i]);\n                GLES20.glClearColor(0, 0, 0, 0);\n                filter.onDrawFrame(previousTexture, mGLCubeBuffer, mGLTextureBuffer);\n                GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, 0);\n                previousTexture = frameBufferTextures[i];\n            }else{\n            \tGLES20.glViewport(0, 0, mOutputWidth, mOutputHeight);\n            \tfilter.onDrawFrame(previousTexture, cubeBuffer, textureBuffer);\n            }\n        }\n    \treturn OpenGlUtils.ON_DRAWN;\n    }\n    \n    @Override\n    public int onDrawFrame(final int textureId) {\n//        return onDrawFrame(textureId,mGLCubeBuffer,mGLTextureBuffer);\n    \tif (frameBuffers == null || frameBufferTextures == null) {\n            return OpenGlUtils.NOT_INIT;\n        }\n        int size = filters.size();\n        GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);\n//        Log.e(\"HongLi\",\"filters size:\" + size + \"mOutputWidth:\" + mOutputWidth + \";mOutputHeight:\" + mOutputHeight + \";mIntputWidth:\" + mIntputWidth + \";mIntputHeight:\" + mIntputHeight);\n        int previousTexture = textureId;\n        GLES20.glViewport(0,0,mOutputWidth,mOutputHeight);\n        for (int i = 0; i < size; i++) {\n        \tGPUImageFilter filter = filters.get(i);\n            boolean isNotLast = i < size - 1;\n            if (isNotLast) {\n                //绑定FrameBuffer\n                GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, frameBuffers[i]);\n                //为FrameBuffer挂载Texture[1]来存储颜色\n                GLES20.glFramebufferTexture2D(GLES20.GL_FRAMEBUFFER, GLES20.GL_COLOR_ATTACHMENT0,\n                    GLES20.GL_TEXTURE_2D, frameBufferTextures[i], 0);\n                //绑定FrameBuffer后的绘制会绘制到frameBufferTextures[i]上了\n                filter.onDrawFrame(previousTexture, mGLCubeBuffer, mGLTextureBuffer);\n                //解除绑定位置很重要，如果下面没有纹理绘制了不能解除，否则获取纹理会出问题\n                GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, 0);\n                previousTexture = frameBufferTextures[i];\n            }else{\n                GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, frameBuffers[i]);\n                //为FrameBuffer挂载Texture[1]来存储颜色\n                GLES20.glFramebufferTexture2D(GLES20.GL_FRAMEBUFFER, GLES20.GL_COLOR_ATTACHMENT0,\n                        GLES20.GL_TEXTURE_2D, frameBufferTextures[i], 0);\n            \tfilter.onDrawFrame(previousTexture, mGLCubeBuffer, mGLTextureBuffer);\n            }\n        }\n        //费时费力，每次都获取bitmap\n//        GLES20.glDeleteTextures(frameBufferTextures.length, frameBufferTextures, 0);\n//        GLES20.glDeleteFramebuffers(frameBuffers.length, frameBuffers, 0);\n//        int nextTextureId = textureId;\n//        IntBuffer ib = IntBuffer.allocate(mOutputWidth * mOutputHeight);\n//        Bitmap mBitmap = Bitmap.createBitmap(mOutputWidth, mOutputHeight, Bitmap.Config.ARGB_8888);\n//        for(GPUImageFilter imageFilter:filters){\n//            if(!imageFilter.hasChange()){\n//                continue;\n//            }\n//            imageFilter.onDrawFrame(nextTextureId,mGLCubeBuffer, mGLTextureBuffer);\n//            GLES20.glReadPixels(0, 0, mOutputWidth, mOutputHeight, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, ib);\n//            mBitmap.copyPixelsFromBuffer(IntBuffer.wrap(ib.array()));\n//            nextTextureId = OpenGlUtils.loadTexture(mBitmap, OpenGlUtils.NO_TEXTURE, false);\n//        }\n//        mBitmap.recycle();\n    \treturn OpenGlUtils.ON_DRAWN;\n    }\n\n    public void onDrawFrameNormal(final int textureId,int width,int height){\n        int nextTextureId = textureId;\n        IntBuffer ib = IntBuffer.allocate(width * height);\n        Bitmap mBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);\n        for(GPUImageFilter imageFilter:filters){\n            imageFilter.onDrawFrame(nextTextureId,mGLCubeBuffer, mGLTextureBuffer);\n            GLES20.glReadPixels(0, 0, width, height, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, ib);\n            mBitmap.copyPixelsFromBuffer(IntBuffer.wrap(ib.array()));\n            nextTextureId = OpenGlUtils.loadTexture(mBitmap, OpenGlUtils.NO_TEXTURE, false);\n        }\n        mBitmap.recycle();\n    }\n    \n    private void destroyFramebuffers() {\n        if (frameBufferTextures != null) {\n            GLES20.glDeleteTextures(frameBufferTextures.length, frameBufferTextures, 0);\n            frameBufferTextures = null;\n        }\n        if (frameBuffers != null) {\n            GLES20.glDeleteFramebuffers(frameBuffers.length, frameBuffers, 0);\n            frameBuffers = null;\n        }\n    }\n    \n    public int getSize(){\n    \treturn filters.size();\n    }\n\n    public GPUImageFilter getFristFilter(){\n        return filters.get(0);\n    }\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/core/filter/base/MagicCameraInputFilter.java",
    "content": "package com.zero.magicshow.core.filter.base;\n\nimport android.opengl.GLES11Ext;\nimport android.opengl.GLES20;\n\nimport com.zero.magicshow.R;\nimport com.zero.magicshow.common.utils.MagicParams;\nimport com.zero.magicshow.common.utils.OpenGlUtils;\nimport com.zero.magicshow.core.filter.base.gpuimage.GPUImageFilter;\n\nimport java.nio.FloatBuffer;\n\npublic class MagicCameraInputFilter extends GPUImageFilter{\n\n    private float[] mTextureTransformMatrix;\n    private int mTextureTransformMatrixLocation;\n    private int mSingleStepOffsetLocation;\n    private int mParamsLocation;\n\n    private int[] mFrameBuffers = null;\n    private int[] mFrameBufferTextures = null;\n    private int mFrameWidth = -1;\n    private int mFrameHeight = -1;\n\n    public MagicCameraInputFilter(){\n        super(OpenGlUtils.readShaderFromRawResource(R.raw.default_vertex) ,\n                OpenGlUtils.readShaderFromRawResource(R.raw.default_fragment));\n    }\n\n    protected void onInit() {\n        super.onInit();\n        mTextureTransformMatrixLocation = GLES20.glGetUniformLocation(mGLProgId, \"textureTransform\");\n        mSingleStepOffsetLocation = GLES20.glGetUniformLocation(getProgram(), \"singleStepOffset\");\n        mParamsLocation = GLES20.glGetUniformLocation(getProgram(), \"params\");\n        setBeautyLevel(MagicParams.beautyLevel);\n    }\n\n    public void setTextureTransformMatrix(float[] mtx){\n        mTextureTransformMatrix = mtx;\n    }\n\n    @Override\n    public int onDrawFrame(int textureId) {\n        GLES20.glUseProgram(mGLProgId);\n        runPendingOnDrawTasks();\n        if(!isInitialized()) {\n            return OpenGlUtils.NOT_INIT;\n        }\n        mGLCubeBuffer.position(0);\n        GLES20.glVertexAttribPointer(mGLAttribPosition, 2, GLES20.GL_FLOAT, false, 0, mGLCubeBuffer);\n        GLES20.glEnableVertexAttribArray(mGLAttribPosition);\n        mGLTextureBuffer.position(0);\n        GLES20.glVertexAttribPointer(mGLAttribTextureCoordinate, 2, GLES20.GL_FLOAT, false, 0, mGLTextureBuffer);\n        GLES20.glEnableVertexAttribArray(mGLAttribTextureCoordinate);\n        GLES20.glUniformMatrix4fv(mTextureTransformMatrixLocation, 1, false, mTextureTransformMatrix, 0);\n\n        if(textureId != OpenGlUtils.NO_TEXTURE){\n            GLES20.glActiveTexture(GLES20.GL_TEXTURE0);\n            GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, textureId);\n            GLES20.glUniform1i(mGLUniformTexture, 0);\n        }\n\n        GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4);\n        GLES20.glDisableVertexAttribArray(mGLAttribPosition);\n        GLES20.glDisableVertexAttribArray(mGLAttribTextureCoordinate);\n        GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, 0);\n        return OpenGlUtils.ON_DRAWN;\n    }\n\n    @Override\n    public int onDrawFrame(int textureId, FloatBuffer vertexBuffer, FloatBuffer textureBuffer) {\n        GLES20.glUseProgram(mGLProgId);\n        runPendingOnDrawTasks();\n        if(!isInitialized()) {\n            return OpenGlUtils.NOT_INIT;\n        }\n        vertexBuffer.position(0);\n        GLES20.glVertexAttribPointer(mGLAttribPosition, 2, GLES20.GL_FLOAT, false, 0, vertexBuffer);\n        GLES20.glEnableVertexAttribArray(mGLAttribPosition);\n        textureBuffer.position(0);\n        GLES20.glVertexAttribPointer(mGLAttribTextureCoordinate, 2, GLES20.GL_FLOAT, false, 0, textureBuffer);\n        GLES20.glEnableVertexAttribArray(mGLAttribTextureCoordinate);\n        GLES20.glUniformMatrix4fv(mTextureTransformMatrixLocation, 1, false, mTextureTransformMatrix, 0);\n\n        if(textureId != OpenGlUtils.NO_TEXTURE){\n            GLES20.glActiveTexture(GLES20.GL_TEXTURE0);\n            GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, textureId);\n            GLES20.glUniform1i(mGLUniformTexture, 0);\n        }\n        GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4);\n        GLES20.glDisableVertexAttribArray(mGLAttribPosition);\n        GLES20.glDisableVertexAttribArray(mGLAttribTextureCoordinate);\n        GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, 0);\n        return OpenGlUtils.ON_DRAWN;\n    }\n\n    public int onDrawToTexture(final int textureId) {\n        if(mFrameBuffers == null)\n            return OpenGlUtils.NO_TEXTURE;\n        runPendingOnDrawTasks();\n        GLES20.glViewport(0, 0, mFrameWidth, mFrameHeight);\n        GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, mFrameBuffers[0]);\n        GLES20.glUseProgram(mGLProgId);\n        if(!isInitialized()) {\n            return OpenGlUtils.NOT_INIT;\n        }\n        mGLCubeBuffer.position(0);\n        GLES20.glVertexAttribPointer(mGLAttribPosition, 2, GLES20.GL_FLOAT, false, 0, mGLCubeBuffer);\n        GLES20.glEnableVertexAttribArray(mGLAttribPosition);\n        mGLTextureBuffer.position(0);\n        GLES20.glVertexAttribPointer(mGLAttribTextureCoordinate, 2, GLES20.GL_FLOAT, false, 0, mGLTextureBuffer);\n        GLES20.glEnableVertexAttribArray(mGLAttribTextureCoordinate);\n        GLES20.glUniformMatrix4fv(mTextureTransformMatrixLocation, 1, false, mTextureTransformMatrix, 0);\n\n        if(textureId != OpenGlUtils.NO_TEXTURE){\n            GLES20.glActiveTexture(GLES20.GL_TEXTURE0);\n            GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, textureId);\n            GLES20.glUniform1i(mGLUniformTexture, 0);\n        }\n\n        GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4);\n        GLES20.glDisableVertexAttribArray(mGLAttribPosition);\n        GLES20.glDisableVertexAttribArray(mGLAttribTextureCoordinate);\n        GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, 0);\n        GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, 0);\n        GLES20.glViewport(0, 0, mOutputWidth, mOutputHeight);\n        return mFrameBufferTextures[0];\n    }\n\n    public void initCameraFrameBuffer(int width, int height) {\n        if(mFrameBuffers != null && (mFrameWidth != width || mFrameHeight != height))\n            destroyFramebuffers();\n        if (mFrameBuffers == null) {\n            mFrameWidth = width;\n            mFrameHeight = height;\n            mFrameBuffers = new int[1];\n            mFrameBufferTextures = new int[1];\n\n            GLES20.glGenFramebuffers(1, mFrameBuffers, 0);\n            GLES20.glGenTextures(1, mFrameBufferTextures, 0);\n            GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mFrameBufferTextures[0]);\n            GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, width, height, 0,\n                    GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, null);\n            GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n                    GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);\n            GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n                    GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);\n            GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n                    GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);\n            GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n                    GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);\n            GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, mFrameBuffers[0]);\n            GLES20.glFramebufferTexture2D(GLES20.GL_FRAMEBUFFER, GLES20.GL_COLOR_ATTACHMENT0,\n                    GLES20.GL_TEXTURE_2D, mFrameBufferTextures[0], 0);\n            GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);\n            GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, 0);\n        }\n    }\n\n    public void destroyFramebuffers() {\n        if (mFrameBufferTextures != null) {\n            GLES20.glDeleteTextures(1, mFrameBufferTextures, 0);\n            mFrameBufferTextures = null;\n        }\n        if (mFrameBuffers != null) {\n            GLES20.glDeleteFramebuffers(1, mFrameBuffers, 0);\n            mFrameBuffers = null;\n        }\n        mFrameWidth = -1;\n        mFrameHeight = -1;\n    }\n\n    private void setTexelSize(final float w, final float h) {\n        setFloatVec2(mSingleStepOffsetLocation, new float[] {2.0f / w, 2.0f / h});\n    }\n\n    @Override\n    public void onInputSizeChanged(final int width, final int height) {\n        super.onInputSizeChanged(width, height);\n        setTexelSize(width, height);\n    }\n\n    public void setBeautyLevel(int level){\n        switch (level) {\n            case 0:\n                setFloat(mParamsLocation, 0.0f);\n                break;\n            case 1:\n                setFloat(mParamsLocation, 1.0f);\n                break;\n            case 2:\n                setFloat(mParamsLocation, 0.8f);\n                break;\n            case 3:\n                setFloat(mParamsLocation,0.6f);\n                break;\n            case 4:\n                setFloat(mParamsLocation, 0.4f);\n                break;\n            case 5:\n                setFloat(mParamsLocation,0.33f);\n                break;\n            default:\n                break;\n        }\n    }\n\n    @Override\n    protected void onDestroy() {\n        super.onDestroy();\n        destroyFramebuffers();\n    }\n\n    public void onBeautyLevelChanged(){\n        setBeautyLevel(MagicParams.beautyLevel);\n    }\n\n}"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/core/filter/base/MagicLookupFilter.java",
    "content": "package com.zero.magicshow.core.filter.base;\n\nimport android.opengl.GLES20;\n\nimport com.zero.magicshow.core.filter.base.gpuimage.GPUImageFilter;\nimport com.zero.magicshow.common.utils.MagicParams;\nimport com.zero.magicshow.common.utils.OpenGlUtils;\n\npublic class MagicLookupFilter extends GPUImageFilter {\n\n    public static final String LOOKUP_FRAGMENT_SHADER = \"\"+\n    \t\t\"varying highp vec2 textureCoordinate;\\n\" +\n            \" \\n\" +\n            \" uniform sampler2D inputImageTexture;\\n\" +\n            \" uniform sampler2D inputImageTexture2; // lookup texture\\n\" +\n            \" \\n\" +\n            \" void main()\\n\" +\n            \" {\\n\" +\n            \"     lowp vec4 textureColor = texture2D(inputImageTexture, textureCoordinate);\\n\" +\n            \"     \\n\" +\n            \"     mediump float blueColor = textureColor.b * 63.0;\\n\" +\n            \"     \\n\" +\n            \"     mediump vec2 quad1;\\n\" +\n            \"     quad1.y = floor(floor(blueColor) / 8.0);\\n\" +\n            \"     quad1.x = floor(blueColor) - (quad1.y * 8.0);\\n\" +\n            \"     \\n\" +\n            \"     mediump vec2 quad2;\\n\" +\n            \"     quad2.y = floor(ceil(blueColor) / 8.0);\\n\" +\n            \"     quad2.x = ceil(blueColor) - (quad2.y * 8.0);\\n\" +\n            \"     \\n\" +\n            \"     highp vec2 texPos1;\\n\" +\n            \"     texPos1.x = (quad1.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.r);\\n\" +\n            \"     texPos1.y = (quad1.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.g);\\n\" +\n            \"     \\n\" +\n            \"     highp vec2 texPos2;\\n\" +\n            \"     texPos2.x = (quad2.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.r);\\n\" +\n            \"     texPos2.y = (quad2.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.g);\\n\" +\n            \"     \\n\" +\n            \"     lowp vec4 newColor1 = texture2D(inputImageTexture2, texPos1);\\n\" +\n            \"     lowp vec4 newColor2 = texture2D(inputImageTexture2, texPos2);\\n\" +\n            \"     \\n\" +\n            \"     lowp vec4 newColor = mix(newColor1, newColor2, fract(blueColor));\\n\" +\n            \"     gl_FragColor = vec4(newColor.rgb, textureColor.w);\\n\" +\n            \" }\";\n\n    protected String table;\n\n    public MagicLookupFilter(String table) {\n        super(NO_FILTER_VERTEX_SHADER,LOOKUP_FRAGMENT_SHADER);\n        this.table = table;\n    }\n    \n    public int mLookupTextureUniform;\n    public int mLookupSourceTexture = OpenGlUtils.NO_TEXTURE;\n    \n    protected void onInit(){\n\t\tsuper.onInit();\n\t\tmLookupTextureUniform = GLES20.glGetUniformLocation(getProgram(), \"inputImageTexture2\");\n    }\n    \n    protected void onInitialized(){\n\t\tsuper.onInitialized();\n    \trunOnDraw(new Runnable(){\n    \t\tpublic void run(){\n    \t\t\tmLookupSourceTexture = OpenGlUtils.loadTexture(MagicParams.context, table);\n    \t\t}\n    \t});\n    }\n    \n    protected void onDestroy(){\n\t\tsuper.onDestroy();\n\t    int[] texture = new int[]{mLookupSourceTexture};\n\t    GLES20.glDeleteTextures(1, texture, 0);\n\t    mLookupSourceTexture = -1;\n\t}\n\t  \n\tprotected void onDrawArraysAfter(){\n\t\tif (mLookupSourceTexture != -1){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE3);\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0);\n\t    }\n\t}\n\t  \n\tprotected void onDrawArraysPre(){\n\t\tif (mLookupSourceTexture != -1){\n\t\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE3);\n\t\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mLookupSourceTexture);\n\t\t\tGLES20.glUniform1i(mLookupTextureUniform, 3);\n\t    }\n\t}\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/core/filter/base/gpuimage/GPUImageBrightnessFilter.java",
    "content": "/*\n * Copyright (C) 2012 CyberAgent\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage com.zero.magicshow.core.filter.base.gpuimage;\n\nimport android.opengl.GLES20;\n\n/**\n * brightness value ranges from -1.0 to 1.0, with 0.0 as the normal level\n */\npublic class GPUImageBrightnessFilter extends GPUImageFilter {\n    public static final String BRIGHTNESS_FRAGMENT_SHADER = \"\" +\n            \"varying highp vec2 textureCoordinate;\\n\" +\n            \" \\n\" +\n            \" uniform sampler2D inputImageTexture;\\n\" +\n            \" uniform lowp float brightness;\\n\" +\n            \" \\n\" +\n            \" void main()\\n\" +\n            \" {\\n\" +\n            \"     lowp vec4 textureColor = texture2D(inputImageTexture, textureCoordinate);\\n\" +\n            \"     \\n\" +\n            \"     gl_FragColor = vec4((textureColor.rgb + vec3(brightness)), textureColor.w);\\n\" +\n            \" }\";\n\n    private int mBrightnessLocation;\n    private float mBrightness;\n\n    public GPUImageBrightnessFilter() {\n        this(0.0f);\n    }\n\n    public boolean hasChange(){\n        return mBrightness != 0.0;\n    }\n    public GPUImageBrightnessFilter(final float brightness) {\n        super(NO_FILTER_VERTEX_SHADER, BRIGHTNESS_FRAGMENT_SHADER);\n        mBrightness = brightness;\n    }\n\n    @Override\n    public void onInit() {\n        super.onInit();\n        mBrightnessLocation = GLES20.glGetUniformLocation(getProgram(), \"brightness\");\n    }\n\n    @Override\n    public void onInitialized() {\n        super.onInitialized();\n        setBrightness(mBrightness);\n    }\n\n    public void setBrightness(final float brightness) {\n        mBrightness = brightness;\n        setFloat(mBrightnessLocation, mBrightness);\n    }\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/core/filter/base/gpuimage/GPUImageContrastFilter.java",
    "content": "/*\n * Copyright (C) 2012 CyberAgent\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage com.zero.magicshow.core.filter.base.gpuimage;\n\nimport android.opengl.GLES20;\n\n/**\n * Changes the contrast of the image.<br>\n * <br>\n * contrast value ranges from 0.0 to 4.0, with 1.0 as the normal level\n */\npublic class GPUImageContrastFilter extends GPUImageFilter {\n    public static final String CONTRAST_FRAGMENT_SHADER = \"\" +\n            \"varying highp vec2 textureCoordinate;\\n\" + \n            \" \\n\" + \n            \" uniform sampler2D inputImageTexture;\\n\" + \n            \" uniform lowp float contrast;\\n\" + \n            \" \\n\" + \n            \" void main()\\n\" + \n            \" {\\n\" + \n            \"     lowp vec4 textureColor = texture2D(inputImageTexture, textureCoordinate);\\n\" + \n            \"     \\n\" + \n            \"     gl_FragColor = vec4(((textureColor.rgb - vec3(0.5)) * contrast + vec3(0.5)), textureColor.w);\\n\" + \n            \" }\";\n\n    private int mContrastLocation;\n    private float mContrast;\n\n    public GPUImageContrastFilter() {\n        this(1.0f);\n    }\n    \n    public GPUImageContrastFilter(float contrast) {\n        super(NO_FILTER_VERTEX_SHADER, CONTRAST_FRAGMENT_SHADER);\n        mContrast = contrast;\n    }\n\n    @Override\n    public void onInit() {\n        super.onInit();\n        mContrastLocation = GLES20.glGetUniformLocation(getProgram(), \"contrast\");\n    }\n\n    @Override\n    public void onInitialized() {\n        super.onInitialized();\n        setContrast(mContrast);\n    }\n\n    public void setContrast(final float contrast) {\n        mContrast = contrast;\n        setFloat(mContrastLocation, mContrast);\n    }\n\n    public boolean hasChange(){\n        return mContrast != 1.0;\n    }\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/core/filter/base/gpuimage/GPUImageExposureFilter.java",
    "content": "/*\n * Copyright (C) 2012 CyberAgent\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage com.zero.magicshow.core.filter.base.gpuimage;\n\nimport android.opengl.GLES20;\n\n/**\n * exposure: The adjusted exposure (-10.0 - 10.0, with 0.0 as the default)\n */\npublic class GPUImageExposureFilter extends GPUImageFilter {\n    public static final String EXPOSURE_FRAGMENT_SHADER = \"\" +\n            \" varying highp vec2 textureCoordinate;\\n\" +\n            \" \\n\" +\n            \" uniform sampler2D inputImageTexture;\\n\" +\n            \" uniform highp float exposure;\\n\" +\n            \" \\n\" +\n            \" void main()\\n\" +\n            \" {\\n\" +\n            \"     highp vec4 textureColor = texture2D(inputImageTexture, textureCoordinate);\\n\" +\n            \"     \\n\" +\n            \"     gl_FragColor = vec4(textureColor.rgb * pow(2.0, exposure), textureColor.w);\\n\" +\n            \" } \";\n\n    private int mExposureLocation;\n    private float mExposure;\n\n    public GPUImageExposureFilter() {\n        this(0.0f);\n    }\n\n    public boolean hasChange(){\n        return mExposure != 0.0;\n    }\n    public GPUImageExposureFilter(final float exposure) {\n        super(NO_FILTER_VERTEX_SHADER, EXPOSURE_FRAGMENT_SHADER);\n        mExposure = exposure;\n    }\n\n    @Override\n    public void onInit() {\n        super.onInit();\n        mExposureLocation = GLES20.glGetUniformLocation(getProgram(), \"exposure\");\n    }\n\n    @Override\n    public void onInitialized() {\n        super.onInitialized();\n        setExposure(mExposure);\n    }\n\n    public void setExposure(final float exposure) {\n        mExposure = exposure;\n        setFloat(mExposureLocation, mExposure);\n    }\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/core/filter/base/gpuimage/GPUImageFilter.java",
    "content": "/*\n * Copyright (C) 2012 CyberAgent\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage com.zero.magicshow.core.filter.base.gpuimage;\n\nimport android.graphics.PointF;\nimport android.opengl.GLES20;\n\nimport com.zero.magicshow.common.utils.OpenGlUtils;\nimport com.zero.magicshow.common.utils.Rotation;\nimport com.zero.magicshow.common.utils.TextureRotationUtil;\n\nimport java.nio.ByteBuffer;\nimport java.nio.ByteOrder;\nimport java.nio.FloatBuffer;\nimport java.util.LinkedList;\n\npublic class GPUImageFilter {\n    public static final String NO_FILTER_VERTEX_SHADER = \"\" +\n            \"attribute vec4 position;\\n\" +\n            \"attribute vec4 inputTextureCoordinate;\\n\" +\n            \" \\n\" +\n            \"varying vec2 textureCoordinate;\\n\" +\n            \" \\n\" +\n            \"void main()\\n\" +\n            \"{\\n\" +\n            \"    gl_Position = position;\\n\" +\n            \"    textureCoordinate = inputTextureCoordinate.xy;\\n\" +\n            \"}\";\n    public static final String NO_FILTER_FRAGMENT_SHADER = \"\" +\n            \"varying highp vec2 textureCoordinate;\\n\" +\n            \" \\n\" +\n            \"uniform sampler2D inputImageTexture;\\n\" +\n            \" \\n\" +\n            \"void main()\\n\" +\n            \"{\\n\" +\n            \"     gl_FragColor = texture2D(inputImageTexture, textureCoordinate);\\n\" +\n            \"}\";\n\n    private final LinkedList<Runnable> mRunOnDraw;\n    private final String mVertexShader;\n    private final String mFragmentShader;\n    protected int mGLProgId;\n    protected int mGLAttribPosition;\n    protected int mGLUniformTexture;\n    protected int mGLAttribTextureCoordinate;\n    protected int mGLStrengthLocation;\n\n    protected int mIntputWidth;\n    protected int mIntputHeight;\n    protected boolean mIsInitialized;\n    protected FloatBuffer mGLCubeBuffer;\n    protected FloatBuffer mGLTextureBuffer;\n    protected int mOutputWidth, mOutputHeight;\n    \n    public GPUImageFilter() {\n        this(NO_FILTER_VERTEX_SHADER, NO_FILTER_FRAGMENT_SHADER);\n    }\n\n    public GPUImageFilter(final String vertexShader, final String fragmentShader) {\n        mRunOnDraw = new LinkedList<>();\n        mVertexShader = vertexShader;\n        mFragmentShader = fragmentShader;\n        \n        mGLCubeBuffer = ByteBuffer.allocateDirect(TextureRotationUtil.CUBE.length * 4)\n                .order(ByteOrder.nativeOrder())\n                .asFloatBuffer();\n        mGLCubeBuffer.put(TextureRotationUtil.CUBE).position(0);\n\n        mGLTextureBuffer = ByteBuffer.allocateDirect(TextureRotationUtil.TEXTURE_NO_ROTATION.length * 4)\n                .order(ByteOrder.nativeOrder())\n                .asFloatBuffer();\n        mGLTextureBuffer.put(TextureRotationUtil.getRotation(Rotation.NORMAL, false, true)).position(0);\n    }\n\n    public void init() {\n        onInit();\n        mIsInitialized = true;\n        onInitialized();\n    }\n\n    public boolean hasChange(){\n        return true;\n    }\n    protected void onInit() {\n        mGLProgId = OpenGlUtils.loadProgram(mVertexShader, mFragmentShader);\n        mGLAttribPosition = GLES20.glGetAttribLocation(mGLProgId, \"position\");\n        mGLUniformTexture = GLES20.glGetUniformLocation(mGLProgId, \"inputImageTexture\");\n        mGLAttribTextureCoordinate = GLES20.glGetAttribLocation(mGLProgId,\n                \"inputTextureCoordinate\");\n        mGLStrengthLocation = GLES20.glGetUniformLocation(mGLProgId,\n                \"strength\");\n        mIsInitialized = true;\n    }\n\n    protected void onInitialized() {\n        setFloat(mGLStrengthLocation, 1.0f);\n    }\n\n    public final void destroy() {\n        mIsInitialized = false;\n        GLES20.glDeleteProgram(mGLProgId);\n        onDestroy();\n    }\n\n    protected void onDestroy() {\n    }\n\n    public void onInputSizeChanged(final int width, final int height) {\n        mIntputWidth = width;\n        mIntputHeight = height;\n//        Log.e(\"HongLi\",\"in small onInputSizeChanged mIntputWidth:\" + mIntputWidth + \";mIntputHeight:\" + mIntputHeight + \";mOutputWidth:\" + mOutputWidth + \";mOutputHeight:\" + mOutputHeight);\n//        mIntputWidth = 1024;\n//        mIntputHeight = 1574;\n//        mOutputWidth = 1024;\n//        mOutputHeight = 1574;\n    }\n\n    public void onOutputSizeChanged(final int width, final int height){\n        mOutputWidth = width;\n        mOutputHeight = height;\n    }\n\n    public void onDrawFrameNormal(final int textureId,int width,int height){}\n\n    public int onDrawFrame(final int textureId, final FloatBuffer cubeBuffer,\n                       final FloatBuffer textureBuffer) {\n        GLES20.glUseProgram(mGLProgId);\n        runPendingOnDrawTasks();\n        if (!mIsInitialized) {\n            return OpenGlUtils.NOT_INIT;\n        }\n\n        cubeBuffer.position(0);\n        GLES20.glVertexAttribPointer(mGLAttribPosition, 2, GLES20.GL_FLOAT, false, 0, cubeBuffer);\n        GLES20.glEnableVertexAttribArray(mGLAttribPosition);\n        textureBuffer.position(0);\n        GLES20.glVertexAttribPointer(mGLAttribTextureCoordinate, 2, GLES20.GL_FLOAT, false, 0,\n                textureBuffer);\n        GLES20.glEnableVertexAttribArray(mGLAttribTextureCoordinate);\n        if (textureId != OpenGlUtils.NO_TEXTURE) {\n            //激活纹理单元1\n            GLES20.glActiveTexture(GLES20.GL_TEXTURE0);\n            //绑定2D纹理\n            GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textureId);\n            //将纹理设置给Shader\n            GLES20.glUniform1i(mGLUniformTexture, 0);\n        }\n        onDrawArraysPre();\n        GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4);\n        GLES20.glDisableVertexAttribArray(mGLAttribPosition);\n        GLES20.glDisableVertexAttribArray(mGLAttribTextureCoordinate);\n        onDrawArraysAfter();\n        GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);\n        return OpenGlUtils.ON_DRAWN;\n    }\n    \n    public int onDrawFrame(final int textureId) {\n\t\tGLES20.glUseProgram(mGLProgId);\n\t\trunPendingOnDrawTasks();\n\t\tif (!mIsInitialized) \n\t\t\treturn OpenGlUtils.NOT_INIT;\n\t\t\n\t\tmGLCubeBuffer.position(0);\n\t\tGLES20.glVertexAttribPointer(mGLAttribPosition, 2, GLES20.GL_FLOAT, false, 0, mGLCubeBuffer);\n\t\tGLES20.glEnableVertexAttribArray(mGLAttribPosition);\n\t\tmGLTextureBuffer.position(0);\n\t\tGLES20.glVertexAttribPointer(mGLAttribTextureCoordinate, 2, GLES20.GL_FLOAT, false, 0,\n\t\t     mGLTextureBuffer);\n\t\tGLES20.glEnableVertexAttribArray(mGLAttribTextureCoordinate);\n\n\t\tif (textureId != OpenGlUtils.NO_TEXTURE) {\n            GLES20.glActiveTexture(GLES20.GL_TEXTURE0);\n\t\t    GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textureId);\n\t\t    GLES20.glUniform1i(mGLUniformTexture, 0);\n\t\t}\n\t\tonDrawArraysPre();\n\t\tGLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4);\n\t\tGLES20.glDisableVertexAttribArray(mGLAttribPosition);\n\t\tGLES20.glDisableVertexAttribArray(mGLAttribTextureCoordinate);\n\t\tonDrawArraysAfter();\n\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);\n\t\treturn OpenGlUtils.ON_DRAWN;\n\t}\n    \n    protected void onDrawArraysPre() {}\n    protected void onDrawArraysAfter() {}\n    \n    protected void runPendingOnDrawTasks() {\n        while (!mRunOnDraw.isEmpty()) {\n            mRunOnDraw.removeFirst().run();\n        }\n    }\n\n    public boolean isInitialized() {\n        return mIsInitialized;\n    }\n\n    public int getIntputWidth() {\n        return mIntputWidth;\n    }\n\n    public int getIntputHeight() {\n        return mIntputHeight;\n    }\n\n    public int getProgram() {\n        return mGLProgId;\n    }\n\n    public int getAttribPosition() {\n        return mGLAttribPosition;\n    }\n\n    public int getAttribTextureCoordinate() {\n        return mGLAttribTextureCoordinate;\n    }\n\n    public int getUniformTexture() {\n        return mGLUniformTexture;\n    }\n\n    protected void setInteger(final int location, final int intValue) {\n        runOnDraw(new Runnable() {\n            @Override\n            public void run() {\n                GLES20.glUniform1i(location, intValue);\n            }\n        });\n    }\n\n    protected void setFloat(final int location, final float floatValue) {\n        runOnDraw(new Runnable() {\n            @Override\n            public void run() {\n                GLES20.glUniform1f(location, floatValue);\n            }\n        });\n    }\n\n    protected void setFloatVec2(final int location, final float[] arrayValue) {\n        runOnDraw(new Runnable() {\n            @Override\n            public void run() {\n                GLES20.glUniform2fv(location, 1, FloatBuffer.wrap(arrayValue));\n            }\n        });\n    }\n\n    protected void setFloatVec3(final int location, final float[] arrayValue) {\n        runOnDraw(new Runnable() {\n            @Override\n            public void run() {\n                GLES20.glUniform3fv(location, 1, FloatBuffer.wrap(arrayValue));\n            }\n        });\n    }\n\n    protected void setFloatVec4(final int location, final float[] arrayValue) {\n        runOnDraw(new Runnable() {\n            @Override\n            public void run() {\n                GLES20.glUniform4fv(location, 1, FloatBuffer.wrap(arrayValue));\n            }\n        });\n    }\n\n    protected void setFloatArray(final int location, final float[] arrayValue) {\n        runOnDraw(new Runnable() {\n            @Override\n            public void run() {\n                GLES20.glUniform1fv(location, arrayValue.length, FloatBuffer.wrap(arrayValue));\n            }\n        });\n    }\n\n    protected void setPoint(final int location, final PointF point) {\n        runOnDraw(new Runnable() {\n\n            @Override\n            public void run() {\n                float[] vec2 = new float[2];\n                vec2[0] = point.x;\n                vec2[1] = point.y;\n                GLES20.glUniform2fv(location, 1, vec2, 0);\n            }\n        });\n    }\n\n    protected void setUniformMatrix3f(final int location, final float[] matrix) {\n        runOnDraw(new Runnable() {\n\n            @Override\n            public void run() {\n                GLES20.glUniformMatrix3fv(location, 1, false, matrix, 0);\n            }\n        });\n    }\n\n    protected void setUniformMatrix4f(final int location, final float[] matrix) {\n        runOnDraw(new Runnable() {\n\n            @Override\n            public void run() {\n                GLES20.glUniformMatrix4fv(location, 1, false, matrix, 0);\n            }\n        });\n    }\n\n    protected void runOnDraw(final Runnable runnable) {\n        synchronized (mRunOnDraw) {\n            mRunOnDraw.addLast(runnable);\n        }\n    }\n\n    public void onDisplaySizeChanged(final int width, final int height) {\n    \tmOutputWidth = width;\n    \tmOutputHeight = height;\n    }\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/core/filter/base/gpuimage/GPUImageHueFilter.java",
    "content": "/*\n * Copyright (C) 2012 CyberAgent\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage com.zero.magicshow.core.filter.base.gpuimage;\n\nimport android.opengl.GLES20;\n\npublic class GPUImageHueFilter extends GPUImageFilter {\n    public static final String HUE_FRAGMENT_SHADER = \"\" +\n      \"precision highp float;\\n\" +\n      \"varying highp vec2 textureCoordinate;\\n\" +\n      \"\\n\" +\n      \"uniform sampler2D inputImageTexture;\\n\" +\n      \"uniform mediump float hueAdjust;\\n\" +\n      \"const highp vec4 kRGBToYPrime = vec4 (0.299, 0.587, 0.114, 0.0);\\n\" +\n      \"const highp vec4 kRGBToI = vec4 (0.595716, -0.274453, -0.321263, 0.0);\\n\" +\n      \"const highp vec4 kRGBToQ = vec4 (0.211456, -0.522591, 0.31135, 0.0);\\n\" +\n      \"\\n\" +\n      \"const highp vec4 kYIQToR = vec4 (1.0, 0.9563, 0.6210, 0.0);\\n\" +\n      \"const highp vec4 kYIQToG = vec4 (1.0, -0.2721, -0.6474, 0.0);\\n\" +\n      \"const highp vec4 kYIQToB = vec4 (1.0, -1.1070, 1.7046, 0.0);\\n\" +\n      \"\\n\" +\n      \"void main ()\\n\" +\n      \"{\\n\" +\n      \"    // Sample the input pixel\\n\" +\n      \"    highp vec4 color = texture2D(inputImageTexture, textureCoordinate);\\n\" +\n      \"\\n\" +\n      \"    // Convert to YIQ\\n\" +\n      \"    highp float YPrime = dot (color, kRGBToYPrime);\\n\" +\n      \"    highp float I = dot (color, kRGBToI);\\n\" +\n      \"    highp float Q = dot (color, kRGBToQ);\\n\" +\n      \"\\n\" +\n      \"    // Calculate the hue and chroma\\n\" +\n      \"    highp float hue = atan (Q, I);\\n\" +\n      \"    highp float chroma = sqrt (I * I + Q * Q);\\n\" +\n      \"\\n\" +\n      \"    // Make the user's adjustments\\n\" +\n      \"    hue += (-hueAdjust); //why negative rotation?\\n\" +\n      \"\\n\" +\n      \"    // Convert back to YIQ\\n\" +\n      \"    Q = chroma * sin (hue);\\n\" +\n      \"    I = chroma * cos (hue);\\n\" +\n      \"\\n\" +\n      \"    // Convert back to RGB\\n\" +\n      \"    highp vec4 yIQ = vec4 (YPrime, I, Q, 0.0);\\n\" +\n      \"    color.r = dot (yIQ, kYIQToR);\\n\" +\n      \"    color.g = dot (yIQ, kYIQToG);\\n\" +\n      \"    color.b = dot (yIQ, kYIQToB);\\n\" +\n      \"\\n\" +\n      \"    // Save the result\\n\" +\n      \"    gl_FragColor = color;\\n\" +\n      \"}\\n\";\n\n    private float mHue;\n    private int mHueLocation;\n\n    public GPUImageHueFilter() {\n        this(0.0f);\n    }\n\n    public boolean hasChange(){\n        return mHue != 0.0;\n    }\n    public GPUImageHueFilter(final float hue) {\n        super(NO_FILTER_VERTEX_SHADER, HUE_FRAGMENT_SHADER);\n        mHue = hue;\n    }\n\n    @Override\n    public void onInit() {\n        super.onInit();\n        mHueLocation = GLES20.glGetUniformLocation(getProgram(), \"hueAdjust\");\n    }\n\n    @Override\n    public void onInitialized() {\n        super.onInitialized();\n        setHue(mHue);\n    }\n\n    public void setHue(final float hue) {\n        mHue = hue;\n        float hueAdjust = (mHue % 360.0f) * (float) Math.PI / 180.0f;\n        setFloat(mHueLocation, hueAdjust);\n    }\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/core/filter/base/gpuimage/GPUImageSaturationFilter.java",
    "content": "/*\n * Copyright (C) 2012 CyberAgent\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage com.zero.magicshow.core.filter.base.gpuimage;\n\nimport android.opengl.GLES20;\n\n/**\n * saturation: The degree of saturation or desaturation to apply to the image (0.0 - 2.0, with 1.0 as the default)\n */\npublic class GPUImageSaturationFilter extends GPUImageFilter {\n    public static final String SATURATION_FRAGMENT_SHADER = \"\" +\n            \" varying highp vec2 textureCoordinate;\\n\" +\n            \" \\n\" +\n            \" uniform sampler2D inputImageTexture;\\n\" +\n            \" uniform lowp float saturation;\\n\" +\n            \" \\n\" +\n            \" // Values from \\\"Graphics Shaders: Theory and Practice\\\" by Bailey and Cunningham\\n\" +\n            \" const mediump vec3 luminanceWeighting = vec3(0.2125, 0.7154, 0.0721);\\n\" +\n            \" \\n\" +\n            \" void main()\\n\" +\n            \" {\\n\" +\n            \"    lowp vec4 textureColor = texture2D(inputImageTexture, textureCoordinate);\\n\" +\n            \"    lowp float luminance = dot(textureColor.rgb, luminanceWeighting);\\n\" +\n            \"    lowp vec3 greyScaleColor = vec3(luminance);\\n\" +\n            \"    \\n\" +\n            \"    gl_FragColor = vec4(mix(greyScaleColor, textureColor.rgb, saturation), textureColor.w);\\n\" +\n            \"     \\n\" +\n            \" }\";\n\n    private int mSaturationLocation;\n    private float mSaturation;\n\n    public GPUImageSaturationFilter() {\n        this(1.0f);\n    }\n\n    public boolean hasChange(){\n        return mSaturation != 0.0;\n    }\n    public GPUImageSaturationFilter(final float saturation) {\n        super(NO_FILTER_VERTEX_SHADER, SATURATION_FRAGMENT_SHADER);\n        mSaturation = saturation;\n    }\n\n    @Override\n    public void onInit() {\n        super.onInit();\n        mSaturationLocation = GLES20.glGetUniformLocation(getProgram(), \"saturation\");\n    }\n\n    @Override\n    public void onInitialized() {\n        super.onInitialized();\n        setSaturation(mSaturation);\n    }\n\n    public void setSaturation(final float saturation) {\n        mSaturation = saturation;\n        setFloat(mSaturationLocation, mSaturation);\n    }\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/core/filter/base/gpuimage/GPUImageSharpenFilter.java",
    "content": "/*\n * Copyright (C) 2012 CyberAgent\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage com.zero.magicshow.core.filter.base.gpuimage;\n\nimport android.opengl.GLES20;\n\n/**\n * Sharpens the picture. <br>\n * <br>\n * sharpness: from -4.0 to 4.0, with 0.0 as the normal level\n */\npublic class GPUImageSharpenFilter extends GPUImageFilter {\n    public static final String SHARPEN_VERTEX_SHADER = \"\" +\n            \"attribute vec4 position;\\n\" +\n            \"attribute vec4 inputTextureCoordinate;\\n\" +\n            \"\\n\" +\n            \"uniform float imageWidthFactor; \\n\" +\n            \"uniform float imageHeightFactor; \\n\" +\n            \"uniform float sharpness;\\n\" +\n            \"\\n\" +\n            \"varying vec2 textureCoordinate;\\n\" +\n            \"varying vec2 leftTextureCoordinate;\\n\" +\n            \"varying vec2 rightTextureCoordinate; \\n\" +\n            \"varying vec2 topTextureCoordinate;\\n\" +\n            \"varying vec2 bottomTextureCoordinate;\\n\" +\n            \"\\n\" +\n            \"varying float centerMultiplier;\\n\" +\n            \"varying float edgeMultiplier;\\n\" +\n            \"\\n\" +\n            \"void main()\\n\" +\n            \"{\\n\" +\n            \"    gl_Position = position;\\n\" +\n            \"    \\n\" +\n            \"    mediump vec2 widthStep = vec2(imageWidthFactor, 0.0);\\n\" +\n            \"    mediump vec2 heightStep = vec2(0.0, imageHeightFactor);\\n\" +\n            \"    \\n\" +\n            \"    textureCoordinate = inputTextureCoordinate.xy;\\n\" +\n            \"    leftTextureCoordinate = inputTextureCoordinate.xy - widthStep;\\n\" +\n            \"    rightTextureCoordinate = inputTextureCoordinate.xy + widthStep;\\n\" +\n            \"    topTextureCoordinate = inputTextureCoordinate.xy + heightStep;     \\n\" +\n            \"    bottomTextureCoordinate = inputTextureCoordinate.xy - heightStep;\\n\" +\n            \"    \\n\" +\n            \"    centerMultiplier = 1.0 + 4.0 * sharpness;\\n\" +\n            \"    edgeMultiplier = sharpness;\\n\" +\n            \"}\";\n\n    public static final String SHARPEN_FRAGMENT_SHADER = \"\" +\n            \"precision highp float;\\n\" + \n            \"\\n\" + \n            \"varying highp vec2 textureCoordinate;\\n\" + \n            \"varying highp vec2 leftTextureCoordinate;\\n\" + \n            \"varying highp vec2 rightTextureCoordinate; \\n\" + \n            \"varying highp vec2 topTextureCoordinate;\\n\" + \n            \"varying highp vec2 bottomTextureCoordinate;\\n\" + \n            \"\\n\" + \n            \"varying highp float centerMultiplier;\\n\" + \n            \"varying highp float edgeMultiplier;\\n\" + \n            \"\\n\" + \n            \"uniform sampler2D inputImageTexture;\\n\" + \n            \"\\n\" + \n            \"void main()\\n\" + \n            \"{\\n\" + \n            \"    mediump vec3 textureColor = texture2D(inputImageTexture, textureCoordinate).rgb;\\n\" + \n            \"    mediump vec3 leftTextureColor = texture2D(inputImageTexture, leftTextureCoordinate).rgb;\\n\" + \n            \"    mediump vec3 rightTextureColor = texture2D(inputImageTexture, rightTextureCoordinate).rgb;\\n\" + \n            \"    mediump vec3 topTextureColor = texture2D(inputImageTexture, topTextureCoordinate).rgb;\\n\" + \n            \"    mediump vec3 bottomTextureColor = texture2D(inputImageTexture, bottomTextureCoordinate).rgb;\\n\" + \n            \"\\n\" + \n            \"    gl_FragColor = vec4((textureColor * centerMultiplier - (leftTextureColor * edgeMultiplier + rightTextureColor * edgeMultiplier + topTextureColor * edgeMultiplier + bottomTextureColor * edgeMultiplier)), texture2D(inputImageTexture, bottomTextureCoordinate).w);\\n\" + \n            \"}\";\n\n    private int mSharpnessLocation;\n    private float mSharpness;\n    private int mImageWidthFactorLocation;\n    private int mImageHeightFactorLocation;\n\n    public GPUImageSharpenFilter() {\n        this(0.0f);\n    }\n\n    public boolean hasChange(){\n        return mSharpness != 0.0;\n    }\n    public GPUImageSharpenFilter(final float sharpness) {\n        super(SHARPEN_VERTEX_SHADER, SHARPEN_FRAGMENT_SHADER);\n        mSharpness = sharpness;\n    }\n\n    @Override\n    public void onInit() {\n        super.onInit();\n        mSharpnessLocation = GLES20.glGetUniformLocation(getProgram(), \"sharpness\");\n        mImageWidthFactorLocation = GLES20.glGetUniformLocation(getProgram(), \"imageWidthFactor\");\n        mImageHeightFactorLocation = GLES20.glGetUniformLocation(getProgram(), \"imageHeightFactor\");\n        setSharpness(mSharpness);\n    }\n\n    @Override\n    public void onInputSizeChanged(final int width, final int height) {\n        super.onInputSizeChanged(width, height);\n        setFloat(mImageWidthFactorLocation, 1.0f / width);\n        setFloat(mImageHeightFactorLocation, 1.0f / height);\n    }\n\n    public void setSharpness(final float sharpness) {\n        mSharpness = sharpness;\n        setFloat(mSharpnessLocation, mSharpness);\n    }\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/core/filter/utils/MagicFilterFactory.java",
    "content": "package com.zero.magicshow.core.filter.utils;\n\nimport com.zero.magicshow.core.filter.advanced.MagicAmaroFilter;\nimport com.zero.magicshow.core.filter.advanced.MagicAntiqueFilter;\nimport com.zero.magicshow.core.filter.advanced.MagicBlackCatFilter;\nimport com.zero.magicshow.core.filter.advanced.MagicBrannanFilter;\nimport com.zero.magicshow.core.filter.advanced.MagicBrooklynFilter;\nimport com.zero.magicshow.core.filter.advanced.MagicCalmFilter;\nimport com.zero.magicshow.core.filter.advanced.MagicCoolFilter;\nimport com.zero.magicshow.core.filter.advanced.MagicCrayonFilter;\nimport com.zero.magicshow.core.filter.advanced.MagicEarlyBirdFilter;\nimport com.zero.magicshow.core.filter.advanced.MagicEmeraldFilter;\nimport com.zero.magicshow.core.filter.advanced.MagicEvergreenFilter;\nimport com.zero.magicshow.core.filter.advanced.MagicFairytaleFilter;\nimport com.zero.magicshow.core.filter.advanced.MagicFreudFilter;\nimport com.zero.magicshow.core.filter.advanced.MagicHealthyFilter;\nimport com.zero.magicshow.core.filter.advanced.MagicHefeFilter;\nimport com.zero.magicshow.core.filter.advanced.MagicHudsonFilter;\nimport com.zero.magicshow.core.filter.advanced.MagicImageAdjustFilter;\nimport com.zero.magicshow.core.filter.advanced.MagicInkwellFilter;\nimport com.zero.magicshow.core.filter.advanced.MagicKevinFilter;\nimport com.zero.magicshow.core.filter.advanced.MagicLatteFilter;\nimport com.zero.magicshow.core.filter.advanced.MagicLomoFilter;\nimport com.zero.magicshow.core.filter.advanced.MagicN1977Filter;\nimport com.zero.magicshow.core.filter.advanced.MagicNashvilleFilter;\nimport com.zero.magicshow.core.filter.advanced.MagicNostalgiaFilter;\nimport com.zero.magicshow.core.filter.advanced.MagicPixarFilter;\nimport com.zero.magicshow.core.filter.advanced.MagicRiseFilter;\nimport com.zero.magicshow.core.filter.advanced.MagicRomanceFilter;\nimport com.zero.magicshow.core.filter.advanced.MagicSakuraFilter;\nimport com.zero.magicshow.core.filter.advanced.MagicSierraFilter;\nimport com.zero.magicshow.core.filter.advanced.MagicSketchFilter;\nimport com.zero.magicshow.core.filter.advanced.MagicSkinWhitenFilter;\nimport com.zero.magicshow.core.filter.advanced.MagicSunriseFilter;\nimport com.zero.magicshow.core.filter.advanced.MagicSunsetFilter;\nimport com.zero.magicshow.core.filter.advanced.MagicSutroFilter;\nimport com.zero.magicshow.core.filter.advanced.MagicSweetsFilter;\nimport com.zero.magicshow.core.filter.advanced.MagicTenderFilter;\nimport com.zero.magicshow.core.filter.advanced.MagicToasterFilter;\nimport com.zero.magicshow.core.filter.advanced.MagicValenciaFilter;\nimport com.zero.magicshow.core.filter.advanced.MagicWaldenFilter;\nimport com.zero.magicshow.core.filter.advanced.MagicWarmFilter;\nimport com.zero.magicshow.core.filter.advanced.MagicWhiteCatFilter;\nimport com.zero.magicshow.core.filter.advanced.MagicXproIIFilter;\nimport com.zero.magicshow.core.filter.base.gpuimage.GPUImageBrightnessFilter;\nimport com.zero.magicshow.core.filter.base.gpuimage.GPUImageContrastFilter;\nimport com.zero.magicshow.core.filter.base.gpuimage.GPUImageExposureFilter;\nimport com.zero.magicshow.core.filter.base.gpuimage.GPUImageFilter;\nimport com.zero.magicshow.core.filter.base.gpuimage.GPUImageHueFilter;\nimport com.zero.magicshow.core.filter.base.gpuimage.GPUImageSaturationFilter;\nimport com.zero.magicshow.core.filter.base.gpuimage.GPUImageSharpenFilter;\n\npublic class MagicFilterFactory{\n\t\n\tprivate static MagicFilterType filterType = MagicFilterType.NONE;\n\t\n\tpublic static GPUImageFilter initFilters(MagicFilterType type){\n\t\tfilterType = type;\n\t\tswitch (type) {\n\t\tcase WHITECAT:\n\t\t\treturn new MagicWhiteCatFilter();\n\t\tcase BLACKCAT:\n\t\t\treturn new MagicBlackCatFilter();\n\t\tcase SKINWHITEN:\n\t\t\treturn new MagicSkinWhitenFilter();\n\t\tcase ROMANCE:\n\t\t\treturn new MagicRomanceFilter();\n\t\tcase SAKURA:\n\t\t\treturn new MagicSakuraFilter();\n\t\tcase AMARO:\n\t\t\treturn new MagicAmaroFilter();\n\t\tcase WALDEN:\n\t\t\treturn new MagicWaldenFilter();\n\t\tcase ANTIQUE:\n\t\t\treturn new MagicAntiqueFilter();\n\t\tcase CALM:\n\t\t\treturn new MagicCalmFilter();\n\t\tcase BRANNAN:\n\t\t\treturn new MagicBrannanFilter();\n\t\tcase BROOKLYN:\n\t\t\treturn new MagicBrooklynFilter();\n\t\tcase EARLYBIRD:\n\t\t\treturn new MagicEarlyBirdFilter();\n\t\tcase FREUD:\n\t\t\treturn new MagicFreudFilter();\n\t\tcase HEFE:\n\t\t\treturn new MagicHefeFilter();\n\t\tcase HUDSON:\n\t\t\treturn new MagicHudsonFilter();\n\t\tcase INKWELL:\n\t\t\treturn new MagicInkwellFilter();\n\t\tcase KEVIN:\n\t\t\treturn new MagicKevinFilter();\n\t\tcase LOMO:\n\t\t\treturn new MagicLomoFilter();\n\t\tcase N1977:\n\t\t\treturn new MagicN1977Filter();\n\t\tcase NASHVILLE:\n\t\t\treturn new MagicNashvilleFilter();\n\t\tcase PIXAR:\n\t\t\treturn new MagicPixarFilter();\n\t\tcase RISE:\n\t\t\treturn new MagicRiseFilter();\n\t\tcase SIERRA:\n\t\t\treturn new MagicSierraFilter();\n\t\tcase SUTRO:\n\t\t\treturn new MagicSutroFilter();\n\t\tcase TOASTER2:\n\t\t\treturn new MagicToasterFilter();\n\t\tcase VALENCIA:\n\t\t\treturn new MagicValenciaFilter();\n\t\tcase XPROII:\n\t\t\treturn new MagicXproIIFilter();\n\t\tcase EVERGREEN:\n\t\t\treturn new MagicEvergreenFilter();\n\t\tcase HEALTHY:\n\t\t\treturn new MagicHealthyFilter();\n\t\tcase COOL:\n\t\t\treturn new MagicCoolFilter();\n\t\tcase EMERALD:\n\t\t\treturn new MagicEmeraldFilter();\n\t\tcase LATTE:\n\t\t\treturn new MagicLatteFilter();\n\t\tcase WARM:\n\t\t\treturn new MagicWarmFilter();\n\t\tcase TENDER:\n\t\t\treturn new MagicTenderFilter();\n\t\tcase SWEETS:\n\t\t\treturn new MagicSweetsFilter();\n\t\tcase NOSTALGIA:\n\t\t\treturn new MagicNostalgiaFilter();\n\t\tcase FAIRYTALE:\n\t\t\treturn new MagicFairytaleFilter();\n\t\tcase SUNRISE:\n\t\t\treturn new MagicSunriseFilter();\n\t\tcase SUNSET:\n\t\t\treturn new MagicSunsetFilter();\n\t\tcase CRAYON:\n\t\t\treturn new MagicCrayonFilter();\n\t\tcase SKETCH:\n\t\t\treturn new MagicSketchFilter();\n\t\t//image adjust\n\t\tcase BRIGHTNESS:\n\t\t\treturn new GPUImageBrightnessFilter();\n\t\tcase CONTRAST:\n\t\t\treturn new GPUImageContrastFilter();\n\t\tcase EXPOSURE:\n\t\t\treturn new GPUImageExposureFilter();\n\t\tcase HUE:\n\t\t\treturn new GPUImageHueFilter();\n\t\tcase SATURATION:\n\t\t\treturn new GPUImageSaturationFilter();\n\t\tcase SHARPEN:\n\t\t\treturn new GPUImageSharpenFilter();\n\t\tcase IMAGE_ADJUST:\n\t\t\treturn new MagicImageAdjustFilter();\n\t\tdefault:\n\t\t\treturn null;\n\t\t}\n\t}\n\t\n\tpublic static MagicFilterType getCurrentFilterType(){\n\t\treturn filterType;\n\t}\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/core/filter/utils/MagicFilterType.java",
    "content": "package com.zero.magicshow.core.filter.utils;\n\n/**\n * Created by why8222 on 2016/2/25.\n */\npublic enum  MagicFilterType {\n    NONE,\n    FAIRYTALE,\n    SUNRISE,\n    SUNSET,\n    WHITECAT,\n    BLACKCAT,\n    SKINWHITEN,\n    HEALTHY,\n    SWEETS,\n    ROMANCE,\n    SAKURA,\n    WARM,\n    ANTIQUE,\n    NOSTALGIA,\n    CALM,\n    LATTE,\n    TENDER,\n    COOL,\n    EMERALD,\n    EVERGREEN,\n    CRAYON,\n    SKETCH,\n    AMARO,\n    BRANNAN,\n    BROOKLYN,\n    EARLYBIRD,\n    FREUD,\n    HEFE,\n    HUDSON,\n    INKWELL,\n    KEVIN,\n    LOMO,\n    N1977,\n    NASHVILLE,\n    PIXAR,\n    RISE,\n    SIERRA,\n    SUTRO,\n    TOASTER2,\n    VALENCIA,\n    WALDEN,\n    XPROII,\n    //image adjust\n    CONTRAST,\n    BRIGHTNESS,\n    EXPOSURE,\n    HUE,\n    SATURATION,\n    SHARPEN,\n    IMAGE_ADJUST\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/core/widget/BubbleSeekBar.java",
    "content": "package com.zero.magicshow.core.widget;\n\nimport android.content.Context;\nimport android.graphics.PixelFormat;\nimport android.graphics.Point;\nimport android.graphics.Rect;\nimport android.graphics.drawable.Drawable;\nimport android.os.IBinder;\nimport android.support.v4.view.GravityCompat;\nimport android.support.v7.widget.AppCompatSeekBar;\nimport android.util.AttributeSet;\nimport android.util.DisplayMetrics;\nimport android.util.Log;\nimport android.view.Gravity;\nimport android.view.View;\nimport android.view.ViewGroup;\nimport android.view.WindowManager;\nimport android.widget.FrameLayout;\nimport android.widget.SeekBar;\nimport android.widget.TextView;\n\nimport com.zero.magicshow.R;\n\npublic class BubbleSeekBar extends AppCompatSeekBar{\n\tprivate Drawable mThumbDrawable;\n\tprivate BubbleIndicator mBubbleIndicator;\n\tprivate boolean mIsListenerSet = false;\n\tprivate OnBubbleSeekBarChangeListener mOnBubbleSeekBarChangeListener;\n\tprivate int start = 0;\n\tprivate int\tend= 100;\n\t\n\tpublic BubbleSeekBar(Context context) {\n\t\tthis(context, null);\n\t}\n\n\tpublic BubbleSeekBar(Context context, AttributeSet attrs) {\n\t\tthis(context, attrs, 0);\n\t}\n\n\tpublic BubbleSeekBar(Context context, AttributeSet attrs, int defStyleAttr) {\n\t\tsuper(context, attrs, defStyleAttr);\n\t\tmBubbleIndicator = new BubbleIndicator(context);\n\t\tsetOnSeekBarChangeListener(mOnSeekBarChangeListener);\n\t}\n\t\n    @Override\n    public void setThumb(Drawable thumb) {\n        super.setThumb(thumb);\n        mThumbDrawable = thumb;\n    }\n\t\n    public void setRange(int start, int end){\n    \tthis.start = start;\n    \tthis.end = end;\n    }\n    \n    public void setMax(){\n    \tsuper.setMax(100);\n    }\n    \n\tprivate SeekBar.OnSeekBarChangeListener mOnSeekBarChangeListener = new SeekBar.OnSeekBarChangeListener() {\n\t\t\n\t\t@Override\n\t\tpublic void onStopTrackingTouch(SeekBar seekBar) {\n\t\t\tmBubbleIndicator.hideIndicator();\n\t\t\tif(mOnBubbleSeekBarChangeListener != null)\n\t\t\t\tmOnBubbleSeekBarChangeListener.onStopTrackingTouch(seekBar);\n\t\t}\n\t\t\n\t\t@Override\n\t\tpublic void onStartTrackingTouch(SeekBar seekBar) {\n\t\t\tmBubbleIndicator.showIndicator(seekBar, mThumbDrawable.getBounds());\n\t\t\tif(mOnBubbleSeekBarChangeListener != null)\n\t\t\t\tmOnBubbleSeekBarChangeListener.onStartTrackingTouch(seekBar);\n\t\t}\n\t\t\n\t\t@Override\n\t\tpublic void onProgressChanged(SeekBar seekBar, int progress,\n\t\t\t\tboolean fromUser) {\t\t\t\n\t\t\tif(fromUser)\n\t\t\t\tmBubbleIndicator.moveIndicator(mThumbDrawable.getBounds(), start + (int) ((end - start) * progress / 100.0f));\n\t\t\tif(mOnBubbleSeekBarChangeListener != null)\n\t\t\t\tmOnBubbleSeekBarChangeListener.onProgressChanged(seekBar, progress, fromUser);\n\t\t}\n\t};\n\t\n\t/**\n     * Use OnBubbleSeekBarChangeListener instead of OnSeekBarChangeListener\n     * \n     * @param l The seek bar notification listener\n     * \n     * @see OnBubbleSeekBarChangeListener\n     */\n\tpublic void setOnSeekBarChangeListener(SeekBar.OnSeekBarChangeListener l) {\n\t\tif(mIsListenerSet)\n\t\t\tLog.e(\"BubbleSeekBar\",\"Use OnBubbleSeekBarChangeListener instead of OnSeekBarChangeListener!!!!!\");\n\t\telse\n\t\t\tsuper.setOnSeekBarChangeListener(l);\n        mIsListenerSet = true;\n    }\n     \n\tpublic void setOnBubbleSeekBarChangeListener(OnBubbleSeekBarChangeListener l){\n\t\tthis.mOnBubbleSeekBarChangeListener = l;\n\t}\n\t\n\tpublic interface OnBubbleSeekBarChangeListener{\n\t\tvoid onProgressChanged(SeekBar seekBar, int progress, boolean fromUser);\n\t\t    \n        void onStartTrackingTouch(SeekBar seekBar);\n\t        \n        void onStopTrackingTouch(SeekBar seekBar);\n\t}\n\t\n\tpublic class BubbleIndicator {\n\t\t\n\t\tprivate final WindowManager mWindowManager;\n\t    private boolean mShowing;\n\n\t    private int[] mDrawingLocation = new int[2];\n\t    Point screenSize = new Point();\n\t\tprivate Floater mPopupView;\n\t\t\n\t\tpublic BubbleIndicator(Context context) {\n\t        mWindowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);\n\t        mPopupView = new Floater(context);\n\t   \n\t        DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics();\n\t        screenSize.set(displayMetrics.widthPixels, displayMetrics.heightPixels);\n\t    }\n\t\t\n\t\tpublic void showIndicator(View parent, Rect touchBounds) {\n\t        if (isShowing()) {\n\t            return;\n\t        }\n\n\t        IBinder windowToken = parent.getWindowToken();\n\t        if (windowToken != null) {\n\t            WindowManager.LayoutParams p = createPopupLayout(windowToken);\n\n\t            p.gravity = Gravity.TOP | GravityCompat.START;\n\t            updateLayoutParamsForPosiion(parent, p);\n\t            mShowing = true;\n\n\t            translateViewIntoPosition(touchBounds.centerX());\n\t            invokePopup(p);\n\t        }\n\t    }\n\t\t\n\t\tprivate WindowManager.LayoutParams createPopupLayout(IBinder windowToken) {\n\t        WindowManager.LayoutParams p = new WindowManager.LayoutParams();\n\t        p.gravity = Gravity.START | Gravity.TOP;\n\t        p.width = ViewGroup.LayoutParams.MATCH_PARENT;\n\t        p.height = ViewGroup.LayoutParams.MATCH_PARENT;\n\t        p.format = PixelFormat.TRANSLUCENT;\n\t        p.flags = computeFlags(p.flags);\n\t        p.type = WindowManager.LayoutParams.TYPE_APPLICATION_PANEL;\n\t        p.token = windowToken;\n\t        p.softInputMode = WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN;\n\t        return p;\n\t    }\n\t\t\n\t\tprivate void invokePopup(WindowManager.LayoutParams p) {\n\t        mWindowManager.addView(mPopupView, p);\n\t    }\n\t\t\n\t\tpublic void moveIndicator(Rect touchBounds, int progress) {\n\t\t\tif (!isShowing()) {\n\t            return;\n\t        }\n\t\t\ttranslateViewIntoPosition(touchBounds.centerX());\n\t\t\tmPopupView.setProgressText(progress);\n\t\t}\n\t\t\n\t\tpublic void hideIndicator(){\n\t\t\tif (!isShowing()) {\n\t            return;\n\t        }\n\t\t\tmShowing = false;\n\t\t\tmWindowManager.removeView(mPopupView);\n\t\t}\n\t\t\n\t\tprivate void translateViewIntoPosition(final int x) {\n\t        mPopupView.setFloatOffset(x + mDrawingLocation[0]);\n\t    }\n\t\t\n\t\tprivate void updateLayoutParamsForPosiion(View anchor, WindowManager.LayoutParams p) {\n\t        measureFloater();\n\t        int measuredHeight = mPopupView.getMeasuredHeight();\n\t        anchor.getLocationInWindow(mDrawingLocation);\n\t        p.x = 0;\n\t        p.y = mDrawingLocation[1] - measuredHeight;\n\t        p.width = screenSize.x;\n\t        p.height = measuredHeight;\n\t    }\n\t\t\n\t\tprivate void measureFloater() {\n\t        int specWidth = View.MeasureSpec.makeMeasureSpec(screenSize.x, View.MeasureSpec.EXACTLY);\n\t        int specHeight = View.MeasureSpec.makeMeasureSpec(screenSize.y, View.MeasureSpec.AT_MOST);\n\t        mPopupView.measure(specWidth, specHeight);\n\t    }\n\t\t\n\t\tprivate boolean isShowing() {\n\t\t\treturn mShowing;\n\t\t}\n\t\t\n\t\tprivate int computeFlags(int curFlags) {\n\t        curFlags &= ~(\n\t                WindowManager.LayoutParams.FLAG_IGNORE_CHEEK_PRESSES |\n\t                        WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE |\n\t                        WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE |\n\t                        WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH |\n\t                        WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS |\n\t                        WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);\n\t        curFlags |= WindowManager.LayoutParams.FLAG_IGNORE_CHEEK_PRESSES;\n\t        curFlags |= WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;\n\t        curFlags |= WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE;\n\t        curFlags |= WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS;\n\t        return curFlags;\n\t    }\n\t\t\n\t}\n\tprivate class Floater extends FrameLayout{\n        public TextView mMarker;\n        private int mOffset;\n\n        public Floater(Context context) {\n            super(context);\n            mMarker = new TextView(context);\n            mMarker.setText(\"0%\");\n            mMarker.setGravity(Gravity.CENTER);\n            mMarker.setBackgroundResource(R.drawable.tooltip_bg);\n            addView(mMarker, new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, Gravity.LEFT | Gravity.TOP));\n        }\n\n        @Override\n        protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {\n            measureChildren(widthMeasureSpec, heightMeasureSpec);\n            int widthSize = MeasureSpec.getSize(widthMeasureSpec);\n            int heightSie = mMarker.getMeasuredHeight();\n            setMeasuredDimension(widthSize, heightSie);\n        }\n\n        @Override\n        protected void onLayout(boolean changed, int l, int t, int r, int b) {\n            int centerDiffX = (mMarker.getMeasuredWidth() - mMarker.getPaddingLeft()) / 2;\n            int offset = mOffset - centerDiffX;\n            mMarker.layout(offset, 0, offset + mMarker.getMeasuredWidth(), mMarker.getMeasuredHeight());\n        }\n\n        public void setFloatOffset(int x) {\n            mOffset = x;\n            int centerDiffX = (mMarker.getMeasuredWidth() - mMarker.getPaddingLeft()) / 2;\n            int offset = mOffset - centerDiffX;\n            mMarker.offsetLeftAndRight(offset - mMarker.getLeft());\n        }\n        \n        public void setProgressText(int progress){\n        \tmMarker.setText(\"\"+progress+\"%\");\n        }\n    }\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/core/widget/MagicCameraView.java",
    "content": "package com.zero.magicshow.core.widget;\n\nimport android.app.Activity;\nimport android.content.Context;\nimport android.graphics.Bitmap;\nimport android.graphics.BitmapFactory;\nimport android.graphics.SurfaceTexture;\nimport android.hardware.Camera;\nimport android.opengl.EGL14;\nimport android.opengl.GLES20;\nimport android.util.AttributeSet;\nimport android.util.Log;\nimport android.view.SurfaceHolder;\n\nimport com.zero.magicshow.common.base.MagicBaseView;\nimport com.zero.magicshow.common.iface.GravityCallBack;\nimport com.zero.magicshow.common.utils.CameraBitmapUtil;\nimport com.zero.magicshow.common.utils.GravityUtil;\nimport com.zero.magicshow.common.utils.MagicParams;\nimport com.zero.magicshow.common.utils.OpenGlUtils;\nimport com.zero.magicshow.common.utils.Rotation;\nimport com.zero.magicshow.common.utils.SavePictureTask;\nimport com.zero.magicshow.common.utils.TextureRotationUtil;\nimport com.zero.magicshow.core.camera.CameraEngine;\nimport com.zero.magicshow.core.camera.utils.CameraInfo;\nimport com.zero.magicshow.core.encoder.video.TextureMovieEncoder;\nimport com.zero.magicshow.core.filter.advanced.MagicBeautyFilter;\nimport com.zero.magicshow.core.filter.base.MagicCameraInputFilter;\nimport com.zero.magicshow.core.filter.base.gpuimage.GPUImageFilter;\nimport com.zero.magicshow.core.filter.utils.MagicFilterType;\n\nimport java.io.File;\nimport java.nio.ByteBuffer;\nimport java.nio.ByteOrder;\nimport java.nio.FloatBuffer;\nimport java.nio.IntBuffer;\n\nimport javax.microedition.khronos.egl.EGLConfig;\nimport javax.microedition.khronos.opengles.GL10;\n\n/**\n * Created by why8222 on 2016/2/25.\n */\npublic class MagicCameraView extends MagicBaseView {\n\n    private MagicCameraInputFilter cameraInputFilter;\n    private MagicBeautyFilter beautyFilter;\n\n    private SurfaceTexture surfaceTexture;\n\n    public MagicCameraView(Context context) {\n        this(context, null);\n    }\n\n    private boolean recordingEnabled;\n    private int recordingStatus;\n\n    private static final int RECORDING_OFF = 0;\n    private static final int RECORDING_ON = 1;\n    private static final int RECORDING_RESUMED = 2;\n    private static TextureMovieEncoder videoEncoder = new TextureMovieEncoder();\n\n    private File outputFile;\n    private int afterShootDegree = 90;//默认必须是90,为什么？不告诉你\n    private int frontShootDegree = -90;//默认必须是90,为什么？不告诉你\n\n    public MagicCameraView(Context context, AttributeSet attrs) {\n        super(context, attrs);\n        this.getHolder().addCallback(this);\n        outputFile = new File(MagicParams.videoPath,MagicParams.videoName);\n        recordingStatus = -1;\n        recordingEnabled = false;\n        scaleType = ScaleType.CENTER_CROP;\n        GravityUtil.getInstance().init(getContext(),gravityCallBack);\n        GravityUtil.getInstance().start((Activity) getContext());\n        setZOrderOnTop(true);\n        setZOrderMediaOverlay(true);\n    }\n    private GravityCallBack gravityCallBack = new GravityCallBack() {\n        @Override\n        public void onGravityChange(int direction) {\n            Log.e(\"HongLi\",\"direction:\" + direction);\n            if(direction == GravityUtil.DIRECTION_LAND_LEFT){\n                afterShootDegree = 0;\n            }else if(direction == GravityUtil.DIRECTION_LAND_RIGHT){\n                afterShootDegree = 0;\n            }else if(direction == GravityUtil.DIRECTION_PORTRAIT_POSITIVE){\n                afterShootDegree = 90;\n            }else if(direction == GravityUtil.DIRECTION_PORTRAIT_NEGATIVE){\n                afterShootDegree = -90;\n            }\n        }\n    };\n    @Override\n    public void onSurfaceCreated(GL10 gl, EGLConfig config) {\n        super.onSurfaceCreated(gl, config);\n        recordingEnabled = videoEncoder.isRecording();\n        if (recordingEnabled)\n            recordingStatus = RECORDING_RESUMED;\n        else\n            recordingStatus = RECORDING_OFF;\n        if(cameraInputFilter == null)\n            cameraInputFilter = new MagicCameraInputFilter();\n        cameraInputFilter.init();\n        if (textureId == OpenGlUtils.NO_TEXTURE) {\n            textureId = OpenGlUtils.getExternalOESTextureID();\n            if (textureId != OpenGlUtils.NO_TEXTURE) {\n                surfaceTexture = new SurfaceTexture(textureId);\n                surfaceTexture.setOnFrameAvailableListener(onFrameAvailableListener);\n            }\n        }\n    }\n\n    @Override\n    public void onSurfaceChanged(GL10 gl, int width, int height) {\n        super.onSurfaceChanged(gl, width, height);\n        openCamera();\n    }\n    @Override\n    public void onDrawFrame(GL10 gl) {\n        super.onDrawFrame(gl);\n        if(surfaceTexture == null)\n            return;\n        surfaceTexture.updateTexImage();\n        if (recordingEnabled) {\n            switch (recordingStatus) {\n                case RECORDING_OFF:\n                    CameraInfo info = CameraEngine.getCameraInfo();\n                    if(null == info){\n                        return;\n                    }\n                    videoEncoder.setPreviewSize(info.previewWidth, info.pictureHeight);\n                    videoEncoder.setTextureBuffer(gLTextureBuffer);\n                    videoEncoder.setCubeBuffer(gLCubeBuffer);\n                    videoEncoder.startRecording(new TextureMovieEncoder.EncoderConfig(\n                            outputFile, info.previewWidth, info.pictureHeight,\n                            1000000, EGL14.eglGetCurrentContext(),\n                            info));\n                    recordingStatus = RECORDING_ON;\n                    break;\n                case RECORDING_RESUMED:\n                    videoEncoder.updateSharedContext(EGL14.eglGetCurrentContext());\n                    recordingStatus = RECORDING_ON;\n                    break;\n                case RECORDING_ON:\n                    break;\n                default:\n                    throw new RuntimeException(\"unknown status \" + recordingStatus);\n            }\n        } else {\n            switch (recordingStatus) {\n                case RECORDING_ON:\n                case RECORDING_RESUMED:\n                    videoEncoder.stopRecording();\n                    recordingStatus = RECORDING_OFF;\n                    break;\n                case RECORDING_OFF:\n                    break;\n                default:\n                    throw new RuntimeException(\"unknown status \" + recordingStatus);\n            }\n        }\n        float[] mtx = new float[16];\n        surfaceTexture.getTransformMatrix(mtx);\n        cameraInputFilter.setTextureTransformMatrix(mtx);\n        int id = textureId;\n        if(filter == null){\n            cameraInputFilter.onDrawFrame(textureId, gLCubeBuffer, gLTextureBuffer);\n        }else{\n            id = cameraInputFilter.onDrawToTexture(textureId);\n            filter.onDrawFrame(id, gLCubeBuffer, gLTextureBuffer);\n        }\n        videoEncoder.setTextureId(id);\n        videoEncoder.frameAvailable(surfaceTexture);\n    }\n\n    private SurfaceTexture.OnFrameAvailableListener onFrameAvailableListener = new SurfaceTexture.OnFrameAvailableListener() {\n\n        @Override\n        public void onFrameAvailable(SurfaceTexture surfaceTexture) {\n            requestRender();\n        }\n    };\n\n    @Override\n    public void setFilter(MagicFilterType type) {\n        super.setFilter(type);\n        videoEncoder.setFilter(type);\n    }\n\n    private void openCamera(){\n        if(CameraEngine.getCamera() == null)\n            CameraEngine.openCamera();\n        CameraInfo info = CameraEngine.getCameraInfo();\n        if(info == null){\n            return;\n        }\n        if(info.orientation == 90 || info.orientation == 270){\n            imageWidth = info.previewHeight;\n            imageHeight = info.previewWidth;\n        }else{\n            imageWidth = info.previewWidth;\n            imageHeight = info.previewHeight;\n        }\n        cameraInputFilter.onInputSizeChanged(imageWidth, imageHeight);\n        adjustSize(info.orientation, info.isFront, true);\n        if(surfaceTexture != null)\n            CameraEngine.startPreview(surfaceTexture);\n    }\n\n    @Override\n    public void surfaceDestroyed(SurfaceHolder holder) {\n        super.surfaceDestroyed(holder);\n        CameraEngine.releaseCamera(true);\n    }\n\n    public void changeRecordingState(boolean isRecording) {\n        recordingEnabled = isRecording;\n    }\n\n    protected void onFilterChanged(){\n        super.onFilterChanged();\n        cameraInputFilter.onDisplaySizeChanged(surfaceWidth, surfaceHeight);\n        if(filter != null)\n            cameraInputFilter.initCameraFrameBuffer(imageWidth, imageHeight);\n        else\n            cameraInputFilter.destroyFramebuffers();\n    }\n\n    @Override\n    public void savePicture(final SavePictureTask savePictureTask) {\n        final long startTakeTime = System.nanoTime() / 1000000;\n        CameraEngine.takePicture(null, null, new Camera.PictureCallback() {\n            @Override\n            public void onPictureTaken(byte[] data, Camera camera) {\n                CameraEngine.stopPreview();\n//                CameraEngine.releaseCamera();\n                final Bitmap bitmap = BitmapFactory.decodeByteArray(data, 0, data.length);\n                Log.e(\"HongLi\",\"end take:\" + (System.nanoTime() / 1000000 - startTakeTime) + \";recycler:\" + bitmap.isRecycled());\n                queueEvent(new Runnable() {\n                    @Override\n                    public void run() {\n                        final long startDrawTime = System.nanoTime() / 1000000;\n                        Log.e(\"HongLi\", \"before drawPhoto bitmap:\" + bitmap.isRecycled());\n                        final Bitmap photo = drawPhoto(bitmap,null != CameraEngine.getCameraInfo() && CameraEngine.getCameraInfo().isFront);\n                        Log.e(\"HongLi\",\"end darw:\" + (System.nanoTime() / 1000000 - startDrawTime));\n                        GLES20.glViewport(0, 0, surfaceWidth, surfaceHeight);\n                        if (photo != null){\n                            savePictureTask.execute(photo);\n                        }\n                        CameraEngine.releaseCamera(true);\n                    }\n                });\n//                CameraEngine.startPreview();\n//                CameraEngine.releaseCamera();\n            }\n        });\n    }\n\n    private Bitmap drawPhoto(Bitmap bitmap,boolean isRotated){\n//        if(afterShootDegree != 0 && !isRotated){\n//            //需要旋转角度\n//            Log.e(\"HongLi\",\"需要旋转:\" + afterShootDegree);\n//            bitmap = BaseUtil.rotateBitmapByDegree(bitmap,afterShootDegree);\n//        }else if(frontShootDegree !=0 && isRotated){\n//            Log.e(\"HongLi\",\"需要旋转:\" + frontShootDegree);\n//            bitmap = BaseUtil.rotateBitmapByDegree(bitmap,frontShootDegree);\n//        }\n        bitmap = CameraBitmapUtil.handlerCameraBitmap((Activity) getContext(), bitmap, CameraEngine.cameraID);\n//        BaseUtil.saveBitmap(bitmap,\"/sdcard/DCIM/test3.jpg\");\n        final int width = bitmap.getWidth();\n        final int height = bitmap.getHeight();\n        Log.e(\"HongLi\",\"width:\" + width + \";height:\" + height + \";is recycler:\" + bitmap.isRecycled());\n        final int[] mFrameBuffers = new int[1];\n        final int[] mFrameBufferTextures = new int[1];\n//        if(beautyFilter == null)\n//            beautyFilter = new MagicBeautyFilter();\n        //TODO 此处不需要任何滤镜，只是使用父类即可\n        GPUImageFilter beautyFilter = new GPUImageFilter();\n        beautyFilter.init();\n        beautyFilter.onDisplaySizeChanged(width, height);\n        beautyFilter.onInputSizeChanged(width, height);\n\n        if(filter != null) {\n            filter.onInputSizeChanged(width, height);\n            filter.onDisplaySizeChanged(width, height);\n        }\n        GLES20.glGenFramebuffers(1, mFrameBuffers, 0);\n        GLES20.glGenTextures(1, mFrameBufferTextures, 0);\n        GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mFrameBufferTextures[0]);\n        GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, width, height, 0,\n                GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, null);\n        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n                GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);\n        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n                GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);\n        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n                GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);\n        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,\n                GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);\n\n        final int textureId = OpenGlUtils.loadTexture(bitmap, OpenGlUtils.NO_TEXTURE, true);\n\n        FloatBuffer gLCubeBuffer = ByteBuffer.allocateDirect(TextureRotationUtil.CUBE.length * 4)\n                .order(ByteOrder.nativeOrder())\n                .asFloatBuffer();\n        FloatBuffer gLTextureBuffer = ByteBuffer.allocateDirect(TextureRotationUtil.TEXTURE_NO_ROTATION.length * 4)\n                .order(ByteOrder.nativeOrder())\n                .asFloatBuffer();\n        gLCubeBuffer.put(TextureRotationUtil.CUBE).position(0);\n//        if(isRotated)\n//            gLTextureBuffer.put(TextureRotationUtil.getRotation(Rotation.NORMAL, false, false)).position(0);\n//        else\n//            gLTextureBuffer.put(TextureRotationUtil.getRotation(Rotation.NORMAL, false, true)).position(0);\n        gLTextureBuffer.put(TextureRotationUtil.getRotation(Rotation.NORMAL, false, true)).position(0);\n\n        GLES20.glViewport(0, 0, width, height);\n        GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, mFrameBuffers[0]);\n        GLES20.glFramebufferTexture2D(GLES20.GL_FRAMEBUFFER, GLES20.GL_COLOR_ATTACHMENT0,\n                GLES20.GL_TEXTURE_2D, mFrameBufferTextures[0], 0);\n        if(filter == null){\n            beautyFilter.onDrawFrame(textureId, gLCubeBuffer, gLTextureBuffer);\n        }else{\n            beautyFilter.onDrawFrame(textureId);\n            GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, 0);\n\n            GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, mFrameBuffers[0]);\n            GLES20.glFramebufferTexture2D(GLES20.GL_FRAMEBUFFER, GLES20.GL_COLOR_ATTACHMENT0,\n                    GLES20.GL_TEXTURE_2D, mFrameBufferTextures[0], 0);\n            filter.onDrawFrame(mFrameBufferTextures[0], gLCubeBuffer, gLTextureBuffer);\n        }\n        final IntBuffer ib = IntBuffer.allocate(width * height);\n        GLES20.glReadPixels(0, 0, width, height, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, ib);\n        Bitmap result = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);\n        result.copyPixelsFromBuffer(ib);\n\n        GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, 0);\n        GLES20.glDeleteTextures(1, new int[]{textureId}, 0);\n        GLES20.glDeleteFramebuffers(mFrameBuffers.length, mFrameBuffers, 0);\n        GLES20.glDeleteTextures(mFrameBufferTextures.length, mFrameBufferTextures, 0);\n        beautyFilter.destroy();\n        beautyFilter = null;\n        if(filter != null) {\n            filter.onDisplaySizeChanged(surfaceWidth, surfaceHeight);\n            filter.onInputSizeChanged(imageWidth, imageHeight);\n        }\n//        result = BaseUtil.rotateBitmapByDegree(result,-afterShootDegree);\n        return result;\n    }\n\n    public void onBeautyLevelChanged() {\n        cameraInputFilter.onBeautyLevelChanged();\n    }\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/core/widget/MagicImageView.java",
    "content": "package com.zero.magicshow.core.widget;\n\nimport android.content.Context;\nimport android.graphics.Bitmap;\nimport android.util.AttributeSet;\nimport android.util.Log;\n\nimport com.zero.magicshow.core.beautify.MagicJni;\nimport com.zero.magicshow.core.filter.advanced.MagicImageAdjustFilter;\nimport com.zero.magicshow.core.filter.base.gpuimage.GPUImageFilter;\nimport com.zero.magicshow.core.filter.utils.MagicFilterType;\nimport com.zero.magicshow.common.utils.SavePictureTask;\nimport com.zero.magicshow.common.utils.OpenGlUtils;\nimport com.zero.magicshow.common.base.MagicBaseView;\n\nimport java.nio.ByteBuffer;\n\nimport javax.microedition.khronos.egl.EGLConfig;\nimport javax.microedition.khronos.opengles.GL10;\n\n/**\n * Created by why8222 on 2016/2/25.\n */\npublic class MagicImageView extends MagicBaseView{\n\n    private final GPUImageFilter imageInput;\n\n    private ByteBuffer _bitmapHandler = null;\n\n    private Bitmap originBitmap = null;\n\n    public MagicImageView(Context context) {\n        this(context, null);\n    }\n\n    public MagicImageView(Context context, AttributeSet attrs) {\n        super(context, attrs);\n        imageInput = new GPUImageFilter();\n    }\n\n    @Override\n    public void onSurfaceCreated(GL10 gl, EGLConfig config) {\n        super.onSurfaceCreated(gl, config);\n        imageInput.init();\n    }\n\n    @Override\n    public void onSurfaceChanged(GL10 gl, int width, int height) {\n        super.onSurfaceChanged(gl, width, height);\n        adjustSize(0, false, false);\n    }\n\n    @Override\n    public void onDrawFrame(GL10 gl) {\n        super.onDrawFrame(gl);\n        if(textureId == OpenGlUtils.NO_TEXTURE)\n            textureId = OpenGlUtils.loadTexture(getBitmap(), OpenGlUtils.NO_TEXTURE);\n        if(filter == null)\n            imageInput.onDrawFrame(textureId, gLCubeBuffer, gLTextureBuffer);\n        else\n            filter.onDrawFrame(textureId, gLCubeBuffer, gLTextureBuffer);\n    }\n\n    @Override\n    public void savePicture(SavePictureTask savePictureTask) {\n//        String tempFilePath = BaseUtil.getRandomTempImagePath();\n//        BaseUtil.saveBitmap(originBitmap, BaseUtil.getRandomTempImagePath());\n        savePictureTask.execute(originBitmap);\n    }\n\n    //还原\n    public void restore(){\n        if(filter != null){\n            setFilter(MagicFilterType.NONE);\n        }else{\n            setImageBitmap(originBitmap);\n        }\n    }\n\n    //应用\n    public void commit(){\n        if(filter != null){\n            getBitmapFromGL(originBitmap, false);\n            deleteTextures();\n            setFilter(MagicFilterType.NONE);\n        }else if(null != _bitmapHandler){\n            originBitmap.recycle();\n            originBitmap = MagicJni.jniGetBitmapFromStoredBitmapData(_bitmapHandler);\n        }\n    }\n\n    protected void onGetBitmapFromGL(Bitmap bitmap){\n        originBitmap = bitmap;\n        storeBitmap(originBitmap, false);\n    }\n\n    protected void storeBitmap(Bitmap bitmap,boolean recyle){\n//        if(_bitmapHandler != null)\n//            freeBitmap();\n//        _bitmapHandler = MagicJni.jniStoreBitmapData(bitmap);\n        setImageBitmap(bitmap);\n        if(recyle)\n            bitmap.recycle();\n    }\n\n    public void setImageBitmap(Bitmap bitmap) {\n        if (bitmap == null || bitmap.isRecycled())\n            return;\n        Log.e(\"HongLi\",\"imageWidth:\" + bitmap.getWidth() + \";imageHeight:\" + bitmap.getHeight());\n        setBitmap(bitmap);\n        imageWidth = bitmap.getWidth();\n        imageHeight = bitmap.getHeight();\n        adjustSize(0, false, false);\n        requestRender();\n    }\n\n    public void initMagicBeautify(){\n        if(_bitmapHandler == null){\n            Log.e(\"MagicSDK\", \"please storeBitmap first!!\");\n            return;\n        }\n        MagicJni.jniInitMagicBeautify(_bitmapHandler);\n    }\n\n    public void uninitMagicBeautify(){\n        if(_bitmapHandler == null){\n            Log.e(\"MagicSDK\", \"please storeBitmap first!!\");\n            return;\n        }\n        MagicJni.jniUnInitMagicBeautify();\n    }\n\n    public void setBitmap(Bitmap bitmap){\n        if(_bitmapHandler != null)\n            freeBitmap();\n        _bitmapHandler = MagicJni.jniStoreBitmapData(bitmap);\n        originBitmap = bitmap;\n    }\n\n    public void freeBitmap(){\n        if(_bitmapHandler == null)\n            return;\n        MagicJni.jniFreeBitmapData(_bitmapHandler);\n        _bitmapHandler = null;\n    }\n\n    public Bitmap getBitmap(){\n        if(_bitmapHandler == null)\n            return null;\n        return MagicJni.jniGetBitmapFromStoredBitmapData(_bitmapHandler);\n    }\n\n    public void setSkinSmooth(float level){\n        if(_bitmapHandler == null)\n            return;\n        if(level > 10 || level < 0){\n            Log.e(\"MagicSDK\",\"Skin Smooth level must in [0,10]\");\n            return;\n        }\n        MagicJni.jniStartSkinSmooth(level);\n        reftreshDisplay();\n        if(magicListener != null)\n            magicListener.onEnd();\n    }\n\n    public void setWhiteSkin(float level){\n        if(_bitmapHandler == null)\n            return;\n        if(level > 5 || level < 0){\n            Log.e(\"MagicSDK\",\"Skin white level must in [1,5]\");\n            return;\n        }\n//        long startTime = System.nanoTime() / 1000000;\n//        Log.e(\"HongLi\",\"before jni:\" + 0);\n        MagicJni.jniStartWhiteSkin(level);\n//        BaseUtil.saveBitmap(originBitmap,\"/sdcard/DCIM/test2.jpg\");\n//        Log.e(\"HongLi\",\"end jni:\" + (System.nanoTime() / 1000000 - startTime));\n        reftreshDisplay();\n//        Log.e(\"HongLi\",\"end refresh:\" + (System.nanoTime() / 1000000 - startTime));\n        if(magicListener != null)\n            magicListener.onEnd();\n    }\n\n    public void adjustFilter(float range,MagicFilterType type){\n        if(!(filter instanceof MagicImageAdjustFilter)){\n            return;\n        }\n        ((MagicImageAdjustFilter)filter).setImageFilter(range,type);\n        requestRender();\n//        reftreshDisplay();\n    }\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/core/widget/TwoLineSeekBar.java",
    "content": "package com.zero.magicshow.core.widget;\n\nimport android.content.Context;\nimport android.graphics.Canvas;\nimport android.graphics.Color;\nimport android.graphics.Paint;\nimport android.graphics.Rect;\nimport android.util.AttributeSet;\nimport android.view.GestureDetector;\nimport android.view.MotionEvent;\nimport android.view.View;\nimport android.widget.Scroller;\n\nimport com.zero.magicshow.R;\n\nimport java.util.Map;\nimport java.util.TreeMap;\n\npublic class TwoLineSeekBar extends View {\n    private float mDefaultAreaRadius = 0.0f;\n    private OnSeekDefaultListener mDefaultListener;\n    private OnSeekDownListener mDownListener;\n    private GestureDetector mGestureDetector;\n    private SeekBarGestureListener mGestureListener;\n    private Paint mHighLightLinePaint;\n    private Paint mLinePaint1;\n    private Paint mLinePaint2;\n    private OnSeekChangeListener mListener;\n    private float mNailOffset;\n    private Paint mNailPaint;\n    private Map<String, Integer> mSavedColors;\n    private Scroller mScroller;\n    private float mSeekLength;\n    private float mSeekLineEnd;\n    private float mSeekLineStart;\n    private int mStartValue;\n    private float mStep;\n    private float mThumbOffset;\n    private Paint mThumbPaint;\n    private float mThumbRadius = 8.0f;\n    private float mNailRadius = 5.0f;\n    private float mNailStrokeWidth = 0.0f;\n    private float mLineWidth = 0.0f;\n    private int mMaxValue = 0x64;\n    private int mCurrentValue = 0x32;\n    private int mDefaultValue = 0x32;\n    private boolean mEnableTouch = true;\n    private Rect mCircleRect = new Rect();\n    private boolean mIsGlobalDrag = true;\n    private boolean mIsTouchCircle = false;\n    private boolean mSupportSingleTap = true;\n    \n    public TwoLineSeekBar(Context context, AttributeSet attrs) {\n        super(context, attrs);\n        mThumbRadius = dpToPixel(mThumbRadius);\n        mNailRadius = dpToPixel(mNailRadius);\n        mNailStrokeWidth = context.getResources().getDimension(R.dimen.seekbar_nail_stroke_width);\n        mLineWidth = context.getResources().getDimension(R.dimen.seekbar_line_width);\n        mDefaultAreaRadius = ((((mThumbRadius - mNailRadius) - mNailStrokeWidth) + mThumbRadius) / 2.0f);\n        init();\n    }\n    \n    private void init() {\n        mScroller = new Scroller(getContext());\n        mGestureListener = new SeekBarGestureListener();\n        mGestureDetector = new GestureDetector(getContext(), mGestureListener);\n        mNailPaint = new Paint();\n        mNailPaint.setAntiAlias(true);\n        mNailPaint.setColor(Color.parseColor(\"#ffd600\"));\n        mNailPaint.setStrokeWidth(mNailStrokeWidth);\n        mNailPaint.setStyle(Paint.Style.STROKE);\n        mThumbPaint = new Paint();\n        mThumbPaint.setAntiAlias(true);\n        mThumbPaint.setColor(Color.parseColor(\"#ffffff\"));\n        mThumbPaint.setStyle(Paint.Style.FILL);\n        mLinePaint1 = new Paint();\n        mLinePaint1.setAntiAlias(true);\n        mLinePaint1.setColor(Color.parseColor(\"#ffffff\"));\n        mLinePaint1.setAlpha(0xc8);\n        mLinePaint2 = new Paint();\n        mLinePaint2.setAntiAlias(true);\n        mLinePaint2.setColor(Color.parseColor(\"#ffffff\"));\n        mLinePaint2.setAlpha(0xc8);\n        mHighLightLinePaint = new Paint();\n        mHighLightLinePaint.setAntiAlias(true);\n        mHighLightLinePaint.setColor(Color.parseColor(\"#ffd600\"));\n        mHighLightLinePaint.setAlpha(0xc8);\n        mSupportSingleTap = true;\n    }\n    \n    public float dpToPixel(float dp) {\n        return (getResources().getDisplayMetrics().density * dp);\n    }\n    \n    public void setSingleTapSupport(boolean support) {\n        mSupportSingleTap = support;\n    }\n    \n    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {\n        int hmode = MeasureSpec.getMode(heightMeasureSpec);\n        if(hmode == -0x8000) {\n            int hsize = Math.round((mThumbRadius * 2.0f));\n            hsize += (getPaddingTop() + getPaddingBottom());\n            int wsize = MeasureSpec.getSize(widthMeasureSpec);\n            setMeasuredDimension(wsize, hsize);\n            return;\n        }\n        super.onMeasure(widthMeasureSpec, heightMeasureSpec);\n    }\n    \n    protected void onDraw(Canvas canvas) {\n        if(mSeekLength == 0) {\n            int width = getWidth();\n            mSeekLength = ((float)((width - getPaddingLeft()) - getPaddingRight()) - (mThumbRadius * 2.0f));\n            mSeekLineStart = ((float)getPaddingLeft() + mThumbRadius);\n            mSeekLineEnd = ((float)(width - getPaddingRight()) - mThumbRadius);\n            int currValue = Math.max(0x0, mCurrentValue);\n            mNailOffset = ((mSeekLength * (float)mDefaultValue) / (float)mMaxValue);\n            if((mDefaultValue == 0) || (mDefaultValue == mMaxValue)) {\n                mThumbOffset = ((mSeekLength * (float)currValue) / (float)mMaxValue);\n            } else {\n                float defaultAreaLength = mDefaultAreaRadius * 2.0f;\n                if(currValue < mDefaultValue) {\n                    mThumbOffset = (((mSeekLength - defaultAreaLength) * (float)currValue) / (float)mMaxValue);\n                } else if(currValue > mDefaultValue) {\n                    mThumbOffset = ((((mSeekLength - defaultAreaLength) * (float)currValue) / (float)mMaxValue) + (mDefaultAreaRadius * 2.0f));\n                } else {\n                    mThumbOffset = mNailOffset;\n                }\n            }\n        }\n        float top = (float)(getMeasuredHeight() / 0x2) - (mLineWidth / 2.0f);\n        float bottom = top + mLineWidth;\n        float right1 = ((mSeekLineStart + mNailOffset) + (mNailStrokeWidth / 2.0f)) - mNailRadius;\n        if(right1 > mSeekLineStart) {\n            canvas.drawRect(mSeekLineStart, top, right1, bottom, mLinePaint1);\n        }\n        float left2 = right1 + (mNailRadius * 2.0f);\n        if(mSeekLineEnd > left2) {\n            canvas.drawRect(left2, top, mSeekLineEnd, bottom, mLinePaint2);\n        }\n        float nailX = mSeekLineStart + mNailOffset;\n        float nailY = (float)(getMeasuredHeight() / 0x2);\n        canvas.drawCircle(nailX, nailY, mNailRadius, mNailPaint);\n        float thumbX = mSeekLineStart + mThumbOffset;\n        float thumbY = (float)(getMeasuredHeight() / 0x2);\n        float highLightLeft = thumbX + mThumbRadius;\n        float highLightRight = nailX - mNailRadius;\n        if(thumbX > nailX) {\n            highLightLeft = nailX + mNailRadius;\n            highLightRight = thumbX - mThumbRadius;\n        }\n        canvas.drawRect(highLightLeft, top, highLightRight, bottom, mHighLightLinePaint);\n        canvas.drawCircle(thumbX, thumbY, mThumbRadius, mThumbPaint);\n        mCircleRect.top = (int)(thumbY - mThumbRadius);\n        mCircleRect.left = (int)(thumbX - mThumbRadius);\n        mCircleRect.right = (int)(mThumbRadius + thumbX);\n        mCircleRect.bottom = (int)(mThumbRadius + thumbY);\n        if(mScroller.computeScrollOffset()) {\n            mThumbOffset = (float)mScroller.getCurrY();\n            invalidate();\n        }\n        super.onDraw(canvas);\n    }\n    \n    public boolean onTouchEvent(MotionEvent event) {\n        if(event.getAction() == 0) {\n            if(!mIsGlobalDrag) {\n                mIsTouchCircle = mCircleRect.contains((int)event.getX(), (int)event.getY());\n            }\n        }\n        if((!mIsGlobalDrag) && (!mIsTouchCircle)) {\n            return true;\n        }\n        if(mEnableTouch) {\n            if(!mGestureDetector.onTouchEvent(event)) {\n                if((0x1 == event.getAction()) || (0x3 == event.getAction())) {\n                    mIsTouchCircle = false;\n                    mGestureListener.onUp(event);\n                    if(mListener != null) {\n                        mListener.onSeekStopped(((float)(mCurrentValue + mStartValue) * mStep), mStep);\n                    }\n                    return true;\n                }\n                return false;\n            }\n        }\n        return true;\n    }\n    \n    public void setLineColor(String color) {\n        mHighLightLinePaint.setColor(Color.parseColor(color));\n        mNailPaint.setColor(Color.parseColor(color));\n        invalidate();\n    }\n    \n    public void setBaseLineColor(String color) {\n        mLinePaint1.setColor(Color.parseColor(color));\n        mLinePaint2.setColor(Color.parseColor(color));\n    }\n    \n    public void setThumbColor(String color) {\n        mThumbPaint.setColor(Color.parseColor(color));\n    }\n    \n    public void setEnabled(boolean enabled) {\n        if(enabled == isEnabled()) {\n            return;\n        }\n        super.setEnabled(enabled);\n        mEnableTouch = enabled;\n        if(mSavedColors == null) {\n            mSavedColors = new TreeMap<String, Integer>();\n        }\n        if(enabled) {\n            int color = (Integer)mSavedColors.get(\"mNailPaint\").intValue();\n            mNailPaint.setColor(color);\n            color = (Integer)mSavedColors.get(\"mThumbPaint\").intValue();\n            mThumbPaint.setColor(color);\n            color = (Integer)mSavedColors.get(\"mLinePaint1\").intValue();\n            mLinePaint1.setColor(color);\n            color = (Integer)mSavedColors.get(\"mLinePaint2\").intValue();\n            mLinePaint2.setColor(color);\n            color = (Integer)mSavedColors.get(\"mHighLightLinePaint\").intValue();\n            mHighLightLinePaint.setColor(color);\n            return;\n        }\n        mSavedColors.put(\"mNailPaint\", Integer.valueOf(mNailPaint.getColor()));\n        mSavedColors.put(\"mThumbPaint\", Integer.valueOf(mThumbPaint.getColor()));\n        mSavedColors.put(\"mLinePaint1\", Integer.valueOf(mLinePaint1.getColor()));\n        mSavedColors.put(\"mLinePaint2\", Integer.valueOf(mLinePaint2.getColor()));\n        mSavedColors.put(\"mHighLightLinePaint\", Integer.valueOf(mHighLightLinePaint.getColor()));\n        mNailPaint.setColor(Color.parseColor(\"#505050\"));\n        mThumbPaint.setColor(Color.parseColor(\"#505050\"));\n        mLinePaint1.setColor(Color.parseColor(\"#505050\"));\n        mLinePaint2.setColor(Color.parseColor(\"#505050\"));\n        mHighLightLinePaint.setColor(Color.parseColor(\"#505050\"));\n    }\n    \n    public void setThumbSize(float size) {\n        mThumbRadius = size;\n    }\n    \n    public void setSeekLength(int startValue, int endValue, int circleValue, float step) {\n        mDefaultValue = Math.round(((float)(circleValue - startValue) / step));\n        mMaxValue = Math.round(((float)(endValue - startValue) / step));\n        mStartValue = Math.round(((float)startValue / step));\n        mStep = step;\n    }\n    \n    public void setDefaultValue(float value) {\n        mCurrentValue = (Math.round((value / mStep)) - mStartValue);\n        if(mDefaultListener != null) {\n            mDefaultListener.onSeekDefaulted(value);\n        }\n        updateThumbOffset();\n        invalidate();\n    }\n    \n    public float getValue() {\n        return ((float)(mCurrentValue + mStartValue) * mStep);\n    }\n    \n    public void setValue(float value) {\n        int newValue = Math.round((value / mStep)) - mStartValue;\n        if(newValue == mCurrentValue) {\n            return;\n        }\n        mCurrentValue = newValue;\n        if(mListener != null) {\n            mListener.onSeekChanged((mStep * value), mStep);\n        }\n        updateThumbOffset();\n        postInvalidate();\n    }\n    \n    public void setOnSeekChangeListener(OnSeekChangeListener listener) {\n        mListener = listener;\n    }\n    \n    public OnSeekChangeListener getOnSeekChangeListener() {\n        return mListener;\n    }\n    \n    public void setOnDefaultListener(OnSeekDefaultListener listener) {\n        mDefaultListener = listener;\n    }\n    \n    public void setOnSeekDownListener(OnSeekDownListener listener) {\n        mDownListener = listener;\n    }\n    \n    private void setValueInternal(int value) {\n        if(mCurrentValue == value) {\n            return;\n        }\n        mCurrentValue = value;\n        if(mListener != null) {\n            mListener.onSeekChanged(((float)(mStartValue + value) * mStep), mStep);\n        }\n    }\n    \n    private void updateThumbOffset() {\n        if((mDefaultValue == 0) || (mDefaultValue == mMaxValue)) {\n            if(mCurrentValue <= 0) {\n                mThumbOffset = 0.0f;\n                return;\n            }\n            if(mCurrentValue == mMaxValue) {\n                mThumbOffset = (mSeekLineEnd - mSeekLineStart);\n                return;\n            }\n            if(mCurrentValue == mDefaultValue) {\n                mThumbOffset = mNailOffset;\n                return;\n            }\n            mThumbOffset = (((float)mCurrentValue * mSeekLength) / (float)mMaxValue);\n            return;\n        }\n        float defaultAreaLength = mDefaultAreaRadius * 2.0f;\n        if(mCurrentValue <= 0) {\n            mThumbOffset = 0.0f;\n            return;\n        }\n        if(mCurrentValue == mMaxValue) {\n            mThumbOffset = (mSeekLineEnd - mSeekLineStart);\n            return;\n        }\n        if(mCurrentValue < mDefaultValue) {\n            mThumbOffset = (((mSeekLength - defaultAreaLength) * (float)mCurrentValue) / (float)mMaxValue);\n            return;\n        }\n        if(mCurrentValue > mDefaultValue) {\n            mThumbOffset = ((((mSeekLength - defaultAreaLength) * (float)mCurrentValue) / (float)mMaxValue) + defaultAreaLength);\n            return;\n        }\n        mThumbOffset = mNailOffset;\n    }\n    \n    public void reset() {\n        mSeekLength = 0.0f;\n        mSeekLineStart = 0.0f;\n        mSeekLineEnd = 0.0f;\n        mNailOffset = 0.0f;\n        mThumbOffset = 0.0f;\n        mMaxValue = 0x0;\n        mCurrentValue = 0x7fffffff;\n        mDefaultValue = 0x0;\n        mStartValue = 0x0;\n        mStep = 0.0f;\n        mScroller.abortAnimation();\n    }\n    \n    class SeekBarGestureListener extends GestureDetector.SimpleOnGestureListener {\n    \n\n\t\tpublic boolean onUp(MotionEvent e) {\n            float initThumbOffset = mThumbOffset;\n            updateThumbOffset();\n            mScroller.startScroll(0x0, Math.round(initThumbOffset), 0x0, Math.round((mThumbOffset - initThumbOffset)), 0x0);\n            mThumbOffset = initThumbOffset;\n            invalidate();\n            return true;\n        }\n        \n        public boolean onDown(MotionEvent e) {\n            if(mDownListener != null) {\n                mDownListener.onSeekDown();\n            }\n            return true;\n        }\n        \n        public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {\n        \tmThumbOffset -= distanceX;\n        \tif (mThumbOffset < mSeekLineStart - mThumbRadius) {\n        \t\tmThumbOffset = mSeekLineStart - mThumbRadius;\n        \t}\n    \t\tif (mThumbOffset > mSeekLineEnd - mThumbRadius) {\n    \t\t\tmThumbOffset = mSeekLineEnd - mThumbRadius;\n    \t\t}\n    \t\tfloat newValue;\n    \t\tif (mThumbOffset < mNailOffset - mDefaultAreaRadius) {\n    \t\t\tnewValue = mThumbOffset * (-2 + mMaxValue) / (mSeekLength - 2.0f * mDefaultAreaRadius);\n    \t\t} else if (mThumbOffset > mNailOffset + mDefaultAreaRadius) {\n    \t\t\tnewValue = 1.0F + (mDefaultValue + (mThumbOffset - mNailOffset - mDefaultAreaRadius) * (-2 + mMaxValue) / (mSeekLength - 2.0f * mDefaultAreaRadius));\n    \t\t} else {\n    \t\t\tnewValue = mDefaultValue;\n    \t\t}\n    \t\tif ((mDefaultValue == 0) || (mDefaultValue == mMaxValue)) {\n    \t\t\tnewValue = mThumbOffset * mMaxValue / mSeekLength;\n    \t\t}\n    \t\tif (newValue < 0.0f) {\n    \t\t\tnewValue = 0.0f;\n    \t\t}\n    \t\tif (newValue > mMaxValue) {\n    \t\t\tnewValue = mMaxValue;\n    \t\t}\n    \t\tsetValueInternal(Math.round(newValue));\n    \t\tinvalidate();\n    \t\treturn true;\n        }\n        \n        public boolean onSingleTapUp(MotionEvent e) {\n            if(!mSupportSingleTap) {\n                return false;\n            }\n            int newValue = mCurrentValue - 1;\n            if(e.getX() > mThumbOffset) {\n                newValue = mCurrentValue + 1;\n            }\n            if(newValue < 0) {\n                newValue = 0;\n            }\n            if(newValue > mMaxValue) {\n                newValue = mMaxValue;\n            }\n            setValueInternal(Math.round(newValue));\n            float initThumbOffset = mThumbOffset;\n            updateThumbOffset();\n            mScroller.startScroll(0x0, Math.round(initThumbOffset), 0x0, Math.round((mThumbOffset - initThumbOffset)), 0x190);\n            mThumbOffset = initThumbOffset;\n            postInvalidate();\n            if(mListener != null) {\n                mListener.onSeekStopped(((float)(mCurrentValue + mStartValue) * mStep), mStep);\n            }\n            return true;\n        }\n    }\n    \n    public void setIsGlobalDrag(boolean mIsGlobalDrag) {\n        this.mIsGlobalDrag = mIsGlobalDrag;\n    }\n    \n    public static abstract interface OnSeekDefaultListener{\n    \tpublic abstract void onSeekDefaulted(float value);\n    }\n    \n    public static abstract interface OnSeekDownListener{\n    \tpublic abstract void onSeekDown();\n    }\n    \n    public static abstract interface OnSeekChangeListener{\n    \t\n    \tpublic abstract void onSeekChanged(float value, float step);\n      \n    \tpublic abstract void onSeekStopped(float value, float step);\n    }\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/view/edit/ImageEditFragment.java",
    "content": "package com.zero.magicshow.view.edit;\n\nimport android.support.v4.app.Fragment;\n\nimport com.zero.magicshow.common.iface.DialogYesOrNoCallBack;\nimport com.zero.magicshow.common.utils.BaseUtil;\nimport com.zero.magicshow.core.MagicEngine;\n\npublic abstract class ImageEditFragment extends Fragment {\n\tprotected onHideListener mOnHideListener;\n\n\tpublic void doFinishAction(){\n\t\tif(isChanged()){\n\t\t\tBaseUtil.openYesOrNoDialog(getActivity(), \"是否应用修改？\", \"是否应用修改？\", \"是\", \"否\", new DialogYesOrNoCallBack() {\n\t\t\t\t@Override\n\t\t\t\tpublic void onYesClick() {\n\t\t\t\t\tonDialogButtonClick();\n\t\t\t\t\tMagicEngine.getInstance().commitImage();\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic void onNoClick() {\n\t\t\t\t\tonDialogButtonClick();\n\t\t\t\t\tMagicEngine.getInstance().restoreImage();\n\t\t\t\t}\n\t\t\t});\n\t\t}else if(null != mOnHideListener){\n\t\t\tmOnHideListener.onAfterHide();\n\t\t}\n\t}\n\n\tpublic void doSaveConfigeAction(){\n        if(isChanged()){\n            MagicEngine.getInstance().commitImage();\n        }\n        if(mOnHideListener != null){\n            mOnHideListener.onAfterHide();\n        }\n    }\n\n\tpublic void setOnHideListener(onHideListener l){\n\t\tthis.mOnHideListener = l;\n\t}\n\t\n\tprotected abstract boolean isChanged();\n\t\n\tprotected void onDialogButtonClick(){\n\t\tif(mOnHideListener != null){\n            mOnHideListener.onAfterHide();\n        }\n\t}\n\t\n\tpublic interface onHideListener{\n\t\tvoid onAfterHide();\n\t}\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/view/edit/ImageEditManager.java",
    "content": "package com.zero.magicshow.view.edit;\n\nimport android.content.Context;\nimport android.support.v4.app.Fragment;\nimport android.view.ViewGroup;\n\nimport com.zero.magicshow.R;\nimport com.zero.magicshow.activity.AlbumActivity;\nimport com.zero.magicshow.view.edit.adjust.ImageEditAdjustView;\nimport com.zero.magicshow.view.edit.beauty.ImageEditBeautyView;\nimport com.zero.magicshow.view.edit.filter.ImageEditFilterView;\nimport com.zero.magicshow.view.edit.iface.ImageEditNavListener;\nimport com.zero.magicshow.view.edit.navigation.ImageEditNavigationView;\n\nimport java.util.HashMap;\n\n/**\n * Created by hongli on 2017/8/22.\n */\n\npublic class ImageEditManager {\n    public static void initAdjustView(Context context, HashMap<String,Fragment> fragmentHashMap, ViewGroup blockNavigation,\n                                      ImageEditFragment.onHideListener mOnHideListener, ImageEditNavListener imageEditNavListener){\n        ImageEditAdjustView adjustView = new ImageEditAdjustView();\n        adjustView.setOnHideListener(mOnHideListener);\n        ImageEditNavigationView adjustNavView = ImageEditNavigationView.builder(context)\n                .setIconRes(R.drawable.selector_image_edit)\n                .setName(context.getResources().getString(R.string.edit_edit))\n                .setType(AlbumActivity.IMAGE_EDIT_TYPE_ADJUST)\n                .setListener(imageEditNavListener);\n        fragmentHashMap.put(AlbumActivity.IMAGE_EDIT_TYPE_ADJUST,adjustView);\n        blockNavigation.addView(adjustNavView);\n    }\n\n\n    public static void initBeautyView(Context context, HashMap<String,Fragment> fragmentHashMap, ViewGroup blockNavigation,\n                                      ImageEditFragment.onHideListener mOnHideListener, ImageEditNavListener imageEditNavListener){\n\n        ImageEditBeautyView beautyView = new ImageEditBeautyView();\n        beautyView.setOnHideListener(mOnHideListener);\n        ImageEditNavigationView beautyNavView = ImageEditNavigationView.builder(context)\n                .setIconRes(R.drawable.selector_image_beauty)\n                .setName(context.getResources().getString(R.string.edit_beauty))\n                .setType(AlbumActivity.IMAGE_EDIT_TYPE_BEAUTY)\n                .setListener(imageEditNavListener);\n        fragmentHashMap.put(AlbumActivity.IMAGE_EDIT_TYPE_BEAUTY,beautyView);\n        blockNavigation.addView(beautyNavView);\n    }\n\n    public static void initFilterView(Context context, HashMap<String,Fragment> fragmentHashMap, ViewGroup blockNavigation,\n                                      ImageEditFragment.onHideListener mOnHideListener, ImageEditNavListener imageEditNavListener){\n\n        ImageEditFilterView filterView = new ImageEditFilterView();\n        filterView.setOnHideListener(mOnHideListener);\n        ImageEditNavigationView filterNavView = ImageEditNavigationView.builder(context)\n                .setIconRes(R.drawable.selector_image_filter)\n                .setName(context.getResources().getString(R.string.edit_filter))\n                .setType(AlbumActivity.IMAGE_EDIT_TYPE_FILTER)\n                .setListener(imageEditNavListener);\n        fragmentHashMap.put(AlbumActivity.IMAGE_EDIT_TYPE_FILTER,filterView);\n        blockNavigation.addView(filterNavView);\n    }\n\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/view/edit/adjust/ImageEditAdjustView.java",
    "content": "package com.zero.magicshow.view.edit.adjust;\n\nimport android.os.Bundle;\nimport android.util.Log;\nimport android.view.LayoutInflater;\nimport android.view.View;\nimport android.view.ViewGroup;\nimport android.widget.ImageView;\nimport android.widget.LinearLayout;\nimport android.widget.RadioGroup;\nimport android.widget.RadioGroup.OnCheckedChangeListener;\nimport android.widget.TextView;\n\nimport com.zero.magicshow.R;\nimport com.zero.magicshow.core.MagicEngine;\nimport com.zero.magicshow.core.filter.utils.MagicFilterType;\nimport com.zero.magicshow.view.edit.ImageEditFragment;\nimport com.zero.magicshow.core.widget.TwoLineSeekBar;\nimport com.zero.magicshow.core.widget.TwoLineSeekBar.OnSeekChangeListener;\n\nimport static com.zero.magicshow.core.filter.utils.MagicFilterType.IMAGE_ADJUST;\n\npublic class ImageEditAdjustView extends ImageEditFragment {\n\tprivate TwoLineSeekBar mSeekBar;\n\tprivate float contrast = -50.0f;\n\tprivate float exposure = 0.0f; \n\tprivate float saturation = 0.0f;\n\tprivate float sharpness = 0.0f;\n\tprivate float brightness = 0.0f;\n\tprivate float hue = 0.0f;\n\tprivate RadioGroup mRadioGroup;\n\tprivate MagicFilterType type = MagicFilterType.NONE;\n\tprivate ImageView mLabel;\n\tprivate TextView mVal;\n\tprivate LinearLayout mLinearLayout;\n\t\n\t@Override\n\tpublic View onCreateView(LayoutInflater inflater, ViewGroup container,\n\t\t\tBundle savedInstanceState) {\n\t\treturn inflater.inflate(R.layout.fragment_image_edit_adjust, container, false);  \n\t}\n\n\t@Override\n\tpublic void onViewCreated(View view, Bundle savedInstanceState) {\n\t\tsuper.onViewCreated(view, savedInstanceState);\n\t\tmRadioGroup = (RadioGroup)getView().findViewById(R.id.fragment_adjust_radiogroup);\n\t\tmRadioGroup.setOnCheckedChangeListener(new OnCheckedChangeListener() {\n\t\t\t\n\t\t\t@Override\n\t\t\tpublic void onCheckedChanged(RadioGroup group, int checkedId) {\n\t\t\t\tif(checkedId != -1){\n                    mLinearLayout.setVisibility(View.VISIBLE);\n                }\n                if(checkedId == R.id.fragment_radio_contrast){\n                    type = MagicFilterType.CONTRAST;\n                    mSeekBar.reset();\n                    mSeekBar.setSeekLength(-100, 100, -50, 1);\n                    mSeekBar.setValue(contrast);\n                    mVal.setText(\"\"+contrast);\n                    mLabel.setBackgroundResource(R.drawable.selector_image_edit_adjust_contrast);\n                }else if(checkedId == R.id.fragment_radio_exposure){\n                    type = MagicFilterType.EXPOSURE;\n                    mSeekBar.reset();\n                    mSeekBar.setSeekLength(-100, 100, 0, 1);\n                    mSeekBar.setValue(exposure);\n                    mVal.setText(\"\"+exposure);\n                    mLabel.setBackgroundResource(R.drawable.selector_image_edit_adjust_exposure);\n                }else if(checkedId == R.id.fragment_radio_saturation){\n                    type = MagicFilterType.SATURATION;\n                    mSeekBar.reset();\n                    mSeekBar.setSeekLength(-100, 100, 0, 1);\n                    mSeekBar.setValue(saturation);\n                    mVal.setText(\"\"+saturation);\n                    mLabel.setBackgroundResource(R.drawable.selector_image_edit_adjust_saturation);\n                }else if(checkedId == R.id.fragment_radio_sharpness){\n                    type = MagicFilterType.SHARPEN;\n                    mSeekBar.reset();\n                    mSeekBar.setSeekLength(-100, 100, 0, 1);\n                    mSeekBar.setValue(sharpness);\n                    mVal.setText(\"\"+sharpness);\n                    mLabel.setBackgroundResource(R.drawable.selector_image_edit_adjust_sharpness);\n                }else if(checkedId == R.id.fragment_radio_bright){\n                    type = MagicFilterType.BRIGHTNESS;\n                    mSeekBar.reset();\n                    mSeekBar.setSeekLength(-100, 100, 0, 1);\n                    mSeekBar.setValue(brightness);\n                    mVal.setText(\"\"+brightness);\n                    mLabel.setBackgroundResource(R.drawable.selector_image_edit_adjust_bright);\n                }else if(checkedId == R.id.fragment_radio_hue){\n                    type = MagicFilterType.HUE;\n                    mSeekBar.reset();\n                    mSeekBar.setSeekLength(0, 360, 0, 1);\n                    mSeekBar.setValue(hue);\n                    mVal.setText(\"\"+hue);\n                    mLabel.setBackgroundResource(R.drawable.selector_image_edit_adjust_hue);\n                }\n\t\t\t}\n\t\t});\n\t\tmSeekBar = (TwoLineSeekBar)view.findViewById(R.id.item_seek_bar);\n\t\tmSeekBar.setOnSeekChangeListener(mOnSeekChangeListener);\n\t\tmVal = (TextView)view.findViewById(R.id.item_val);\n\t\tmLabel = (ImageView)view.findViewById(R.id.item_label);\n\t\tmLinearLayout = (LinearLayout)view.findViewById(R.id.seek_bar_item_menu);\n\t\tMagicEngine.getInstance().setFilter(IMAGE_ADJUST);\n        mRadioGroup.getChildAt(0).performClick();\n\t}\n\t\n\t@Override\n\tpublic void onHiddenChanged(boolean hidden) {\n\t\tsuper.onHiddenChanged(hidden);\n\t\tif(hidden){\n\t\t\tcontrast = -50.0f;\n\t\t\texposure = 0.0f; \n\t\t\tsaturation = 0.0f;\n\t\t\tsharpness = 0.0f;\n\t\t\tbrightness = 0.0f;\n\t\t\thue = 0.0f;\n\t\t\tmRadioGroup.clearCheck();\n\t\t\tMagicEngine.getInstance().setFilter(MagicFilterType.NONE);\n\t\t\tmLinearLayout.setVisibility(View.INVISIBLE);\n\t\t\ttype = MagicFilterType.NONE;\n            mRadioGroup.getChildAt(0).performClick();\n\t\t}else{\n\t\t\tMagicEngine.getInstance().setFilter(IMAGE_ADJUST);\n\t\t}\n\t}\n\t\n\tprotected boolean isChanged(){\n\t\treturn contrast != -50.0f || exposure != 0.0f || saturation != 0.0f\n\t\t\t\t|| sharpness != 0.0f || brightness != 0.0f || hue != 0.0f;\n\t}\n    protected float range(final int percentage, final float start, final float end) {\n        return (end - start) * percentage / 100.0f + start;\n    }\n\n    protected int range(final int percentage, final int start, final int end) {\n        return (end - start) * percentage / 100 + start;\n    }\n\tprivate float convertToProgress(float value){\n        if(mRadioGroup.getCheckedRadioButtonId() == R.id.fragment_radio_contrast){\n            contrast = value;\n            return range(Math.round((value + 100) / 2), 0.0f, 4.0f);\n        }else if(mRadioGroup.getCheckedRadioButtonId() == R.id.fragment_radio_exposure){\n            exposure = value;\n            return range(Math.round((value + 100) / 2), -2.0f, 2.0f);\n        }else if(mRadioGroup.getCheckedRadioButtonId() == R.id.fragment_radio_saturation){\n            saturation = value;\n            return range(Math.round((value + 100) / 2), 0.0f, 2.0f);\n        }else if(mRadioGroup.getCheckedRadioButtonId() == R.id.fragment_radio_sharpness){\n            sharpness = value;\n            return range(Math.round((value + 100) / 2), -4.0f, 4.0f);\n        }else if(mRadioGroup.getCheckedRadioButtonId() == R.id.fragment_radio_bright){\n            brightness = value;\n            return range(Math.round((value + 100) / 2), -0.5f, 0.5f);\n        }else if(mRadioGroup.getCheckedRadioButtonId() == R.id.fragment_radio_hue){\n            hue = value;\n            return range(Math.round(100 * value / 360.0f), 0.0f, 360.0f);\n        }\n        return 0;\n\t}\n\t\n\tprivate OnSeekChangeListener mOnSeekChangeListener = new OnSeekChangeListener() {\n\t\t\n\t\t@Override\n\t\tpublic void onSeekStopped(float value, float step) {\n            mVal.setText(\"\"+value);\n            mLabel.setPressed(value != 0.0f);\n            Log.e(\"HongLi\",\"percent:\" + convertToProgress(value));\n            MagicEngine.getInstance().adjustFilter(convertToProgress(value), type);\n\t\t}\n\t\t\n\t\t@Override\n\t\tpublic void onSeekChanged(float value, float step) {\n\t\t}\n\t};\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/view/edit/beauty/ImageEditBeautyView.java",
    "content": "package com.zero.magicshow.view.edit.beauty;\n\nimport android.os.Bundle;\nimport android.view.LayoutInflater;\nimport android.view.View;\nimport android.view.ViewGroup;\nimport android.widget.RadioGroup;\nimport android.widget.RadioGroup.OnCheckedChangeListener;\nimport android.widget.RelativeLayout;\nimport android.widget.SeekBar;\n\nimport com.zero.magicshow.R;\nimport com.zero.magicshow.core.MagicEngine;\nimport com.zero.magicshow.view.edit.ImageEditFragment;\nimport com.zero.magicshow.core.widget.BubbleSeekBar;\n\npublic class ImageEditBeautyView extends ImageEditFragment {\n\n\tprivate RadioGroup mRadioGroup;\n\tprivate RelativeLayout mSkinSmoothView;\n\tprivate RelativeLayout mSkinColorView;\n\tprivate BubbleSeekBar mSmoothBubbleSeekBar;\n\tprivate BubbleSeekBar mWhiteBubbleSeekBar;\n\tprivate boolean isSmoothed = false;\n\tprivate boolean isWhiten = false;\n\n\t@Override\n\tpublic View onCreateView(LayoutInflater inflater, ViewGroup container,\n\t\t\tBundle savedInstanceState) {\n\t\treturn inflater.inflate(R.layout.fragment_image_edit_beauty, container, false);  \n\t}\n\n\t@Override\n\tpublic void onCreate(Bundle savedInstanceState) {\t\t\n\t\tsuper.onCreate(savedInstanceState);\n\t}\n\n\t@Override\n\tpublic void onViewCreated(View view, Bundle savedInstanceState) {\n\t\tmSkinSmoothView = (RelativeLayout) getView().findViewById(R.id.fragment_beauty_skin);\n\t\tmSkinColorView = (RelativeLayout) getView().findViewById(R.id.fragment_beauty_color);\n\t\tmRadioGroup = (RadioGroup)getView().findViewById(R.id.fragment_beauty_radiogroup);\n\t\tmRadioGroup.setOnCheckedChangeListener(new OnCheckedChangeListener() {\n\t\t\t\n\t\t\t@Override\n\t\t\tpublic void onCheckedChanged(RadioGroup group, int checkedId) {\n                if(checkedId == R.id.fragment_beauty_btn_skinsmooth){\n                    mSkinSmoothView.setVisibility(View.VISIBLE);\n                    mSkinColorView.setVisibility(View.GONE);\n                }else if(checkedId == R.id.fragment_beauty_btn_skincolor){\n                    mSkinColorView.setVisibility(View.VISIBLE);\n                    mSkinSmoothView.setVisibility(View.GONE);\n                }\n\t\t\t}\n\t\t});\n\t\tmSmoothBubbleSeekBar = (BubbleSeekBar) view.findViewById(R.id.fragment_beauty_skin_seekbar);\n        mSmoothBubbleSeekBar.setOnBubbleSeekBarChangeListener(mOnSmoothBubbleSeekBarChangeListener);\n\t\tmWhiteBubbleSeekBar = (BubbleSeekBar) view.findViewById(R.id.fragment_beauty_white_seekbar);\n        mWhiteBubbleSeekBar.setOnBubbleSeekBarChangeListener(mOnColorBubbleSeekBarChangeListener);\n\t\tinit();\n\t\tsuper.onViewCreated(view, savedInstanceState);\n\t}\n\t\n\tprivate void init(){\n        MagicEngine.getInstance().initBeauty();\n\t}\n\t\n\t@Override\n\tpublic void onHiddenChanged(boolean hidden) {\n\t\tsuper.onHiddenChanged(hidden);\n\t\tif(!hidden){\n\t\t\tmSmoothBubbleSeekBar.setProgress(0);\n\t\t\tmWhiteBubbleSeekBar.setProgress(0);\n\t\t\tinit();\n\t\t}else{\n\t\t\tMagicEngine.getInstance().uninitBeauty();\n            isWhiten = false;\n            isSmoothed = false;\n\t\t}\n\t}\n\tprivate BubbleSeekBar.OnBubbleSeekBarChangeListener mOnSmoothBubbleSeekBarChangeListener = new BubbleSeekBar.OnBubbleSeekBarChangeListener() {\n\n\t\t@Override\n\t\tpublic void onStopTrackingTouch(final SeekBar seekBar) {\n\t\t\tnew Thread(new Runnable() {\n\n\t\t\t\t@Override\n\t\t\t\tpublic void run() {\n\t\t\t\t\tfloat level = seekBar.getProgress() / 10.0f;\n\t\t\t\t\tif(level < 0)\n\t\t\t\t\t\tlevel = 0;\n                    MagicEngine.getInstance().setSkinSmooth(level);\n\n\t\t\t\t\tif(seekBar.getProgress() != 0)\n\t\t\t\t\t\tisSmoothed = true;\n\t\t\t\t\telse\n\t\t\t\t\t\tisSmoothed = false;\n\t\t\t\t}\n\t\t\t}).start();\n\t\t}\n\n\t\t@Override\n\t\tpublic void onStartTrackingTouch(SeekBar seekBar) {\n\n\t\t}\n\n\t\t@Override\n\t\tpublic void onProgressChanged(SeekBar seekBar, int progress,\n\t\t\t\t\t\t\t\t\t  boolean fromUser) {\n\t\t}\n\t};\n\tprivate BubbleSeekBar.OnBubbleSeekBarChangeListener mOnColorBubbleSeekBarChangeListener = new BubbleSeekBar.OnBubbleSeekBarChangeListener() {\n\n\t\t@Override\n\t\tpublic void onStopTrackingTouch(SeekBar seekBar) {\n\t\t\tfloat level = seekBar.getProgress() / 20.0f;\n\t\t\tif(level < 1)\n\t\t\t\tlevel = 1;\n            MagicEngine.getInstance().setWhiteSkin(level);\n\t\t\tif(seekBar.getProgress() != 0)\n\t\t\t\tisWhiten = true;\n\t\t\telse\n\t\t\t\tisWhiten = false;\n\t\t}\n\n\t\t@Override\n\t\tpublic void onStartTrackingTouch(SeekBar seekBar) {\n\n\t\t}\n\n\t\t@Override\n\t\tpublic void onProgressChanged(SeekBar seekBar, int progress,\n\t\t\t\t\t\t\t\t\t  boolean fromUser) {\n\t\t}\n\t};\n\n\t@Override\n\tprotected boolean isChanged() {\n\t\treturn isWhiten || isSmoothed;\n\t}\n\n\t@Override\n\tprotected void onDialogButtonClick() {\n\t\tsuper.onDialogButtonClick();\n\t\tMagicEngine.getInstance().uninitBeauty();\n\t}\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/view/edit/filter/ImageEditFilterView.java",
    "content": "package com.zero.magicshow.view.edit.filter;\n\nimport android.os.Bundle;\nimport android.support.v7.widget.LinearLayoutManager;\nimport android.support.v7.widget.RecyclerView;\nimport android.view.LayoutInflater;\nimport android.view.View;\nimport android.view.ViewGroup;\nimport android.widget.ImageView;\n\nimport com.zero.magicshow.R;\nimport com.zero.magicshow.adapter.FilterAdapter;\nimport com.zero.magicshow.common.utils.Constants;\nimport com.zero.magicshow.core.MagicEngine;\nimport com.zero.magicshow.core.filter.utils.MagicFilterType;\nimport com.zero.magicshow.view.edit.ImageEditFragment;\n\npublic class ImageEditFilterView extends ImageEditFragment {\n\tprivate RecyclerView recyclerView;\n\tprivate View rootView;\n    private ImageView btnClose,btnFavourite;\n\n    private FilterAdapter filterAdapter;\n\t@Override\n\tpublic View onCreateView(LayoutInflater inflater, ViewGroup container,\n\t\t\tBundle savedInstanceState) {\n\t\trootView = inflater.inflate(R.layout.fragment_image_edit_filter, container, false);\n\t\treturn rootView;\n\t}\n\n\t@Override\n\tpublic void onViewCreated(View view, Bundle savedInstanceState) {\n\t\tsuper.onCreate(savedInstanceState);\n\t\tinit();\n\t}\n\n\tprivate void init(){\n\t\tinitView();\n\t\tinitData();\n\t\tinitListener();\n\t}\n\n\tprivate void initView(){\n\t\trecyclerView\t\t\t= (RecyclerView)rootView.findViewById(R.id.image_edit_filter_recyclerview);\n        btnClose                = (ImageView)rootView.findViewById(R.id.image_edit_filter_close);\n        btnFavourite            = (ImageView)rootView.findViewById(R.id.image_edit_filter_favourite);\n\t}\n\n\tprivate void initData(){\n        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getContext());\n        linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);\n        recyclerView.setLayoutManager(linearLayoutManager);\n\t\tfilterAdapter = new FilterAdapter(getContext(), Constants.FILTER_TYPES);\n        recyclerView.setAdapter(filterAdapter);\n        filterAdapter.setOnFilterChangeListener(onFilterChangeListener);\n\t}\n\n\tprivate void initListener(){\n        btnClose.setOnClickListener(onClickListener);\n        btnFavourite.setOnClickListener(onClickListener);\n\t}\n\n\t@Override\n\tpublic void onHiddenChanged(boolean hidden) {\n        if(!hidden){\n            filterAdapter.refreshList();\n        }\n\t}\n\n\t@Override\n\tprotected boolean isChanged() {\n\t\treturn MagicEngine.getInstance().getFilterType() != MagicFilterType.NONE;\n\t}\n\n    private FilterAdapter.onFilterChangeListener onFilterChangeListener = new FilterAdapter.onFilterChangeListener(){\n\n        @Override\n        public void onFilterChanged(MagicFilterType filterType) {\n//            magicEngine.setFilter(filterType);\n\t\t\tMagicEngine.getInstance().setFilter(filterType);\n        }\n    };\n\n    private void doCloseAction(){\n\n    }\n\n    private void doFavouriteAction(){\n\n    }\n\n    private View.OnClickListener onClickListener = new View.OnClickListener() {\n        @Override\n        public void onClick(View v) {\n            if(v == btnClose){\n                doCloseAction();\n            }else if(v == btnFavourite){\n                doFavouriteAction();\n            }\n        }\n    };\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/view/edit/iface/ImageEditNavListener.java",
    "content": "package com.zero.magicshow.view.edit.iface;\n\nimport android.view.View;\n\n/**\n * Created by hongli on 2017/8/22.\n */\n\npublic interface ImageEditNavListener {\n    public void onClick(View view, String type);\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/view/edit/navigation/ImageEditNavigationView.java",
    "content": "package com.zero.magicshow.view.edit.navigation;\n\nimport android.content.Context;\nimport android.support.annotation.Nullable;\nimport android.util.AttributeSet;\nimport android.view.Gravity;\nimport android.view.View;\nimport android.view.ViewGroup;\nimport android.widget.ImageView;\nimport android.widget.LinearLayout;\nimport android.widget.TextView;\n\nimport com.zero.magicshow.R;\nimport com.zero.magicshow.view.edit.iface.ImageEditNavListener;\nimport com.zero.zerolib.util.BaseUtil;\n\n/**\n * Created by hongli on 2017/8/22.\n */\n\npublic class ImageEditNavigationView extends LinearLayout{\n    private ImageView ivIcon;\n    private TextView tvName;\n\n    private ImageEditNavListener imageEditNavListener;\n    private String type;//导航类型\n    private ImageEditNavigationView(Context context) {\n        super(context);\n        init();\n    }\n\n    public ImageEditNavigationView(Context context, @Nullable AttributeSet attrs) {\n        super(context, attrs);\n        init();\n    }\n\n    public ImageEditNavigationView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {\n        super(context, attrs, defStyleAttr);\n        init();\n    }\n\n    private void init(){\n        initView();\n        initData();\n        initListener();\n    }\n\n    private void initView(){\n        ivIcon = new ImageView(getContext());\n        this.addView(ivIcon);\n        tvName = new TextView(getContext());\n        this.addView(tvName);\n    }\n\n    private void initData(){\n        LayoutParams iconParam = new LayoutParams(BaseUtil.dipToPix(getContext(),25), BaseUtil.dipToPix(getContext(),25));\n        iconParam.gravity = Gravity.CENTER;\n        ivIcon.setLayoutParams(iconParam);\n        ivIcon.setScaleType(ImageView.ScaleType.FIT_XY);\n\n        LayoutParams nameParam = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, BaseUtil.dipToPix(getContext(),25));\n        nameParam.gravity = Gravity.CENTER;\n        tvName.setLayoutParams(nameParam);\n        tvName.setText(getResources().getString(R.string.edit_edit));\n        tvName.setTextSize(14);\n        tvName.setTextColor(getResources().getColor(R.color.selector_image_edit));\n        tvName.setGravity(Gravity.CENTER);\n\n        LayoutParams rootParam = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);\n        rootParam.weight = 1;\n        this.setLayoutParams(rootParam);\n        this.setPadding(0,BaseUtil.dipToPix(getContext(),10),0,BaseUtil.dipToPix(getContext(),10));\n        this.setOrientation(LinearLayout.VERTICAL);\n    }\n\n    private void initListener(){\n        this.setOnClickListener(onClickListener);\n    }\n\n    public static ImageEditNavigationView builder(Context context){\n        return new ImageEditNavigationView(context);\n    }\n\n    public ImageEditNavigationView setType(String type){\n        this.type = type;\n        return this;\n    }\n\n    public ImageEditNavigationView setName(String name){\n        tvName.setText(name);\n        return this;\n    }\n\n    public ImageEditNavigationView setIconRes(int resId){\n//        ivIcon.setImageResource(resId);\n        ivIcon.setBackgroundResource(resId);\n        return this;\n    }\n\n    public ImageEditNavigationView setListener(ImageEditNavListener imageEditNavListener){\n        this.imageEditNavListener = imageEditNavListener;\n        return this;\n    }\n\n    private OnClickListener onClickListener = new OnClickListener() {\n        @Override\n        public void onClick(View v) {\n            if(null != imageEditNavListener){\n                imageEditNavListener.onClick(v,type);\n            }\n        }\n    };\n\n}\n"
  },
  {
    "path": "MagicShow/src/main/java/com/zero/magicshow/viewmanager/CameraManager.java",
    "content": "package com.zero.magicshow.viewmanager;\n\nimport android.animation.ObjectAnimator;\nimport android.animation.ValueAnimator;\nimport android.widget.ImageView;\n\n/**\n * Created by hongli on 2017/9/1.\n */\n\npublic class CameraManager {\n    public static ObjectAnimator getShutterAnim(ImageView btnShutter){\n        ObjectAnimator animator = ObjectAnimator.ofFloat(btnShutter,\"rotation\",0,360);\n        animator.setDuration(500);\n        animator.setRepeatCount(ValueAnimator.INFINITE);\n        return animator;\n    }\n}\n"
  },
  {
    "path": "MagicShow/src/main/res/anim/bottom_sliding_in.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<set xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <translate android:fromYDelta=\"100%p\" android:toYDelta=\"0\"\n        android:duration=\"300\"/>\n</set>"
  },
  {
    "path": "MagicShow/src/main/res/anim/bottom_sliding_out.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<set xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <translate android:fromYDelta=\"0\" android:toYDelta=\"100%p\"\n        android:duration=\"300\"/>\n</set>"
  },
  {
    "path": "MagicShow/src/main/res/color/selector_image_back.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<selector\n  xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <item android:state_pressed=\"true\" android:color=\"@android:color/background_light\" />\n    <item android:color=\"@android:color/black\" />\n</selector>"
  },
  {
    "path": "MagicShow/src/main/res/color/selector_image_edit.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<selector\n  xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <item android:state_checked=\"true\" android:color=\"@color/filter_color_orange\" />\n    <item android:state_pressed=\"true\" android:color=\"@color/filter_color_orange\" />\n    <item android:color=\"@android:color/white\" />\n</selector>"
  },
  {
    "path": "MagicShow/src/main/res/color/selector_image_edit_yellow.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<selector\n  xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <item android:state_checked=\"true\" android:color=\"#EEEE00\" />\n    <item android:state_pressed=\"true\" android:color=\"#EEEE00\" />\n    <item android:color=\"@android:color/white\" />\n</selector>"
  },
  {
    "path": "MagicShow/src/main/res/drawable/btn_camera_beauty.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<selector\n  xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <item android:state_focused=\"true\" android:drawable=\"@drawable/ic_camera_beauty_pressed\" />\n    <item android:state_pressed=\"true\" android:drawable=\"@drawable/ic_camera_beauty_pressed\" />\n    <item android:drawable=\"@drawable/ic_camera_beauty\" />\n</selector>"
  },
  {
    "path": "MagicShow/src/main/res/drawable/btn_camera_filter.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<selector\n  xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <item android:state_focused=\"true\" android:drawable=\"@drawable/ic_camera_filter\" />\n    <item android:state_pressed=\"true\" android:drawable=\"@drawable/ic_camera_filter\" />\n    <item android:drawable=\"@drawable/ic_camera_filter\" />\n</selector>"
  },
  {
    "path": "MagicShow/src/main/res/drawable/btn_camera_shutter.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<selector\n  xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <item android:state_pressed=\"true\" android:drawable=\"@drawable/button_take_pic_pressed\" />\n    <item android:drawable=\"@drawable/button_take_pic_normal\" />\n</selector>"
  },
  {
    "path": "MagicShow/src/main/res/drawable/btn_layout_filters_bar_close.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<selector\n  xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <item android:state_pressed=\"true\" android:drawable=\"@drawable/ic_collage_layout_filters_bar_close_pressed\" />\n    <item android:state_focused=\"true\" android:drawable=\"@drawable/ic_collage_layout_filters_bar_close_pressed\" />\n    <item android:state_selected=\"true\" android:drawable=\"@drawable/ic_collage_layout_filters_bar_close_pressed\" />\n    <item android:drawable=\"@drawable/ic_collage_layout_filters_bar_close_normal\" />\n</selector>"
  },
  {
    "path": "MagicShow/src/main/res/drawable/corners_yuanjiao_dialog.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<shape xmlns:android=\"http://schemas.android.com/apk/res/android\" >\n    <solid android:color=\"@color/white_percent_90\" />\n\n    <corners\n        android:bottomLeftRadius=\"2dp\"\n        android:bottomRightRadius=\"2dp\"\n        android:topLeftRadius=\"2dp\"\n        android:topRightRadius=\"2dp\" />\n\n</shape>"
  },
  {
    "path": "MagicShow/src/main/res/drawable/seekbar_progress.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<layer-list\n  xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <item android:id=\"@android:id/background\">\n        <nine-patch android:src=\"@drawable/seekbar_bg\" />\n    </item>\n    <item android:id=\"@android:id/progress\">\n        <clip>\n            <nine-patch android:src=\"@drawable/seekbar_primary_progress\" />\n        </clip>\n    </item>\n</layer-list>"
  },
  {
    "path": "MagicShow/src/main/res/drawable/seekbar_progress_light.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<layer-list\n  xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <item android:id=\"@android:id/background\">\n        <nine-patch android:src=\"@drawable/seekbar_bg_light\" />\n    </item>\n    <item android:id=\"@android:id/progress\">\n        <clip>\n            <nine-patch android:src=\"@drawable/seekbar_primary_progress\" />\n        </clip>\n    </item>\n</layer-list>"
  },
  {
    "path": "MagicShow/src/main/res/drawable/seekbar_thumb.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<selector\n  xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <item android:state_selected=\"true\" android:drawable=\"@drawable/ic_seekbar_thumb_pressed\" />\n    <item android:state_focused=\"true\" android:drawable=\"@drawable/ic_seekbar_thumb_pressed\" />\n    <item android:state_pressed=\"true\" android:drawable=\"@drawable/ic_seekbar_thumb_pressed\" />\n    <item android:drawable=\"@drawable/ic_seekbar_thumb_normal\" />\n</selector>"
  },
  {
    "path": "MagicShow/src/main/res/drawable/seekbar_thumb_light.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<selector\n  xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <item android:state_selected=\"true\" android:drawable=\"@drawable/ic_seekbar_thumb_light_pressed\" />\n    <item android:state_focused=\"true\" android:drawable=\"@drawable/ic_seekbar_thumb_light_pressed\" />\n    <item android:state_pressed=\"true\" android:drawable=\"@drawable/ic_seekbar_thumb_light_pressed\" />\n    <item android:drawable=\"@drawable/ic_seekbar_thumb_light_normal\" />\n</selector>"
  },
  {
    "path": "MagicShow/src/main/res/drawable/selector_filter_favorite_btn.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<selector\n  xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <item android:state_selected=\"true\" android:drawable=\"@drawable/take_filter_favorite_btn02_skin_flat\" />\n    <item android:drawable=\"@android:color/transparent\" />\n</selector>"
  },
  {
    "path": "MagicShow/src/main/res/drawable/selector_filter_selected.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<selector\n  xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <item android:state_selected=\"true\" android:drawable=\"@drawable/take_filter_random_btn_skin_flat\" />\n    <item android:drawable=\"@drawable/take_filter_confirm_btn_skin_flat\" />\n</selector>"
  },
  {
    "path": "MagicShow/src/main/res/drawable/selector_image_adds.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<selector\n  xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <item android:state_checked=\"true\" android:drawable=\"@drawable/i_adds_blue\" />\n    <item android:state_pressed=\"true\" android:drawable=\"@drawable/i_adds\" />\n    <item android:drawable=\"@drawable/i_adds\" />\n</selector>"
  },
  {
    "path": "MagicShow/src/main/res/drawable/selector_image_back.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<selector\n  xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <item android:state_pressed=\"true\" android:drawable=\"@drawable/mix_gallery_bottom_back_click\" />\n    <item android:state_enabled=\"false\" android:drawable=\"@drawable/mix_gallery_bottom_back_click\" />\n    <item android:drawable=\"@drawable/mix_gallery_bottom_back_normal\" />\n</selector>"
  },
  {
    "path": "MagicShow/src/main/res/drawable/selector_image_beauty.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<selector\n  xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <item android:state_checked=\"true\" android:drawable=\"@drawable/i_cosmesis_blue\" />\n    <item android:state_pressed=\"true\" android:drawable=\"@drawable/i_cosmesis_blue\" />\n    <item android:drawable=\"@drawable/i_cosmesis\" />\n</selector>"
  },
  {
    "path": "MagicShow/src/main/res/drawable/selector_image_edit.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<selector\n  xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <item android:state_checked=\"true\" android:drawable=\"@drawable/i_edit_blue\" />\n    <item android:state_pressed=\"true\" android:drawable=\"@drawable/i_edit_blue\" />\n    <item android:drawable=\"@drawable/i_edit\"  />\n</selector>"
  },
  {
    "path": "MagicShow/src/main/res/drawable/selector_image_edit_adjust_bright.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<selector\n  xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <item android:state_checked=\"true\" android:drawable=\"@drawable/edit_bg_adjust_hdr_press\" />\n    <item android:state_pressed=\"true\" android:drawable=\"@drawable/edit_bg_adjust_hdr_press\" />\n    <item android:drawable=\"@drawable/edit_bg_adjust_hdr\" />\n</selector>"
  },
  {
    "path": "MagicShow/src/main/res/drawable/selector_image_edit_adjust_contrast.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<selector\n  xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <item android:state_checked=\"true\" android:drawable=\"@drawable/edit_bg_adjust_contrast_press\" />\n    <item android:state_pressed=\"true\" android:drawable=\"@drawable/edit_bg_adjust_contrast_press\" />\n    <item android:drawable=\"@drawable/edit_bg_adjust_contrast\" />\n</selector>"
  },
  {
    "path": "MagicShow/src/main/res/drawable/selector_image_edit_adjust_exposure.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<selector\n  xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <item android:state_checked=\"true\" android:drawable=\"@drawable/edit_bg_adjust_exposure_press\" />\n    <item android:state_pressed=\"true\" android:drawable=\"@drawable/edit_bg_adjust_exposure_press\" />\n    <item android:drawable=\"@drawable/edit_bg_adjust_exposure\" />\n</selector>"
  },
  {
    "path": "MagicShow/src/main/res/drawable/selector_image_edit_adjust_hue.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<selector\n  xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <item android:state_checked=\"true\" android:drawable=\"@drawable/edit_color_hue_press\" />\n    <item android:state_pressed=\"true\" android:drawable=\"@drawable/edit_color_hue_press\" />\n    <item android:drawable=\"@drawable/edit_color_hue\" />\n</selector>"
  },
  {
    "path": "MagicShow/src/main/res/drawable/selector_image_edit_adjust_saturation.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<selector\n  xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <item android:state_checked=\"true\" android:drawable=\"@drawable/edit_bg_adjust_saturation_press\" />\n    <item android:state_pressed=\"true\" android:drawable=\"@drawable/edit_bg_adjust_saturation_press\" />\n    <item android:drawable=\"@drawable/edit_bg_adjust_saturation\" />\n</selector>"
  },
  {
    "path": "MagicShow/src/main/res/drawable/selector_image_edit_adjust_sharpness.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<selector\n  xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <item android:state_checked=\"true\" android:drawable=\"@drawable/edit_bg_adjust_sharpness_press\" />\n    <item android:state_pressed=\"true\" android:drawable=\"@drawable/edit_bg_adjust_sharpness_press\" />\n    <item android:drawable=\"@drawable/edit_bg_adjust_sharpness\" />\n</selector>"
  },
  {
    "path": "MagicShow/src/main/res/drawable/selector_image_edit_adjust_vibrance.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<selector\n  xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <item android:state_checked=\"true\" android:drawable=\"@drawable/edit_bg_adjust_vibrance_press\" />\n    <item android:state_pressed=\"true\" android:drawable=\"@drawable/edit_bg_adjust_vibrance_press\" />\n    <item android:drawable=\"@drawable/edit_bg_adjust_vibrance\" />\n</selector>"
  },
  {
    "path": "MagicShow/src/main/res/drawable/selector_image_filter.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<selector\n  xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <item android:state_checked=\"true\" android:drawable=\"@drawable/i_effect_blue\" />\n    <item android:state_pressed=\"true\" android:drawable=\"@drawable/i_effect_blue\" />\n    <item android:drawable=\"@drawable/i_effect\" />\n</selector>"
  },
  {
    "path": "MagicShow/src/main/res/drawable/selector_image_fragment_skin.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<selector\n  xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <item android:state_selected=\"true\" android:drawable=\"@drawable/i_skinprocess_pressed\" />\n    <item android:state_pressed=\"true\" android:drawable=\"@drawable/i_skinprocess_pressed\" />\n    <item android:drawable=\"@drawable/i_skinprocess\" />\n</selector>"
  },
  {
    "path": "MagicShow/src/main/res/drawable/selector_image_frame.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<selector\n  xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <item android:state_checked=\"true\" android:drawable=\"@drawable/i_frame_blue\" />\n    <item android:state_pressed=\"true\" android:drawable=\"@drawable/i_frame_blue\" />\n    <item android:drawable=\"@drawable/i_frame\" />\n</selector>"
  },
  {
    "path": "MagicShow/src/main/res/drawable/selector_image_save.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<selector\n  xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <item android:state_pressed=\"true\" android:drawable=\"@drawable/edit_bg_done_press\" />\n    <item android:state_enabled=\"false\" android:drawable=\"@drawable/edit_bg_done_disenable\" />\n    <item android:drawable=\"@drawable/edit_bg_done\"  />\n</selector>"
  },
  {
    "path": "MagicShow/src/main/res/drawable/selector_rewardcamera.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<selector\n    xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <item android:state_checked=\"true\" android:drawable=\"@drawable/record_camera_switch_press\" />\n    <item android:state_pressed=\"true\" android:drawable=\"@drawable/record_camera_switch_press\" />\n    <item android:drawable=\"@drawable/record_camera_switch_normal\"  />\n</selector>"
  },
  {
    "path": "MagicShow/src/main/res/drawable/take_filter_favorite_btn.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<layer-list\n  xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <item android:drawable=\"@drawable/take_filter_favorite_btn01_layer00_skin_flat\" />\n    <item android:drawable=\"@drawable/take_filter_favorite_btn01_layer01_skin_flat\" />\n    <item android:drawable=\"@drawable/selector_filter_favorite_btn\" />\n</layer-list>"
  },
  {
    "path": "MagicShow/src/main/res/layout/activity_camera.xml",
    "content": "<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:tools=\"http://schemas.android.com/tools\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    android:orientation=\"vertical\"\n    android:background=\"@android:color/black\"\n    tools:context=\"com.zero.magicshow.activity.CameraActivity\">\n\n    <com.zero.magicshow.core.widget.MagicCameraView\n        android:id=\"@+id/camera_camera_view\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"match_parent\"/>\n\n    <ImageView\n        android:id=\"@+id/camera_mode\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:src=\"@drawable/icon_video\"\n        android:visibility=\"gone\" />\n\n    <ImageView\n        android:id=\"@+id/camera_switch\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:layout_alignParentRight=\"true\"\n        android:layout_marginRight=\"7dp\"\n        android:layout_marginTop=\"7dp\"\n        android:src=\"@drawable/selector_rewardcamera\" />\n    <!--底部控制-->\n    <RelativeLayout\n        android:id=\"@+id/camera_controller_block\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"95.0dip\"\n        android:layout_alignParentBottom=\"true\">\n\n        <RelativeLayout\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"95.0dip\">\n\n            <!--<ImageView-->\n                <!--android:id=\"@+id/camera_beauty\"-->\n                <!--android:layout_width=\"0dip\"-->\n                <!--android:layout_height=\"match_parent\"-->\n                <!--android:layout_weight=\"1.0\"-->\n                <!--android:scaleType=\"center\"-->\n                <!--android:visibility=\"invisible\"-->\n                <!--android:src=\"@drawable/btn_camera_beauty\"/>-->\n\n            <ImageView\n                android:id=\"@+id/camera_shutter\"\n                android:layout_width=\"80dp\"\n                android:layout_height=\"80dp\"\n                android:layout_centerInParent=\"true\"\n                android:src=\"@drawable/btn_camera_shutter\"/>\n\n            <ImageView\n                android:id=\"@+id/camera_filter\"\n                android:layout_width=\"80dp\"\n                android:layout_height=\"80dp\"\n                android:scaleType=\"center\"\n                android:layout_alignParentRight=\"true\"\n                android:layout_centerVertical=\"true\"\n                android:layout_marginRight=\"40dp\"\n                android:src=\"@drawable/btn_camera_filter\"/>\n        </RelativeLayout>\n\n        <include\n            android:id=\"@+id/layout_filter\"\n            layout=\"@layout/filter_layout\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"match_parent\"\n            android:visibility=\"gone\" />\n    </RelativeLayout>\n</RelativeLayout>\n"
  },
  {
    "path": "MagicShow/src/main/res/layout/activity_image.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\">\n    <com.zero.magicshow.core.widget.MagicImageView\n        android:id=\"@+id/image_edit_magicimageview\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\"\n        android:layout_above=\"@+id/image_edit_bottom_layout\"/>\n\n    <!--顶层按钮区域-->\n    <RelativeLayout\n        android:id=\"@+id/image_edit_topbar\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\"\n        android:padding=\"5dp\"\n        android:layout_alignParentTop=\"true\"\n        android:layout_alignParentStart=\"true\">\n        <ImageView\n            android:id=\"@+id/image_edit_back\"\n            android:layout_alignParentLeft=\"true\"\n            android:layout_width=\"45dp\"\n            android:layout_height=\"45dp\"\n            android:src=\"@drawable/image_edit_back\"\n            android:layout_centerVertical=\"true\"/>\n        <ImageView\n            android:id=\"@+id/image_edit_save\"\n            android:layout_alignParentRight=\"true\"\n            android:layout_width=\"45dp\"\n            android:layout_height=\"45dp\"\n            android:src=\"@drawable/image_edit_save\"/>\n        <TextView\n            android:id=\"@+id/image_edit_title\"\n            android:layout_width=\"wrap_content\"\n            android:layout_height=\"wrap_content\"\n            android:text=\"修改图片\"\n            android:textColor=\"@android:color/white\"\n            android:layout_centerInParent=\"true\"/>\n    </RelativeLayout>\n    <!--保存于取消按钮层-->\n    <RelativeLayout\n        android:id=\"@+id/image_edit_modify_controller_block\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"45dp\"\n        android:visibility=\"invisible\"\n        android:layout_above=\"@+id/image_edit_bottom_layout\"\n        android:background=\"@color/image_edit_modify_controller_bg\">\n        <ImageView\n            android:id=\"@+id/image_edit_modify_controller_close\"\n            android:layout_width=\"45dp\"\n            android:layout_height=\"45dp\"\n            android:padding=\"12dp\"\n            android:layout_marginLeft=\"4dp\"\n            android:src=\"@drawable/image_edit_modify_close\"\n            android:scaleType=\"fitXY\"\n            />\n        <ImageView\n            android:id=\"@+id/image_edit_modify_controller_save\"\n            android:layout_width=\"45dp\"\n            android:layout_height=\"45dp\"\n            android:padding=\"12dp\"\n            android:layout_marginRight=\"4dp\"\n            android:layout_alignParentRight=\"true\"\n            android:src=\"@drawable/image_edit_modify_save\"\n            android:scaleType=\"fitXY\"\n            />\n    </RelativeLayout>\n\t<!--底层导航栏-->\n\t<RelativeLayout\n\t\tandroid:id=\"@+id/image_edit_bottom_layout\"\n\t\tandroid:layout_width=\"match_parent\"\n\t\tandroid:layout_height=\"95dp\"\n\t\tandroid:layout_alignParentBottom=\"true\"\n        android:background=\"@android:color/background_dark\">\n\t\t<LinearLayout\n\t\t\tandroid:id=\"@+id/image_edit_navigation\"\n\t\t\tandroid:layout_width=\"match_parent\"\n\t\t\tandroid:layout_height=\"95dp\"\n\t\t\tandroid:gravity=\"center\"\n\t\t\tandroid:orientation=\"horizontal\">\n\t\t</LinearLayout>\n\t\t<RelativeLayout\n\t\t\tandroid:id=\"@+id/image_edit_fragment_container\"\n\t\t\tandroid:layout_width=\"match_parent\"\n\t\t\tandroid:layout_height=\"95dp\">\n\t\t</RelativeLayout>\n\t</RelativeLayout>\n</RelativeLayout>\n"
  },
  {
    "path": "MagicShow/src/main/res/layout/activity_main.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:tools=\"http://schemas.android.com/tools\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    tools:context=\"com.zero.magicshow.MainActivity\">\n\n    <Button\n        android:id=\"@+id/button_album\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:text=\"Album\"\n        android:layout_below=\"@+id/button_camera\"\n        android:layout_centerHorizontal=\"true\"\n        android:layout_marginTop=\"56dp\" />\n\n    <Button\n        android:id=\"@+id/button_camera\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:text=\"Camera\"\n        android:layout_centerVertical=\"true\"\n        android:layout_centerHorizontal=\"true\" />\n\n</RelativeLayout>\n"
  },
  {
    "path": "MagicShow/src/main/res/layout/dialog_yes_or_no.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:layout_width=\"250dp\"\n    android:layout_height=\"wrap_content\"\n    android:background=\"@drawable/corners_yuanjiao_dialog\"\n    android:orientation=\"vertical\">\n\n    <TextView\n        android:id=\"@+id/dialog_yes_or_no_title\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"42dp\"\n        android:gravity=\"center\"\n        android:text=\"dsadsad\"\n        android:textColor=\"@color/qian_lan\"\n        android:background=\"@drawable/yes_or_no_dialog_line\"\n        android:visibility=\"gone\"\n        android:textSize=\"16sp\" />\n\n    <ImageView\n        android:id=\"@+id/gift_balance_lack_close\"\n        android:layout_width=\"22dp\"\n        android:layout_height=\"22dp\"\n        android:layout_alignParentRight=\"true\"\n        android:layout_marginRight=\"10dp\"\n        android:layout_marginTop=\"10dp\"\n        android:scaleType=\"fitXY\"\n        android:visibility=\"gone\"\n        android:src=\"@drawable/balance_lack_close_icon\" />\n\n    <TextView\n        android:id=\"@+id/dialog_yes_or_no_con\"\n        android:layout_below=\"@+id/dialog_yes_or_no_title\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\"\n        android:gravity=\"center\"\n        android:text=\"是否放弃已经编译的内容\"\n        android:textColor=\"@color/greyish_brown\"\n        android:layout_marginTop=\"20dp\"\n        android:layout_marginBottom=\"20dp\"\n        android:textSize=\"14sp\" />\n    <TextView\n        android:id=\"@+id/dialog_yes_or_no_first_line\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"1px\"\n        android:background=\"@color/white\"\n        android:layout_below=\"@+id/dialog_yes_or_no_con\"/>\n    <LinearLayout\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"41dp\"\n        android:layout_below=\"@+id/dialog_yes_or_no_first_line\"\n        android:gravity=\"center\"\n        android:layout_centerHorizontal=\"true\"\n        android:orientation=\"horizontal\">\n\n        <TextView\n            android:id=\"@+id/dialog_yes_or_no_btnno\"\n            android:layout_width=\"124.5dp\"\n            android:layout_height=\"match_parent\"\n            android:gravity=\"center\"\n            android:layout_gravity=\"center\"\n            android:textColor=\"@color/warm_grey\"\n            android:text=\"@string/dialog_yes_or_no_no\"\n            android:textSize=\"14sp\" />\n\n        <TextView\n            android:layout_width=\"1px\"\n            android:layout_height=\"match_parent\"\n            android:background=\"@color/white\"\n            />\n\n        <TextView\n            android:id=\"@+id/dialog_yes_or_no_btnyes\"\n            android:layout_width=\"124.5dp\"\n            android:layout_height=\"match_parent\"\n            android:gravity=\"center\"\n            android:layout_gravity=\"center\"\n            android:text=\"@string/dialog_yes_or_no_yes\"\n            android:textColor=\"@color/qian_lan\"\n            android:textSize=\"14sp\" />\n    </LinearLayout>\n\n</RelativeLayout>"
  },
  {
    "path": "MagicShow/src/main/res/layout/filter_item_layout.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<FrameLayout \n    android:id=\"@+id/filter_root\"\n    android:layout_gravity=\"center_vertical\" \n    android:orientation=\"vertical\" \n    android:layout_width=\"74.0dip\" \n    android:layout_height=\"84.0dip\"\n    android:padding=\"5dip\"\n  xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <FrameLayout \n        android:layout_width=\"fill_parent\" \n        android:layout_height=\"64.0dip\">\n        <ImageView \n            android:id=\"@+id/filter_thumb_image\" \n            android:layout_width=\"64.0dip\" \n            android:layout_height=\"64.0dip\" \n            android:src=\"@drawable/filter_thumb_original\" \n            android:scaleType=\"centerCrop\" />\n        <FrameLayout \n            android:id=\"@+id/filter_thumb_selected\" \n            android:visibility=\"gone\" \n            android:layout_width=\"fill_parent\" \n            android:layout_height=\"fill_parent\">\n            <View \n                android:id=\"@+id/filter_thumb_selected_bg\"\n                android:layout_width=\"fill_parent\" \n            \tandroid:layout_height=\"fill_parent\"/>\n            <ImageView \n                android:layout_gravity=\"center\" \n                android:id=\"@+id/filter_thumb_selected_icon\" \n                android:layout_width=\"34.0dip\" \n                android:layout_height=\"34.0dip\" \n                android:src=\"@drawable/selector_filter_selected\" />\n        </FrameLayout>\n    </FrameLayout>\n    <TextView \n        android:textSize=\"10.0sp\" \n        android:textColor=\"@android:color/white\" \n        android:gravity=\"center\" \n        android:layout_gravity=\"bottom\" \n        android:id=\"@+id/filter_thumb_name\" \n        android:layout_width=\"fill_parent\" \n        android:layout_height=\"20.0dip\" \n        android:text=\"@string/filter_none\" />\n</FrameLayout>"
  },
  {
    "path": "MagicShow/src/main/res/layout/filter_layout.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>  \n<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:id=\"@+id/layout_filter_tab\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"wrap_content\"\n    android:orientation=\"vertical\"\n    android:background=\"@android:color/transparent\">\n\n    <android.support.v7.widget.RecyclerView\n        android:id=\"@+id/filter_listView\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"94.0dip\"\n        android:padding=\"5.0dip\"\n        android:scrollbars=\"none\"\n        android:background=\"@android:color/white\"/>       \n    <View \n        android:layout_width=\"match_parent\"\n        android:layout_height=\"1px\"\n        android:background=\"@android:color/black\"/>\n\n    <ImageView\n        android:background=\"@android:color/white\"\n        android:id=\"@+id/camera_closefilter\"\n        android:layout_width=\"match_parent\" \n        android:layout_height=\"26dip\"\n        android:scaleType=\"center\"\n        android:layout_gravity=\"center_horizontal\"\n        android:src=\"@drawable/btn_layout_filters_bar_close\" />\n</LinearLayout>"
  },
  {
    "path": "MagicShow/src/main/res/layout/fragment_image_edit_adjust.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"wrap_content\"\n    android:orientation=\"vertical\"\n    android:clickable=\"true\"\n    android:background=\"@android:color/black\">\n    <LinearLayout \n        android:layout_gravity=\"center_horizontal\"\n        android:gravity=\"center_vertical\" \n        android:orientation=\"horizontal\" \n        android:id=\"@+id/seek_bar_item_menu\" \n        android:visibility=\"invisible\"\n\t\tandroid:layout_marginTop=\"7dp\"\n        android:layout_width=\"fill_parent\" \n        android:layout_height=\"fill_parent\" >\n       <ImageView \n           android:id=\"@+id/item_label\" \n           android:layout_width=\"25.0dip\" \n           android:layout_height=\"25.0dip\" \n           android:layout_marginLeft=\"30.0dip\"\n           android:layout_marginRight=\"10.0dip\" />\n       <com.zero.magicshow.core.widget.TwoLineSeekBar\n           android:id=\"@+id/item_seek_bar\" \n           android:layout_width=\"0.0dip\" \n           android:layout_height=\"fill_parent\" \n           android:layout_weight=\"1.0\" />\n       <TextView \n           android:textColor=\"#ffffffff\" \n           android:id=\"@+id/item_val\" \n           android:layout_width=\"wrap_content\" \n           android:layout_height=\"wrap_content\" \n           android:layout_marginLeft=\"15.0dip\"\n           android:layout_marginRight=\"15.0dip\"\n           android:minWidth=\"40.0dip\" />\n    </LinearLayout>\n\n    <HorizontalScrollView \n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n\t\tandroid:layout_marginTop=\"10dp\"\n        android:layout_marginLeft=\"22dp\"\n        android:scrollbars=\"none\">\n        <RadioGroup \n            android:id=\"@+id/fragment_adjust_radiogroup\"\n\t\t    android:layout_width=\"wrap_content\"\n\t\t    android:layout_height=\"wrap_content\"\n\t\t\tandroid:layout_gravity=\"center_horizontal\"\n\t\t    android:orientation=\"horizontal\">\n\t\t    \n\t\t    <RadioButton \n\t\t        android:id=\"@+id/fragment_radio_contrast\"  \n\t\t        android:drawableTop=\"@drawable/selector_image_edit_adjust_contrast\"\n\t\t        android:text=\"@string/edit_contrast\"\n\t\t        style=\"@style/ImageEditor_adjust_radiobutton\"/>\n\t\t    \n\t\t    <RadioButton \n\t\t        android:id=\"@+id/fragment_radio_exposure\"  \n\t\t        android:drawableTop=\"@drawable/selector_image_edit_adjust_exposure\"\n\t\t        android:text=\"@string/edit_exposure\"\n\t\t        style=\"@style/ImageEditor_adjust_radiobutton\"/>\n\t\t    \n\t\t    <RadioButton \n\t\t        android:id=\"@+id/fragment_radio_saturation\"  \n\t\t        android:drawableTop=\"@drawable/selector_image_edit_adjust_saturation\"\n\t\t        android:text=\"@string/edit_saturation\"\n\t\t        style=\"@style/ImageEditor_adjust_radiobutton\"/>\n\t\t    \n\t\t    <RadioButton \n\t\t        android:id=\"@+id/fragment_radio_sharpness\"  \n\t\t        android:drawableTop=\"@drawable/selector_image_edit_adjust_sharpness\"\n\t\t        android:text=\"@string/edit_sharpness\"\n\t\t        style=\"@style/ImageEditor_adjust_radiobutton\"/>\n\t\t    \n\t\t    <RadioButton \n\t\t        android:id=\"@+id/fragment_radio_bright\"  \n\t\t        android:drawableTop=\"@drawable/selector_image_edit_adjust_bright\"\n\t\t        android:text=\"@string/edit_brightness\"\n\t\t        style=\"@style/ImageEditor_adjust_radiobutton\"/>\n\t\t    \n\t\t    <RadioButton \n\t\t        android:id=\"@+id/fragment_radio_hue\"  \n\t\t        android:drawableTop=\"@drawable/selector_image_edit_adjust_hue\"\n\t\t        android:text=\"@string/edit_hue\"\n\t\t        style=\"@style/ImageEditor_adjust_radiobutton\"/>\n\t\t</RadioGroup>\n    </HorizontalScrollView>\n</LinearLayout>\n"
  },
  {
    "path": "MagicShow/src/main/res/layout/fragment_image_edit_beauty.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"wrap_content\"\n\tandroid:clickable=\"true\"\n    android:orientation=\"vertical\">\n    <RelativeLayout \n\t    android:id=\"@+id/fragment_beauty_skin\"\n\t    android:layout_width=\"match_parent\"\n\t    android:layout_height=\"wrap_content\"\n\t    android:padding=\"20dp\"\n\t    android:background=\"@android:color/black\"\n\t    android:gravity=\"center\">\n\t    <com.zero.magicshow.core.widget.BubbleSeekBar\n\t        android:id=\"@+id/fragment_beauty_skin_seekbar\"\n\t        android:layout_width=\"202dip\"\n\t        android:layout_height=\"wrap_content\"\n\t        style=\"@style/SeekBar.Light\">\n\t        \n\t    </com.zero.magicshow.core.widget.BubbleSeekBar>\n\t</RelativeLayout>\n\t<RelativeLayout \n\t    android:id=\"@+id/fragment_beauty_color\"\n\t    android:layout_width=\"match_parent\"\n\t    android:layout_height=\"wrap_content\"\n\t    android:padding=\"20dp\"\n\t    android:background=\"@android:color/black\"\n\t    android:gravity=\"center\"\n\t    android:visibility=\"gone\">\n\t    <com.zero.magicshow.core.widget.BubbleSeekBar\n\t        android:id=\"@+id/fragment_beauty_white_seekbar\"\n\t        android:layout_width=\"202dip\"\n\t        android:layout_height=\"wrap_content\"\n\t        style=\"@style/SeekBar.Light\">\n\t        \n\t    </com.zero.magicshow.core.widget.BubbleSeekBar>\n\t</RelativeLayout>\n    <RadioGroup \n\t    android:id=\"@+id/fragment_beauty_radiogroup\"\n\t    android:layout_width=\"match_parent\"\n\t    android:layout_height=\"wrap_content\"\n\t    android:orientation=\"horizontal\"\n\t    android:background=\"@android:color/background_dark\"\n\t    android:gravity=\"center\">\n\t    \n        <RadioButton     \n            android:id=\"@+id/fragment_beauty_btn_skinsmooth\"  \n\t        android:layout_width=\"wrap_content\"\n\t        android:layout_height=\"wrap_content\"\n\t        android:text=\"磨皮\"\n\t        android:button=\"@null\"\n\t        android:gravity=\"center\"\n\t        android:paddingLeft=\"15dp\"\n\t    \tandroid:paddingRight=\"15dp\"\n\t    \tandroid:checked=\"true\"\n\t        android:textColor=\"@color/selector_image_edit\"/>\n        \n        <RadioButton\n            android:id=\"@+id/fragment_beauty_btn_skincolor\"  \n\t        android:layout_width=\"wrap_content\"\n\t        android:layout_height=\"wrap_content\"\n\t        android:text=\"美白\"\n\t        android:button=\"@null\"\n\t        android:gravity=\"center\"\n\t        android:textColor=\"@color/selector_image_edit\"\n\t        android:paddingLeft=\"15dp\"\n\t    \tandroid:paddingRight=\"15dp\"/>\n        \n    </RadioGroup>   \n\n</LinearLayout>\n"
  },
  {
    "path": "MagicShow/src/main/res/layout/fragment_image_edit_filter.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>  \n<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:id=\"@+id/layout_filter_tab\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"wrap_content\"\n    android:orientation=\"vertical\"\n    android:clickable=\"true\"\n    android:background=\"@android:color/transparent\">\n\n    <android.support.v7.widget.RecyclerView\n        android:id=\"@+id/image_edit_filter_recyclerview\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"94.0dip\"\n        android:padding=\"5.0dip\"\n        android:clipChildren=\"false\"\n        android:clipToPadding=\"false\"\n        android:scrollbars=\"none\"\n        android:background=\"@android:color/white\"/>\n\n    <!--顶部按钮-->\n    <RelativeLayout\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"30dp\">\n        <!--<TextView-->\n            <!--android:layout_width=\"10dp\"-->\n            <!--android:layout_height=\"15dp\"-->\n            <!--android:background=\"@android:color/black\"/>-->\n        <!--<TextView-->\n            <!--android:layout_width=\"15dp\"-->\n            <!--android:layout_height=\"10dp\"-->\n            <!--android:background=\"@android:color/black\"/>-->\n        <ImageView\n            android:id=\"@+id/image_edit_filter_close\"\n            android:layout_width=\"25dp\"\n            android:layout_height=\"25dp\"\n            android:paddingRight=\"10dp\"\n            android:paddingBottom=\"10dp\"\n            android:scaleType=\"fitXY\"\n            android:visibility=\"gone\"\n            android:src=\"@drawable/close_black_seq\" />\n        <ImageView\n            android:id=\"@+id/image_edit_filter_favourite\"\n            android:layout_width=\"30dp\"\n            android:layout_height=\"30dp\"\n            android:layout_alignParentRight=\"true\"\n            android:layout_centerVertical=\"true\"\n            android:padding=\"8dp\"\n            android:layout_marginRight=\"2dp\"\n            android:scaleType=\"fitXY\"\n            android:src=\"@drawable/take_filter_favorite_btn\"\n            android:visibility=\"invisible\"/>\n    </RelativeLayout>\n</RelativeLayout>"
  },
  {
    "path": "MagicShow/src/main/res/raw/amaro.glsl",
    "content": "precision mediump float;\n \n varying mediump vec2 textureCoordinate;\n \n uniform sampler2D inputImageTexture;\n uniform sampler2D inputImageTexture2; //blowout;\n uniform sampler2D inputImageTexture3; //overlay;\n uniform sampler2D inputImageTexture4; //map\n \n uniform float strength;\n\n void main()\n {\n     vec4 originColor = texture2D(inputImageTexture, textureCoordinate);\n     vec4 texel = texture2D(inputImageTexture, textureCoordinate);\n     vec3 bbTexel = texture2D(inputImageTexture2, textureCoordinate).rgb;\n     \n     texel.r = texture2D(inputImageTexture3, vec2(bbTexel.r, texel.r)).r;\n     texel.g = texture2D(inputImageTexture3, vec2(bbTexel.g, texel.g)).g;\n     texel.b = texture2D(inputImageTexture3, vec2(bbTexel.b, texel.b)).b;\n     \n     vec4 mapped;\n     mapped.r = texture2D(inputImageTexture4, vec2(texel.r, .16666)).r;\n     mapped.g = texture2D(inputImageTexture4, vec2(texel.g, .5)).g;\n     mapped.b = texture2D(inputImageTexture4, vec2(texel.b, .83333)).b;\n     mapped.a = 1.0;\n     \n     mapped.rgb = mix(originColor.rgb, mapped.rgb, strength);\n\n     gl_FragColor = mapped;\n }"
  },
  {
    "path": "MagicShow/src/main/res/raw/antique.glsl",
    "content": "varying highp vec2 textureCoordinate;\n\nprecision highp float;\n\nuniform sampler2D inputImageTexture;\nuniform sampler2D curve;\n\nvoid main()\n{\n\thighp vec4 textureColor;\n\thighp vec4 textureColorRes;\n\thighp float satVal = 65.0 / 100.0;\n\t\n\tfloat xCoordinate = textureCoordinate.x;\n\tfloat yCoordinate = textureCoordinate.y;\n\t\n\thighp float redCurveValue;\n\thighp float greenCurveValue;\n\thighp float blueCurveValue;\n\t\n\ttextureColor = texture2D( inputImageTexture, vec2(xCoordinate, yCoordinate));\n\ttextureColorRes = textureColor;\n\t\n\tredCurveValue = texture2D(curve, vec2(textureColor.r, 0.0)).r; \n\tgreenCurveValue = texture2D(curve, vec2(textureColor.g, 0.0)).g;\n\tblueCurveValue = texture2D(curve, vec2(textureColor.b, 0.0)).b;\n\t\n\thighp float G = (redCurveValue + greenCurveValue + blueCurveValue);\n\tG = G / 3.0;\n\t\n\tredCurveValue = ((1.0 - satVal) * G + satVal * redCurveValue);\n\tgreenCurveValue = ((1.0 - satVal) * G + satVal * greenCurveValue);\n\tblueCurveValue = ((1.0 - satVal) * G + satVal * blueCurveValue);\n\tredCurveValue = (((redCurveValue) > (1.0)) ? (1.0) : (((redCurveValue) < (0.0)) ? (0.0) : (redCurveValue)));\n\tgreenCurveValue = (((greenCurveValue) > (1.0)) ? (1.0) : (((greenCurveValue) < (0.0)) ? (0.0) : (greenCurveValue)));\n\tblueCurveValue = (((blueCurveValue) > (1.0)) ? (1.0) : (((blueCurveValue) < (0.0)) ? (0.0) : (blueCurveValue)));\n\t\n\tredCurveValue = texture2D(curve, vec2(redCurveValue, 0.0)).a;\n\tgreenCurveValue = texture2D(curve, vec2(greenCurveValue, 0.0)).a;\n\tblueCurveValue = texture2D(curve, vec2(blueCurveValue, 0.0)).a; \n\t\n\thighp vec4 base = vec4(redCurveValue, greenCurveValue, blueCurveValue, 1.0);\n\thighp vec4 overlayer = vec4(250.0/255.0, 227.0/255.0, 193.0/255.0, 1.0);\n\t\n\ttextureColor = overlayer * base;\n\tbase = (textureColor - base) * 0.850980 + base;\n\ttextureColor = base; \n\t\n\tgl_FragColor = vec4(textureColor.r, textureColor.g, textureColor.b, 1.0);\n}\n  "
  },
  {
    "path": "MagicShow/src/main/res/raw/beauty.glsl",
    "content": "precision mediump float;\n\nvarying mediump vec2 textureCoordinate;\n\nuniform sampler2D inputImageTexture;\nuniform vec2 singleStepOffset;\nuniform mediump float params;\n\nconst highp vec3 W = vec3(0.299,0.587,0.114);\nvec2 blurCoordinates[20];\n\nfloat hardLight(float color)\n{\n\tif(color <= 0.5)\n\t\tcolor = color * color * 2.0;\n\telse\n\t\tcolor = 1.0 - ((1.0 - color)*(1.0 - color) * 2.0);\n\treturn color;\n}\n\nvoid main(){\n\n    vec3 centralColor = texture2D(inputImageTexture, textureCoordinate).rgb;\n    blurCoordinates[0] = textureCoordinate.xy + singleStepOffset * vec2(0.0, -10.0);\n    blurCoordinates[1] = textureCoordinate.xy + singleStepOffset * vec2(0.0, 10.0);\n    blurCoordinates[2] = textureCoordinate.xy + singleStepOffset * vec2(-10.0, 0.0);\n    blurCoordinates[3] = textureCoordinate.xy + singleStepOffset * vec2(10.0, 0.0);\n    blurCoordinates[4] = textureCoordinate.xy + singleStepOffset * vec2(5.0, -8.0);\n    blurCoordinates[5] = textureCoordinate.xy + singleStepOffset * vec2(5.0, 8.0);\n    blurCoordinates[6] = textureCoordinate.xy + singleStepOffset * vec2(-5.0, 8.0);\n    blurCoordinates[7] = textureCoordinate.xy + singleStepOffset * vec2(-5.0, -8.0);\n    blurCoordinates[8] = textureCoordinate.xy + singleStepOffset * vec2(8.0, -5.0);\n    blurCoordinates[9] = textureCoordinate.xy + singleStepOffset * vec2(8.0, 5.0);\n    blurCoordinates[10] = textureCoordinate.xy + singleStepOffset * vec2(-8.0, 5.0);\n    blurCoordinates[11] = textureCoordinate.xy + singleStepOffset * vec2(-8.0, -5.0);\n    blurCoordinates[12] = textureCoordinate.xy + singleStepOffset * vec2(0.0, -6.0);\n    blurCoordinates[13] = textureCoordinate.xy + singleStepOffset * vec2(0.0, 6.0);\n    blurCoordinates[14] = textureCoordinate.xy + singleStepOffset * vec2(6.0, 0.0);\n    blurCoordinates[15] = textureCoordinate.xy + singleStepOffset * vec2(-6.0, 0.0);\n    blurCoordinates[16] = textureCoordinate.xy + singleStepOffset * vec2(-4.0, -4.0);\n    blurCoordinates[17] = textureCoordinate.xy + singleStepOffset * vec2(-4.0, 4.0);\n    blurCoordinates[18] = textureCoordinate.xy + singleStepOffset * vec2(4.0, -4.0);\n    blurCoordinates[19] = textureCoordinate.xy + singleStepOffset * vec2(4.0, 4.0);\n\n    float sampleColor = centralColor.g * 20.0;\n    sampleColor += texture2D(inputImageTexture, blurCoordinates[0]).g;\n    sampleColor += texture2D(inputImageTexture, blurCoordinates[1]).g;\n    sampleColor += texture2D(inputImageTexture, blurCoordinates[2]).g;\n    sampleColor += texture2D(inputImageTexture, blurCoordinates[3]).g;\n    sampleColor += texture2D(inputImageTexture, blurCoordinates[4]).g;\n    sampleColor += texture2D(inputImageTexture, blurCoordinates[5]).g;\n    sampleColor += texture2D(inputImageTexture, blurCoordinates[6]).g;\n    sampleColor += texture2D(inputImageTexture, blurCoordinates[7]).g;\n    sampleColor += texture2D(inputImageTexture, blurCoordinates[8]).g;\n    sampleColor += texture2D(inputImageTexture, blurCoordinates[9]).g;\n    sampleColor += texture2D(inputImageTexture, blurCoordinates[10]).g;\n    sampleColor += texture2D(inputImageTexture, blurCoordinates[11]).g;\n    sampleColor += texture2D(inputImageTexture, blurCoordinates[12]).g * 2.0;\n    sampleColor += texture2D(inputImageTexture, blurCoordinates[13]).g * 2.0;\n    sampleColor += texture2D(inputImageTexture, blurCoordinates[14]).g * 2.0;\n    sampleColor += texture2D(inputImageTexture, blurCoordinates[15]).g * 2.0;\n    sampleColor += texture2D(inputImageTexture, blurCoordinates[16]).g * 2.0;\n    sampleColor += texture2D(inputImageTexture, blurCoordinates[17]).g * 2.0;\n    sampleColor += texture2D(inputImageTexture, blurCoordinates[18]).g * 2.0;\n    sampleColor += texture2D(inputImageTexture, blurCoordinates[19]).g * 2.0;\n\n    sampleColor = sampleColor / 48.0;\n\n    float highPass = centralColor.g - sampleColor + 0.5;\n\n    for(int i = 0; i < 5;i++)\n    {\n        highPass = hardLight(highPass);\n    }\n    float luminance = dot(centralColor, W);\n\n    float alpha = pow(luminance, params);\n\n    vec3 smoothColor = centralColor + (centralColor-vec3(highPass))*alpha*0.1;\n\n    gl_FragColor = vec4(mix(smoothColor.rgb, max(smoothColor, centralColor), alpha), 1.0);\n}"
  },
  {
    "path": "MagicShow/src/main/res/raw/blackcat.glsl",
    "content": "varying highp vec2 textureCoordinate;\nprecision highp float; \n\nuniform sampler2D inputImageTexture;\nuniform sampler2D curve; \nvec3 rgb2hsv(vec3 c) \n{ \n\tvec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0); \n\tvec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g)); \n\tvec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r)); \n\t\n\tfloat d = q.x - min(q.w, q.y); \n\tfloat e = 1.0e-10; \n    return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x); \n} \n\nvec3 hsv2rgb(vec3 c) { \n\tvec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0); \n\tvec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www); \n\treturn c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y); \n} \n\nvoid main() \n{ \n    float GreyVal; \n\tlowp vec4 textureColor; \n    lowp vec4 textureColorOri; \n\tfloat xCoordinate = textureCoordinate.x; \n\tfloat yCoordinate = textureCoordinate.y; \n\n\thighp float redCurveValue; \n\thighp float greenCurveValue; \n\thighp float blueCurveValue; \n\ttextureColor = texture2D( inputImageTexture, vec2(xCoordinate, yCoordinate)); \n\t// step1 curve \n\tredCurveValue = texture2D(curve, vec2(textureColor.r, 0.0)).r; \n\tgreenCurveValue = texture2D(curve, vec2(textureColor.g, 0.0)).g; \n\tblueCurveValue = texture2D(curve, vec2(textureColor.b, 0.0)).b; \n\n\n\t//textureColor = vec4(redCurveValue, greenCurveValue, blueCurveValue, 1.0); \n\tvec3 tColor = vec3(redCurveValue, greenCurveValue, blueCurveValue); \n\ttColor = rgb2hsv(tColor);\n\n\ttColor.g = tColor.g * 1.2; \n\n\tfloat dStrength = 1.0; \n\tfloat dSatStrength = 0.3; \n\n\tfloat dGap = 0.0; \n\n\tif( tColor.r >= 0.0 && tColor.r < 0.417) \n\t{ \n\t\ttColor.g = tColor.g + (tColor.g * dSatStrength); \n\t} \n\telse if( tColor.r > 0.958 && tColor.r <= 1.0) \n\t{ \n\t\ttColor.g = tColor.g + (tColor.g * dSatStrength);\n\t} \n\telse if( tColor.r >= 0.875 && tColor.r <= 0.958) \n\t{ \n\t\tdGap = abs(tColor.r - 0.875); \n\t\tdStrength = (dGap / 0.0833); \n\t\t\n\t\ttColor.g = tColor.g + (tColor.g * dSatStrength * dStrength);\n\t} \n\telse if( tColor.r >= 0.0417 && tColor.r <= 0.125) \n\t{ \n\t\tdGap = abs(tColor.r - 0.125); \n\t\tdStrength = (dGap / 0.0833);\n\n\t\ttColor.g = tColor.g + (tColor.g * dSatStrength * dStrength); \n\t} \n\n\ttColor = hsv2rgb(tColor); \n\ttColor = clamp(tColor, 0.0, 1.0); \n\n\tredCurveValue = texture2D(curve, vec2(tColor.r, 1.0)).r; \n\tgreenCurveValue = texture2D(curve, vec2(tColor.g, 1.0)).r; \n\tblueCurveValue = texture2D(curve, vec2(tColor.b, 1.0)).r; \n\n\tredCurveValue = texture2D(curve, vec2(redCurveValue, 1.0)).g; \n\tgreenCurveValue = texture2D(curve, vec2(greenCurveValue, 1.0)).g; \n\tblueCurveValue = texture2D(curve, vec2(blueCurveValue, 1.0)).g; \n\n\ttextureColor = vec4(redCurveValue, greenCurveValue, blueCurveValue, 1.0); \n\n\tgl_FragColor = vec4(textureColor.r, textureColor.g, textureColor.b, 1.0); \n}"
  },
  {
    "path": "MagicShow/src/main/res/raw/brannan.glsl",
    "content": "precision mediump float;\n \n varying mediump vec2 textureCoordinate;\n \n uniform sampler2D inputImageTexture;\n uniform sampler2D inputImageTexture2;  //process\n uniform sampler2D inputImageTexture3;  //blowout\n uniform sampler2D inputImageTexture4;  //contrast\n uniform sampler2D inputImageTexture5;  //luma\n uniform sampler2D inputImageTexture6;  //screen\n \n mat3 saturateMatrix = mat3(\n                            1.105150, -0.044850,-0.046000,\n                            -0.088050,1.061950,-0.089200,\n                            -0.017100,-0.017100,1.132900);\n \n vec3 luma = vec3(.3, .59, .11);\n \n uniform float strength;\n\n void main()\n {\n     vec4 originColor = texture2D(inputImageTexture, textureCoordinate);\n     vec3 texel = texture2D(inputImageTexture, textureCoordinate).rgb;\n     \n     vec2 lookup;\n     lookup.y = 0.5;\n     lookup.x = texel.r;\n     texel.r = texture2D(inputImageTexture2, lookup).r;\n     lookup.x = texel.g;\n     texel.g = texture2D(inputImageTexture2, lookup).g;\n     lookup.x = texel.b;\n     texel.b = texture2D(inputImageTexture2, lookup).b;\n     \n     texel = saturateMatrix * texel;\n     \n     \n     vec2 tc = (2.0 * textureCoordinate) - 1.0;\n     float d = dot(tc, tc);\n     vec3 sampled;\n     lookup.y = 0.5;\n     lookup.x = texel.r;\n     sampled.r = texture2D(inputImageTexture3, lookup).r;\n     lookup.x = texel.g;\n     sampled.g = texture2D(inputImageTexture3, lookup).g;\n     lookup.x = texel.b;\n     sampled.b = texture2D(inputImageTexture3, lookup).b;\n     float value = smoothstep(0.0, 1.0, d);\n     texel = mix(sampled, texel, value);\n     \n     lookup.x = texel.r;\n     texel.r = texture2D(inputImageTexture4, lookup).r;\n     lookup.x = texel.g;\n     texel.g = texture2D(inputImageTexture4, lookup).g;\n     lookup.x = texel.b;\n     texel.b = texture2D(inputImageTexture4, lookup).b;\n     \n     \n     lookup.x = dot(texel, luma);\n     texel = mix(texture2D(inputImageTexture5, lookup).rgb, texel, .5);\n     \n     lookup.x = texel.r;\n     texel.r = texture2D(inputImageTexture6, lookup).r;\n     lookup.x = texel.g;\n     texel.g = texture2D(inputImageTexture6, lookup).g;\n     lookup.x = texel.b;\n     texel.b = texture2D(inputImageTexture6, lookup).b;\n     \n     texel = mix(originColor.rgb, texel.rgb, strength);\n\n     gl_FragColor = vec4(texel, 1.0);\n }"
  },
  {
    "path": "MagicShow/src/main/res/raw/brooklyn.glsl",
    "content": " precision mediump float;\n varying mediump vec2 textureCoordinate;\n \n uniform sampler2D inputImageTexture;\n uniform sampler2D inputImageTexture2;\n uniform sampler2D inputImageTexture3;\n uniform sampler2D inputImageTexture4;\n \n uniform float strength;\n\n // gray\n float NCGray(vec4 color)\n{\n    float gray = 0.2125 * color.r + 0.7154 * color.g + 0.0721 * color.b;\n    \n    return gray;\n}\n \n // tone mapping\n vec4 NCTonemapping(vec4 color)\n{\n    \n    vec4 mapped;\n    mapped.r = texture2D(inputImageTexture2, vec2(color.r, 0.0)).r;\n    mapped.g = texture2D(inputImageTexture2, vec2(color.g, 0.0)).g;\n    mapped.b = texture2D(inputImageTexture2, vec2(color.b, 0.0)).b;\n    mapped.a = color.a;\n    \n    return mapped;\n}\n \n // color control\n vec4 NCColorControl(vec4 color, float saturation, float brightness, float contrast)\n{\n    float gray = NCGray(color);\n    \n    color.rgb = vec3(saturation) * color.rgb + vec3(1.0-saturation) * vec3(gray);\n    color.r = clamp(color.r, 0.0, 1.0);\n    color.g = clamp(color.g, 0.0, 1.0);\n    color.b = clamp(color.b, 0.0, 1.0);\n    \n    color.rgb = vec3(contrast) * (color.rgb - vec3(0.5)) + vec3(0.5);\n    color.r = clamp(color.r, 0.0, 1.0);\n    color.g = clamp(color.g, 0.0, 1.0);\n    color.b = clamp(color.b, 0.0, 1.0);\n    \n    color.rgb = color.rgb + vec3(brightness);\n    color.r = clamp(color.r, 0.0, 1.0);\n    color.g = clamp(color.g, 0.0, 1.0);\n    color.b = clamp(color.b, 0.0, 1.0);\n    \n    return color;\n}\n \n // hue adjust\n vec4 NCHueAdjust(vec4 color, float hueAdjust)\n{\n    vec3 kRGBToYPrime = vec3(0.299, 0.587, 0.114);\n    vec3 kRGBToI = vec3(0.595716, -0.274453, -0.321263);\n    vec3 kRGBToQ = vec3(0.211456, -0.522591, 0.31135);\n    \n    vec3 kYIQToR   = vec3(1.0, 0.9563, 0.6210);\n    vec3 kYIQToG   = vec3(1.0, -0.2721, -0.6474);\n    vec3 kYIQToB   = vec3(1.0, -1.1070, 1.7046);\n    \n    float yPrime = dot(color.rgb, kRGBToYPrime);\n    float I = dot(color.rgb, kRGBToI);\n    float Q = dot(color.rgb, kRGBToQ);\n    \n    float hue = atan(Q, I);\n    float chroma  = sqrt (I * I + Q * Q);\n    \n    hue -= hueAdjust;\n    \n    Q = chroma * sin (hue);\n    I = chroma * cos (hue);\n    \n    color.r = dot(vec3(yPrime, I, Q), kYIQToR);\n    color.g = dot(vec3(yPrime, I, Q), kYIQToG);\n    color.b = dot(vec3(yPrime, I, Q), kYIQToB);\n    \n    return color;\n}\n \n // colorMatrix\n vec4 NCColorMatrix(vec4 color, float red, float green, float blue, float alpha, vec4 bias)\n{\n    color = color * vec4(red, green, blue, alpha) + bias;\n    \n    return color;\n}\n \n // multiply blend\n vec4 NCMultiplyBlend(vec4 overlay, vec4 base)\n{\n    vec4 outputColor;\n    \n    float a = overlay.a + base.a * (1.0 - overlay.a);\n    \n    //    // normal blend\n    //    outputColor.r = (base.r * base.a + overlay.r * overlay.a * (1.0 - base.a))/a;\n    //    outputColor.g = (base.g * base.a + overlay.g * overlay.a * (1.0 - base.a))/a;\n    //    outputColor.b = (base.b * base.a + overlay.b * overlay.a * (1.0 - base.a))/a;\n    \n    \n    // multiply blend\n    outputColor.rgb = ((1.0-base.a) * overlay.rgb * overlay.a + (1.0-overlay.a) * base.rgb * base.a + overlay.a * base.a * overlay.rgb * base.rgb) / a;\n    \n    \n    outputColor.a = a;\n    \n    return outputColor;\n}\n \n void main()\n{\n    vec4 originColor = texture2D(inputImageTexture, textureCoordinate);\n    vec4 color = texture2D(inputImageTexture, textureCoordinate);\n    \n    color.a = 1.0;\n    \n    // tone mapping\n    color.r = texture2D(inputImageTexture2, vec2(color.r, 0.0)).r;\n    color.g = texture2D(inputImageTexture2, vec2(color.g, 0.0)).g;\n    color.b = texture2D(inputImageTexture2, vec2(color.b, 0.0)).b;\n    \n    // color control\n    color = NCColorControl(color, 0.88, 0.03, 0.85);\n    \n    // hue adjust\n    color = NCHueAdjust(color, -0.0444);\n    \n    // normal blend\n    vec4 bg = vec4(0.5647, 0.1961, 0.0157, 0.14);\n    color = NCMultiplyBlend(bg, color);\n    \n    // normal blend\n    vec4 bg2 = texture2D(inputImageTexture3, textureCoordinate);\n    bg2.a *= 0.9;\n    color = NCMultiplyBlend(bg2, color);\n    \n    // tone mapping\n    color.r = texture2D(inputImageTexture4, vec2(color.r, 0.0)).r;\n    color.g = texture2D(inputImageTexture4, vec2(color.g, 0.0)).g;\n    color.b = texture2D(inputImageTexture4, vec2(color.b, 0.0)).b;\n    \n    color.rgb = mix(originColor.rgb, color.rgb, strength);\n    gl_FragColor = color;\n}"
  },
  {
    "path": "MagicShow/src/main/res/raw/calm.glsl",
    "content": "varying highp vec2 textureCoordinate;\n\nprecision highp float;\n\nuniform sampler2D inputImageTexture;\nuniform sampler2D grey1Frame; \nuniform sampler2D grey2Frame;\nuniform sampler2D curve;\n\nconst mediump vec3 luminanceWeighting = vec3(0.2125, 0.7154, 0.0721);\n\nvoid main()\n{\n\tlowp float satura = 0.5;\n\tfloat GreyVal;\n\tlowp vec4 textureColor;\n\tlowp vec4 textureColorRes;\n\t\n\thighp float redCurveValue;\n\thighp float greenCurveValue;\n\thighp float blueCurveValue;\n\t\n\tvec4 grey1Color;\n\tvec4 grey2Color;\n\t\n\tfloat xCoordinate = textureCoordinate.x;\n\tfloat yCoordinate = textureCoordinate.y;\n\t\n\ttextureColor = texture2D( inputImageTexture, vec2(xCoordinate, yCoordinate));\n\ttextureColorRes = textureColor; \n\t\n\tgrey1Color = texture2D(grey1Frame, vec2(xCoordinate, yCoordinate));\n\tgrey2Color = texture2D(grey2Frame, vec2(xCoordinate, yCoordinate));\n\t\n\t// step 1. saturation \n\tlowp float luminance = dot(textureColor.rgb, luminanceWeighting);\n\tlowp vec3 greyScaleColor = vec3(luminance);\n\t\n\ttextureColor = vec4(mix(greyScaleColor, textureColor.rgb, satura), textureColor.w); \n\t\n\t// step 2. level, blur curve, rgb curve\n\tredCurveValue = texture2D(curve, vec2(textureColor.r, 0.0)).r;\n\tredCurveValue = texture2D(curve, vec2(redCurveValue, 1.0/2.0)).r;\n\t\n\tgreenCurveValue = texture2D(curve, vec2(textureColor.g, 0.0)).g;\n\tgreenCurveValue = texture2D(curve, vec2(greenCurveValue, 1.0/2.0)).g;\n\t\n\tblueCurveValue = texture2D(curve, vec2(textureColor.b, 0.0)).b;\n\tblueCurveValue = texture2D(curve, vec2(blueCurveValue, 1.0/2.0)).b;\n\tblueCurveValue = texture2D(curve, vec2(blueCurveValue, 1.0/2.0)).g;\n\t\n\tlowp vec4 base = vec4(redCurveValue, greenCurveValue, blueCurveValue, 1.0);\n\t\n\tredCurveValue = texture2D(curve, vec2(redCurveValue, 1.0)).r;\n\tgreenCurveValue = texture2D(curve, vec2(greenCurveValue, 1.0)).r;\n\tblueCurveValue = texture2D(curve, vec2(blueCurveValue, 1.0)).r;\n\tlowp vec4 overlayer = vec4(redCurveValue, greenCurveValue, blueCurveValue, 1.0); \n\t//gl_FragColor = base * (1.0 - grey1Color.r) + overlayer * grey1Color.r;\n\tbase = (base - overlayer) * (1.0 - grey1Color.r) + overlayer;\n\t\n\tredCurveValue = texture2D(curve, vec2(base.r, 1.0)).g;\n\tgreenCurveValue = texture2D(curve, vec2(base.g, 1.0)).g;\n\tblueCurveValue = texture2D(curve, vec2(base.b, 1.0)).g;\n\toverlayer = vec4(redCurveValue, greenCurveValue, blueCurveValue, 1.0);\n\t\n\ttextureColor = (base - overlayer) * (1.0 - grey2Color.r) + overlayer;\n\t//base * (grey2Color.r) + overlayer * (1.0 - grey2Color.r);\n\t\n\tgl_FragColor = vec4(textureColor.r, textureColor.g, textureColor.b, 1.0); \n}"
  },
  {
    "path": "MagicShow/src/main/res/raw/cool.glsl",
    "content": "varying highp vec2 textureCoordinate;\nprecision highp float;\n\nuniform sampler2D inputImageTexture;\nuniform sampler2D curve;\n\nvoid main()\n{ \n\tlowp vec4 textureColor;\n\tlowp vec4 textureColorOri;\n\t\n\tfloat xCoordinate = textureCoordinate.x;\n\tfloat yCoordinate = textureCoordinate.y;\n\t\n\thighp float redCurveValue;\n\thighp float greenCurveValue;\n\thighp float blueCurveValue;\n\t\n\ttextureColor = texture2D( inputImageTexture, vec2(xCoordinate, yCoordinate));\n\ttextureColorOri = textureColor;\n\t// step1 curve \n\tredCurveValue = texture2D(curve, vec2(textureColor.r, 0.0)).r;\n\tgreenCurveValue = texture2D(curve, vec2(textureColor.g, 0.0)).g;\n\tblueCurveValue = texture2D(curve, vec2(textureColor.b, 0.0)).b;\n\t// step2 level\n\tredCurveValue = texture2D(curve, vec2(redCurveValue, 0.0)).a;\n\tgreenCurveValue = texture2D(curve, vec2(greenCurveValue, 0.0)).a;\n\tblueCurveValue = texture2D(curve, vec2(blueCurveValue, 0.0)).a;\n\t// step3 brightness/constrast adjust \n\tredCurveValue = redCurveValue * 1.25 - 0.12549;\n\tgreenCurveValue = greenCurveValue * 1.25 - 0.12549; \n\tblueCurveValue = blueCurveValue * 1.25 - 0.12549;\n\t//redCurveValue = (((redCurveValue) > (1.0)) ? (1.0) : (((redCurveValue) < (0.0)) ? (0.0) : (redCurveValue)));\n\t//greenCurveValue = (((greenCurveValue) > (1.0)) ? (1.0) : (((greenCurveValue) < (0.0)) ? (0.0) : (greenCurveValue)));\n\t//blueCurveValue = (((blueCurveValue) > (1.0)) ? (1.0) : (((blueCurveValue) < (0.0)) ? (0.0) : (blueCurveValue)));\n\t// step4 normal blending with original\n\ttextureColor = vec4(redCurveValue, greenCurveValue, blueCurveValue, 1.0);\n\ttextureColor = (textureColorOri - textureColor) * 0.549 + textureColor;\n\t\n\tgl_FragColor = vec4(textureColor.r, textureColor.g, textureColor.b, 1.0);\n} \n  "
  },
  {
    "path": "MagicShow/src/main/res/raw/crayon.glsl",
    "content": "varying highp vec2 textureCoordinate;\nprecision mediump float;\n\nuniform sampler2D inputImageTexture;\nuniform vec2 singleStepOffset; \nuniform float strength;\n\nconst highp vec3 W = vec3(0.299,0.587,0.114);\n\nconst mat3 rgb2yiqMatrix = mat3(\n\t\t0.299, 0.587, 0.114,\n\t\t0.596,-0.275,-0.321,\n\t\t0.212,-0.523, 0.311);\n\nconst mat3 yiq2rgbMatrix = mat3(\n\t\t1.0, 0.956, 0.621,\n\t\t1.0,-0.272,-1.703,\n\t\t1.0,-1.106, 0.0);\n\n\nvoid main()\n{ \n\tvec4 oralColor = texture2D(inputImageTexture, textureCoordinate);\n\n\tvec3 maxValue = vec3(0.,0.,0.);\n\t\n\tfor(int i = -2; i<=2; i++)\n\t{\n\t\tfor(int j = -2; j<=2; j++)\n\t\t{\n\t\t\tvec4 tempColor = texture2D(inputImageTexture, textureCoordinate+singleStepOffset*vec2(i,j));\n\t\t\tmaxValue.r = max(maxValue.r,tempColor.r);\n\t\t\tmaxValue.g = max(maxValue.g,tempColor.g);\n\t\t\tmaxValue.b = max(maxValue.b,tempColor.b);\n\t\t}\n\t}\n\t\n\tvec3 textureColor = oralColor.rgb / maxValue;\n\t\n\tfloat gray = dot(textureColor, W);\n\tfloat k = 0.223529;\n\tfloat alpha = min(gray,k)/k;\n\t\n\ttextureColor = textureColor * alpha + (1.-alpha)*oralColor.rgb;\n\t\n\tvec3 yiqColor = textureColor * rgb2yiqMatrix;\n\n\tyiqColor.r = max(0.0,min(1.0,pow(gray,strength)));\n\n\ttextureColor = yiqColor * yiq2rgbMatrix;\n\t\n\tgl_FragColor = vec4(textureColor, oralColor.w);\n} "
  },
  {
    "path": "MagicShow/src/main/res/raw/default_fragment.glsl",
    "content": "#extension GL_OES_EGL_image_external : require\n\nprecision mediump float;\n\nvarying mediump vec2 textureCoordinate;\n\nuniform samplerExternalOES inputImageTexture;\nuniform vec2 singleStepOffset;\nuniform mediump float params;\n\nconst highp vec3 W = vec3(0.299,0.587,0.114);\nvec2 blurCoordinates[20];\n\nfloat hardLight(float color)\n{\n\tif(color <= 0.5)\n\t\tcolor = color * color * 2.0;\n\telse\n\t\tcolor = 1.0 - ((1.0 - color)*(1.0 - color) * 2.0);\n\treturn color;\n}\n\nvoid main(){\n\n    vec3 centralColor = texture2D(inputImageTexture, textureCoordinate).rgb;\n    if(params != 0.0){\n\n        blurCoordinates[0] = textureCoordinate.xy + singleStepOffset * vec2(0.0, -10.0);\n        blurCoordinates[1] = textureCoordinate.xy + singleStepOffset * vec2(0.0, 10.0);\n        blurCoordinates[2] = textureCoordinate.xy + singleStepOffset * vec2(-10.0, 0.0);\n        blurCoordinates[3] = textureCoordinate.xy + singleStepOffset * vec2(10.0, 0.0);\n        blurCoordinates[4] = textureCoordinate.xy + singleStepOffset * vec2(5.0, -8.0);\n        blurCoordinates[5] = textureCoordinate.xy + singleStepOffset * vec2(5.0, 8.0);\n        blurCoordinates[6] = textureCoordinate.xy + singleStepOffset * vec2(-5.0, 8.0);\n        blurCoordinates[7] = textureCoordinate.xy + singleStepOffset * vec2(-5.0, -8.0);\n        blurCoordinates[8] = textureCoordinate.xy + singleStepOffset * vec2(8.0, -5.0);\n        blurCoordinates[9] = textureCoordinate.xy + singleStepOffset * vec2(8.0, 5.0);\n        blurCoordinates[10] = textureCoordinate.xy + singleStepOffset * vec2(-8.0, 5.0);\n        blurCoordinates[11] = textureCoordinate.xy + singleStepOffset * vec2(-8.0, -5.0);\n        blurCoordinates[12] = textureCoordinate.xy + singleStepOffset * vec2(0.0, -6.0);\n        blurCoordinates[13] = textureCoordinate.xy + singleStepOffset * vec2(0.0, 6.0);\n        blurCoordinates[14] = textureCoordinate.xy + singleStepOffset * vec2(6.0, 0.0);\n        blurCoordinates[15] = textureCoordinate.xy + singleStepOffset * vec2(-6.0, 0.0);\n        blurCoordinates[16] = textureCoordinate.xy + singleStepOffset * vec2(-4.0, -4.0);\n        blurCoordinates[17] = textureCoordinate.xy + singleStepOffset * vec2(-4.0, 4.0);\n        blurCoordinates[18] = textureCoordinate.xy + singleStepOffset * vec2(4.0, -4.0);\n        blurCoordinates[19] = textureCoordinate.xy + singleStepOffset * vec2(4.0, 4.0);\n\n        float sampleColor = centralColor.g * 20.0;\n        sampleColor += texture2D(inputImageTexture, blurCoordinates[0]).g;\n        sampleColor += texture2D(inputImageTexture, blurCoordinates[1]).g;\n        sampleColor += texture2D(inputImageTexture, blurCoordinates[2]).g;\n        sampleColor += texture2D(inputImageTexture, blurCoordinates[3]).g;\n        sampleColor += texture2D(inputImageTexture, blurCoordinates[4]).g;\n        sampleColor += texture2D(inputImageTexture, blurCoordinates[5]).g;\n        sampleColor += texture2D(inputImageTexture, blurCoordinates[6]).g;\n        sampleColor += texture2D(inputImageTexture, blurCoordinates[7]).g;\n        sampleColor += texture2D(inputImageTexture, blurCoordinates[8]).g;\n        sampleColor += texture2D(inputImageTexture, blurCoordinates[9]).g;\n        sampleColor += texture2D(inputImageTexture, blurCoordinates[10]).g;\n        sampleColor += texture2D(inputImageTexture, blurCoordinates[11]).g;\n        sampleColor += texture2D(inputImageTexture, blurCoordinates[12]).g * 2.0;\n        sampleColor += texture2D(inputImageTexture, blurCoordinates[13]).g * 2.0;\n        sampleColor += texture2D(inputImageTexture, blurCoordinates[14]).g * 2.0;\n        sampleColor += texture2D(inputImageTexture, blurCoordinates[15]).g * 2.0;\n        sampleColor += texture2D(inputImageTexture, blurCoordinates[16]).g * 2.0;\n        sampleColor += texture2D(inputImageTexture, blurCoordinates[17]).g * 2.0;\n        sampleColor += texture2D(inputImageTexture, blurCoordinates[18]).g * 2.0;\n        sampleColor += texture2D(inputImageTexture, blurCoordinates[19]).g * 2.0;\n\n        sampleColor = sampleColor / 48.0;\n\n        float highPass = centralColor.g - sampleColor + 0.5;\n\n        for(int i = 0; i < 5;i++)\n        {\n            highPass = hardLight(highPass);\n        }\n        float luminance = dot(centralColor, W);\n\n        float alpha = pow(luminance, params);\n\n        vec3 smoothColor = centralColor + (centralColor-vec3(highPass))*alpha*0.1;\n\n        gl_FragColor = vec4(mix(smoothColor.rgb, max(smoothColor, centralColor), alpha), 1.0);\n    }else{\n        gl_FragColor = vec4(centralColor.rgb,1.0);;\n    }\n}"
  },
  {
    "path": "MagicShow/src/main/res/raw/default_vertex.glsl",
    "content": "attribute vec4 position;\nattribute vec4 inputTextureCoordinate;\n\nuniform mat4 textureTransform;\nvarying vec2 textureCoordinate;\n\nvoid main()\n{\n\ttextureCoordinate = (textureTransform * inputTextureCoordinate).xy;\n\tgl_Position = position;\n}\n"
  },
  {
    "path": "MagicShow/src/main/res/raw/earlybird.glsl",
    "content": " precision mediump float;\n\n varying mediump vec2 textureCoordinate;\n\n uniform sampler2D inputImageTexture;\n uniform sampler2D inputImageTexture2; //earlyBirdCurves\n uniform sampler2D inputImageTexture3; //earlyBirdOverlay\n uniform sampler2D inputImageTexture4; //vig\n uniform sampler2D inputImageTexture5; //earlyBirdBlowout\n uniform sampler2D inputImageTexture6; //earlyBirdMap\n\n const mat3 saturate = mat3(\n                            1.210300,\n                            -0.089700,\n                            -0.091000,\n                            -0.176100,\n                            1.123900,\n                            -0.177400,\n                            -0.034200,\n                            -0.034200,\n                            1.265800);\n const vec3 rgbPrime = vec3(0.25098, 0.14640522, 0.0);\n const vec3 desaturate = vec3(.3, .59, .11);\n\n void main()\n {\n\n     vec3 texel = texture2D(inputImageTexture, textureCoordinate).rgb;\n\n\n     vec2 lookup;\n     lookup.y = 0.5;\n\n     lookup.x = texel.r;\n     texel.r = texture2D(inputImageTexture2, lookup).r;\n\n     lookup.x = texel.g;\n     texel.g = texture2D(inputImageTexture2, lookup).g;\n\n     lookup.x = texel.b;\n     texel.b = texture2D(inputImageTexture2, lookup).b;\n\n     float desaturatedColor;\n     vec3 result;\n     desaturatedColor = dot(desaturate, texel);\n\n\n     lookup.x = desaturatedColor;\n     result.r = texture2D(inputImageTexture3, lookup).r;\n     lookup.x = desaturatedColor;\n     result.g = texture2D(inputImageTexture3, lookup).g;\n     lookup.x = desaturatedColor;\n     result.b = texture2D(inputImageTexture3, lookup).b;\n\n     texel = saturate * mix(texel, result, .5);\n\n     vec2 tc = (2.0 * textureCoordinate) - 1.0;\n     float d = dot(tc, tc);\n\n     vec3 sampled;\n     lookup.y = .5;\n\n     /*\n      lookup.x = texel.r;\n      sampled.r = texture2D(inputImageTexture4, lookup).r;\n\n      lookup.x = texel.g;\n      sampled.g = texture2D(inputImageTexture4, lookup).g;\n\n      lookup.x = texel.b;\n      sampled.b = texture2D(inputImageTexture4, lookup).b;\n\n      float value = smoothstep(0.0, 1.25, pow(d, 1.35)/1.65);\n      texel = mix(texel, sampled, value);\n      */\n\n     //---\n\n     lookup = vec2(d, texel.r);\n     texel.r = texture2D(inputImageTexture4, lookup).r;\n     lookup.y = texel.g;\n     texel.g = texture2D(inputImageTexture4, lookup).g;\n     lookup.y = texel.b;\n     texel.b\t= texture2D(inputImageTexture4, lookup).b;\n     float value = smoothstep(0.0, 1.25, pow(d, 1.35)/1.65);\n\n     //---\n\n     lookup.x = texel.r;\n     sampled.r = texture2D(inputImageTexture5, lookup).r;\n     lookup.x = texel.g;\n     sampled.g = texture2D(inputImageTexture5, lookup).g;\n     lookup.x = texel.b;\n     sampled.b = texture2D(inputImageTexture5, lookup).b;\n     texel = mix(sampled, texel, value);\n\n\n     lookup.x = texel.r;\n     texel.r = texture2D(inputImageTexture6, lookup).r;\n     lookup.x = texel.g;\n     texel.g = texture2D(inputImageTexture6, lookup).g;\n     lookup.x = texel.b;\n     texel.b = texture2D(inputImageTexture6, lookup).b;\n\n     gl_FragColor = vec4(texel, 1.0);\n }\n"
  },
  {
    "path": "MagicShow/src/main/res/raw/emerald.glsl",
    "content": "varying highp vec2 textureCoordinate; \nprecision highp float; \n\nuniform sampler2D inputImageTexture; \nuniform sampler2D curve; \n\nvec3 RGBtoHSL(vec3 c) { \n\tvec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0); \n\tvec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g)); \n\tvec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r)); \n\t\n\tfloat d = q.x - min(q.w, q.y); \n\tfloat e = 1.0e-10; \n\treturn vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x); \n} \n\nvec3 HSLtoRGB(vec3 c) { \n\tvec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0); \n\tvec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www); \n\treturn c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);\n} \n\nvoid main() { \n\tfloat GreyVal;\n\thighp vec4 textureColor; \n\tfloat xCoordinate = textureCoordinate.x; \n\tfloat yCoordinate = textureCoordinate.y;\n\n\thighp float redCurveValue; \n\thighp float greenCurveValue; \n    highp float blueCurveValue; \n\n\ttextureColor = texture2D( inputImageTexture, vec2(xCoordinate, yCoordinate)); \n\t\n\t// step1 curve \n\tredCurveValue = texture2D(curve, vec2(textureColor.r, 0.0)).r; \n\tgreenCurveValue = texture2D(curve, vec2(textureColor.g, 0.0)).g; \n\tblueCurveValue = texture2D(curve, vec2(textureColor.b, 0.0)).b; \n\tvec3 tColor = vec3(redCurveValue, greenCurveValue, blueCurveValue); \n\ttColor = RGBtoHSL(tColor); \n\ttColor = clamp(tColor, 0.0, 1.0); \n\n\ttColor.g = tColor.g * 1.5; \n\n\tfloat dStrength = 1.0; \n\tfloat dSatStrength = 0.15; \n    float dHueStrength = 0.08; \n\n\tfloat dGap = 0.0; \n\n\tif( tColor.r >= 0.625 && tColor.r <= 0.708)\n\t{ \n\t\ttColor.r = tColor.r - (tColor.r * dHueStrength); \n        tColor.g = tColor.g + (tColor.g * dSatStrength); \t\t\n\t} \n\telse if( tColor.r >= 0.542 && tColor.r < 0.625) \n\t{ \n\t\tdGap = abs(tColor.r - 0.542); \n\t\tdStrength = (dGap / 0.0833); \n\n\t\ttColor.r = tColor.r + (tColor.r * dHueStrength * dStrength); \n\t\ttColor.g = tColor.g + (tColor.g * dSatStrength * dStrength); \n\t} \n\telse if( tColor.r > 0.708 && tColor.r <= 0.792)\n\t{ \n\t\tdGap = abs(tColor.r - 0.792); \n\t\tdStrength = (dGap / 0.0833);\n\n\t\ttColor.r = tColor.r + (tColor.r * dHueStrength * dStrength);\n\t\ttColor.g = tColor.g + (tColor.g * dSatStrength * dStrength); \n\t} \n\t\n\ttColor = HSLtoRGB(tColor); \n\ttColor = clamp(tColor, 0.0, 1.0); \n\t\n\tredCurveValue = texture2D(curve, vec2(tColor.r, 1.0)).r; \n\tgreenCurveValue = texture2D(curve, vec2(tColor.g, 1.0)).r;\n\tblueCurveValue = texture2D(curve, vec2(tColor.b, 1.0)).r; \n\n    redCurveValue = texture2D(curve, vec2(redCurveValue, 1.0)).g; \n\tgreenCurveValue = texture2D(curve, vec2(greenCurveValue, 1.0)).g; \n\tblueCurveValue = texture2D(curve, vec2(blueCurveValue, 1.0)).g; \n\n\ttextureColor = vec4(redCurveValue, greenCurveValue, blueCurveValue, 1.0); \n    gl_FragColor = vec4(textureColor.r, textureColor.g, textureColor.b, 1.0); \n}\n"
  },
  {
    "path": "MagicShow/src/main/res/raw/evergreen.glsl",
    "content": "varying highp vec2 textureCoordinate;\nprecision highp float;\n \nuniform sampler2D inputImageTexture;\nuniform sampler2D curve;\n\nvec3 RGBtoHSL(vec3 c) \n{ \n\tvec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0); \n\tvec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g)); \n\tvec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));\n\t\n\tfloat d = q.x - min(q.w, q.y); \n\tfloat e = 1.0e-10; \n\treturn vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);\n} \n\nvec3 HSLtoRGB(vec3 c) \n{ \n\tvec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0); \n\tvec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www); \n\treturn c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y); \n} \n\nvoid main()\n{ \n\tfloat GreyVal; \n\tlowp vec4 textureColor; \n\tfloat xCoordinate = textureCoordinate.x; \n\tfloat yCoordinate = textureCoordinate.y; \n\t\n\thighp float redCurveValue; \n\thighp float greenCurveValue;\n\thighp float blueCurveValue; \n\t\n\ttextureColor = texture2D( inputImageTexture, vec2(xCoordinate, yCoordinate)); \n\t\n\tvec3 tColor = vec3(textureColor.r, textureColor.g, textureColor.b); \n\n\ttColor = RGBtoHSL(tColor); \n\ttColor = clamp(tColor, 0.0, 1.0); \n\n\t\n\ttColor.g = tColor.g * 1.3; \n\t\n\tfloat dStrength = 1.0; \n\tfloat dSatStrength = 0.5; \n\tfloat dGap = 0.0; \n\n\t\n\tif( tColor.r >= 0.292 && tColor.r <= 0.375) \n\t{ \n\t\ttColor.g = tColor.g + (tColor.g * dSatStrength); \n\t} \n\telse if( tColor.r >= 0.208 && tColor.r < 0.292) \n\t{ \n\t\tdGap = abs(tColor.r - 0.208); \n\t\tdStrength = (dGap / 0.0833); \n\n        tColor.g = tColor.g + (tColor.g * dSatStrength * dStrength); \n\t} \n\telse if( tColor.r > 0.375 && tColor.r <= 0.458) \n\t{ \n\t\tdGap = abs(tColor.r - 0.458); \n\t\tdStrength = (dGap / 0.0833); \n\t\t\n\t\ttColor.g = tColor.g + (tColor.g * dSatStrength * dStrength); \n\t} \n\ttColor = HSLtoRGB(tColor);\n\ttColor = clamp(tColor, 0.0, 1.0); \n\t\n    redCurveValue = texture2D(curve, vec2(tColor.r, 0.0)).b; \n\tgreenCurveValue = texture2D(curve, vec2(tColor.g, 0.0)).b; \n\tblueCurveValue = texture2D(curve, vec2(tColor.b, 0.0)).b; \n\tredCurveValue = texture2D(curve, vec2(redCurveValue, 0.0)).r; \n\tblueCurveValue = texture2D(curve, vec2(blueCurveValue, 0.0)).g; \n\n\ttextureColor = vec4(redCurveValue, greenCurveValue, blueCurveValue, 1.0); \n\n\tgl_FragColor = vec4(textureColor.r, textureColor.g, textureColor.b, 1.0);\n}"
  },
  {
    "path": "MagicShow/src/main/res/raw/freud.glsl",
    "content": " precision highp float;\n varying mediump vec2 textureCoordinate;\n \n uniform sampler2D inputImageTexture;\n uniform sampler2D inputImageTexture2;\n \n uniform float inputImageTextureHeight;\n uniform float inputImageTextureWidth;\n \n float texture2Size = 1024.0;\n \n uniform float strength;\n\n // gray\n float NCGray(vec4 color)\n{\n    float gray = 0.2125 * color.r + 0.7154 * color.g + 0.0721 * color.b;\n    \n    return gray;\n}\n \n // tone mapping\n vec4 NCTonemapping(vec4 color)\n{\n    \n    vec4 mapped;\n    mapped.r = texture2D(inputImageTexture2, vec2(color.r, 0.0)).r;\n    mapped.g = texture2D(inputImageTexture2, vec2(color.g, 0.0)).g;\n    mapped.b = texture2D(inputImageTexture2, vec2(color.b, 0.0)).b;\n    mapped.a = color.a;\n    \n    return mapped;\n}\n \n // color control\n vec4 NCColorControl(vec4 color, float saturation, float brightness, float contrast)\n{\n    float gray = NCGray(color);\n    \n    color.rgb = vec3(saturation) * color.rgb + vec3(1.0-saturation) * vec3(gray);\n    color.r = clamp(color.r, 0.0, 1.0);\n    color.g = clamp(color.g, 0.0, 1.0);\n    color.b = clamp(color.b, 0.0, 1.0);\n    \n    color.rgb = vec3(contrast) * (color.rgb - vec3(0.5)) + vec3(0.5);\n    color.r = clamp(color.r, 0.0, 1.0);\n    color.g = clamp(color.g, 0.0, 1.0);\n    color.b = clamp(color.b, 0.0, 1.0);\n    \n    color.rgb = color.rgb + vec3(brightness);\n    color.r = clamp(color.r, 0.0, 1.0);\n    color.g = clamp(color.g, 0.0, 1.0);\n    color.b = clamp(color.b, 0.0, 1.0);\n    \n    return color;\n}\n \n // hue adjust\n vec4 NCHueAdjust(vec4 color, float hueAdjust)\n{\n    vec3 kRGBToYPrime = vec3(0.299, 0.587, 0.114);\n    vec3 kRGBToI = vec3(0.595716, -0.274453, -0.321263);\n    vec3 kRGBToQ = vec3(0.211456, -0.522591, 0.31135);\n    \n    vec3 kYIQToR   = vec3(1.0, 0.9563, 0.6210);\n    vec3 kYIQToG   = vec3(1.0, -0.2721, -0.6474);\n    vec3 kYIQToB   = vec3(1.0, -1.1070, 1.7046);\n    \n    float yPrime = dot(color.rgb, kRGBToYPrime);\n    float I = dot(color.rgb, kRGBToI);\n    float Q = dot(color.rgb, kRGBToQ);\n    \n    float hue = atan(Q, I);\n    float chroma  = sqrt (I * I + Q * Q);\n    \n    hue -= hueAdjust;\n    \n    Q = chroma * sin (hue);\n    I = chroma * cos (hue);\n    \n    color.r = dot(vec3(yPrime, I, Q), kYIQToR);\n    color.g = dot(vec3(yPrime, I, Q), kYIQToG);\n    color.b = dot(vec3(yPrime, I, Q), kYIQToB);\n    \n    return color;\n}\n \n // colorMatrix\n vec4 NCColorMatrix(vec4 color, float red, float green, float blue, float alpha, vec4 bias)\n{\n    color = color * vec4(red, green, blue, alpha) + bias;\n    \n    return color;\n}\n \n // multiply blend\n vec4 NCMultiplyBlend(vec4 overlay, vec4 base)\n{\n    vec4 outputColor;\n    \n    float a = overlay.a + base.a * (1.0 - overlay.a);\n    \n    //    // normal blend\n    //    outputColor.r = (base.r * base.a + overlay.r * overlay.a * (1.0 - base.a))/a;\n    //    outputColor.g = (base.g * base.a + overlay.g * overlay.a * (1.0 - base.a))/a;\n    //    outputColor.b = (base.b * base.a + overlay.b * overlay.a * (1.0 - base.a))/a;\n    \n    \n    // multiply blend\n    outputColor.rgb = ((1.0-base.a) * overlay.rgb * overlay.a + (1.0-overlay.a) * base.rgb * base.a + overlay.a * base.a * overlay.rgb * base.rgb) / a;\n    \n    \n    outputColor.a = a;\n    \n    return outputColor;\n}\n \n // xy should be a integer position (e.g. pixel position on the screen)\n // similar to a texture lookup but is only ALU\n float PseudoRandom(vec2 co)\n{\n    //    return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);\n    mediump float a = 12.9898;\n    mediump float b = 78.233;\n    mediump float c = 43758.5453;\n    mediump float dt= dot(co.xy ,vec2(a,b));\n    mediump float sn= mod(dt,3.14);\n    return fract(sin(sn) * c);\n}\n \n void main()\n{\n    vec4 originColor = texture2D(inputImageTexture, textureCoordinate);\n    vec4 color = texture2D(inputImageTexture, textureCoordinate);\n    \n    color.a = 1.0;\n    \n    // color control\n//    color = NCColorControl(color, 0.6, -0.06, 0.75);\n    color = NCColorControl(color, 0.5, 0.1, 0.9);\n    \n    // rand\n\t  float x = textureCoordinate.x*inputImageTextureWidth/texture2Size;\n      float y = textureCoordinate.y*inputImageTextureHeight/texture2Size;\n\n      vec4 rd = texture2D(inputImageTexture2, vec2( fract(x), fract(y)));\n//    vec4 rd = texture2D(inputImageTexture2, textureCoordinate);\n//    float rand_number1 = PseudoRandom(textureCoordinate.xy);\n//    float rand_number2 = PseudoRandom(textureCoordinate.yx);\n//    float rand_number3 = PseudoRandom(vec2(rand_number1, rand_number2));\n//    float rand_number4 = PseudoRandom(vec2(rand_number2, rand_number1));\n//    float rand_number5 = PseudoRandom(vec2(rand_number3, rand_number4));\n    \n//    vec4 rd = vec4(rand_number1, rand_number3, rand_number5, 1.0);\n    \n//    if(rand_number4>0.2)\n//        rd = vec4(1.0);\n    \n    // rand color control\n//    rd = NCColorControl(rd, 0.65, 0.1, 0.7);\n    rd = NCColorControl(rd, 1.0, 0.4, 1.2);\n    \n    // normal blend\n//    rd.a *= 1.0;\n    color = NCMultiplyBlend(rd, color);\n    \n    // color matrix\n//    color = NCColorMatrix(color, 1.0, 1.0, 1.0, 1.0, vec4(-0.1, -0.1, -0.1, 0));\n    color = NCColorMatrix(color, 1.0, 1.0, 1.0, 1.0, vec4(-0.15, -0.15, -0.15, 0));\n    \n    color.rgb = mix(originColor.rgb, color.rgb, strength);\n    gl_FragColor = color;\n}"
  },
  {
    "path": "MagicShow/src/main/res/raw/healthy.glsl",
    "content": "precision mediump float; \n\nuniform sampler2D inputImageTexture; \nuniform sampler2D curve; \nuniform sampler2D mask;\n\nuniform float texelWidthOffset ;\n\nuniform float texelHeightOffset;\n\nvarying mediump vec2 textureCoordinate;\n\n\nvec4 level0c(vec4 color, sampler2D sampler) \n{ \n\tcolor.r = texture2D(sampler, vec2(color.r, 0.)).r; \n\tcolor.g = texture2D(sampler, vec2(color.g, 0.)).r;\n\tcolor.b = texture2D(sampler, vec2(color.b, 0.)).r;\n\treturn color;\n} \n\nvec4 level1c(vec4 color, sampler2D sampler) \n{ \n\tcolor.r = texture2D(sampler, vec2(color.r, 0.)).g;\n\tcolor.g = texture2D(sampler, vec2(color.g, 0.)).g;\n\tcolor.b = texture2D(sampler, vec2(color.b, 0.)).g;\n\treturn color;\n} \n\nvec4 level2c(vec4 color, sampler2D sampler) \n{ \n\tcolor.r = texture2D(sampler, vec2(color.r,0.)).b; \n\tcolor.g = texture2D(sampler, vec2(color.g,0.)).b;\n\tcolor.b = texture2D(sampler, vec2(color.b,0.)).b; \n\treturn color; \n} \n\nvec3 rgb2hsv(vec3 c) \n{\n\tvec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0); \n\tvec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g)); \n\tvec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r)); \n\t\n\tfloat d = q.x - min(q.w, q.y); \n\tfloat e = 1.0e-10; \n\treturn vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x); \n} \n\nvec3 hsv2rgb(vec3 c) \n{ \n\tvec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0); \n\tvec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www); \n\treturn c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y); \n}\n\nvec4 normal(vec4 c1, vec4 c2, float alpha) \n{ \n\treturn (c2-c1) * alpha + c1; \n} \n\nvec4 multiply(vec4 c1, vec4 c2) \n{\n\treturn c1 * c2 * 1.01;\n}\n\nvec4 overlay(vec4 c1, vec4 c2)\n{\n\tvec4 color = vec4(0.,0.,0.,1.);\n\t\n\tcolor.r = c1.r < 0.5 ? 2.0*c1.r*c2.r : 1.0 - 2.0*(1.0-c1.r)*(1.0-c2.r);\n\tcolor.g = c1.g < 0.5 ? 2.0*c1.g*c2.g : 1.0 - 2.0*(1.0-c1.g)*(1.0-c2.g);\n\tcolor.b = c1.b < 0.5 ? 2.0*c1.b*c2.b : 1.0 - 2.0*(1.0-c1.b)*(1.0-c2.b); \n\n\treturn color;\n}\n\nvec4 screen(vec4 c1, vec4 c2) \n{ \n\treturn vec4(1.) - ((vec4(1.) - c1) * (vec4(1.) - c2)); \n} \n\nvoid main() \n{ \n\t// iOS ImageLiveFilter adjustment\n\t// begin \n\t\n\tvec4 textureColor; \n\t\n\tvec4 t0 = texture2D(mask, vec2(textureCoordinate.x, textureCoordinate.y)); \n\t\n\t// naver skin \n\tvec4 c2 = texture2D(inputImageTexture, textureCoordinate); \n\tvec4 c5 = c2; \n\t\n\t// healthy \n\tvec3 hsv = rgb2hsv(c5.rgb); \n\tlowp float h = hsv.x; \n\tlowp float s = hsv.y; \n\tlowp float v = hsv.z; \n\t\n\tlowp float cF = 0.;   \n\t// color strength \n\tlowp float cG = 0.;   \n\t// color gap; \n\tlowp float sF = 0.06; \n\t// saturation strength; \n\t\n\tif(h >= 0.125 && h <= 0.208) \n\t{ \n\t\t// 45 to 75 \n\t\ts = s - (s * sF); \n\t} \n\telse if (h >= 0.208 && h < 0.292) \n\t{ \n\t\t// 75 to 105 \n\t\tcG = abs(h - 0.208); \n\t\tcF = (cG / 0.0833); \n\t\ts = s - (s * sF * cF); \n\t} \n\telse if (h > 0.042 && h <=  0.125) \n\t{ \n\t\t// 15 to 45 \n\t\tcG = abs(h - 0.125); \n\t\tcF = (cG / 0.0833); \n\t\ts = s - (s * sF * cF); \n\t} \n\thsv.y = s; \n\t\n\tvec4 c6 = vec4(hsv2rgb(hsv),1.); \n\t\n\tc6 = normal(c6, screen  (c6, c6), 0.275); // screen 70./255. \n\tc6 = normal(c6, overlay (c6, vec4(1., 0.61176, 0.25098, 1.)), 0.04); // overlay 10./255. \n\t\n\tc6 = normal(c6, multiply(c6, t0), 0.262); // multiply 67./255. \n\t\n\tc6 = level1c(level0c(c6,curve),curve); \n\t\n\tgl_FragColor = c6; \n\t// end\n} "
  },
  {
    "path": "MagicShow/src/main/res/raw/hefe.glsl",
    "content": " precision mediump float;\n \n varying mediump vec2 textureCoordinate;\n \n uniform sampler2D inputImageTexture;\n uniform sampler2D inputImageTexture2;  //edgeBurn\n uniform sampler2D inputImageTexture3;  //hefeMap\n uniform sampler2D inputImageTexture4;  //hefeGradientMap\n uniform sampler2D inputImageTexture5;  //hefeSoftLight\n uniform sampler2D inputImageTexture6;  //hefeMetal\n \n uniform float strength;\n\n void main()\n{\n    vec4 originColor = texture2D(inputImageTexture, textureCoordinate);\n    vec3 texel = texture2D(inputImageTexture, textureCoordinate).rgb;\n    vec3 edge = texture2D(inputImageTexture2, textureCoordinate).rgb;\n    texel = texel * edge;\n    \n    texel = vec3(\n                 texture2D(inputImageTexture3, vec2(texel.r, .16666)).r,\n                 texture2D(inputImageTexture3, vec2(texel.g, .5)).g,\n                 texture2D(inputImageTexture3, vec2(texel.b, .83333)).b);\n    \n    vec3 luma = vec3(.30, .59, .11);\n    vec3 gradSample = texture2D(inputImageTexture4, vec2(dot(luma, texel), .5)).rgb;\n    vec3 final = vec3(\n                      texture2D(inputImageTexture5, vec2(gradSample.r, texel.r)).r,\n                      texture2D(inputImageTexture5, vec2(gradSample.g, texel.g)).g,\n                      texture2D(inputImageTexture5, vec2(gradSample.b, texel.b)).b\n                      );\n    \n    vec3 metal = texture2D(inputImageTexture6, textureCoordinate).rgb;\n    vec3 metaled = vec3(\n                        texture2D(inputImageTexture5, vec2(metal.r, texel.r)).r,\n                        texture2D(inputImageTexture5, vec2(metal.g, texel.g)).g,\n                        texture2D(inputImageTexture5, vec2(metal.b, texel.b)).b\n                        );\n    \n    metaled.rgb = mix(originColor.rgb, metaled.rgb, strength);\n\n    gl_FragColor = vec4(metaled, 1.0);\n}"
  },
  {
    "path": "MagicShow/src/main/res/raw/hudson.glsl",
    "content": "precision mediump float;\n \n varying mediump vec2 textureCoordinate;\n \n uniform sampler2D inputImageTexture;\n uniform sampler2D inputImageTexture2; //blowout;\n uniform sampler2D inputImageTexture3; //overlay;\n uniform sampler2D inputImageTexture4; //map\n \n uniform float strength;\n \n void main()\n {\n     vec4 originColor = texture2D(inputImageTexture, textureCoordinate);\n     \n     vec4 texel = texture2D(inputImageTexture, textureCoordinate);\n     \n     vec3 bbTexel = texture2D(inputImageTexture2, textureCoordinate).rgb;\n     \n     texel.r = texture2D(inputImageTexture3, vec2(bbTexel.r, texel.r)).r;\n     texel.g = texture2D(inputImageTexture3, vec2(bbTexel.g, texel.g)).g;\n     texel.b = texture2D(inputImageTexture3, vec2(bbTexel.b, texel.b)).b;\n     \n     vec4 mapped;\n     mapped.r = texture2D(inputImageTexture4, vec2(texel.r, .16666)).r;\n     mapped.g = texture2D(inputImageTexture4, vec2(texel.g, .5)).g;\n     mapped.b = texture2D(inputImageTexture4, vec2(texel.b, .83333)).b;\n     mapped.a = 1.0;\n     \n     mapped.rgb = mix(originColor.rgb, mapped.rgb, strength);\n\n     gl_FragColor = mapped;\n }"
  },
  {
    "path": "MagicShow/src/main/res/raw/inkwell.glsl",
    "content": " precision mediump float;\n\n varying mediump vec2 textureCoordinate;\n\n uniform sampler2D inputImageTexture;\n uniform sampler2D inputImageTexture2;\n\n void main()\n {\n     vec3 texel = texture2D(inputImageTexture, textureCoordinate).rgb;\n     texel = vec3(dot(vec3(0.3, 0.6, 0.1), texel));\n     texel = vec3(texture2D(inputImageTexture2, vec2(texel.r, .16666)).r);\n     gl_FragColor = vec4(texel, 1.0);\n }"
  },
  {
    "path": "MagicShow/src/main/res/raw/kevin_new.glsl",
    "content": " precision mediump float;\n\n varying mediump vec2 textureCoordinate;\n\n uniform sampler2D inputImageTexture;\n uniform sampler2D inputImageTexture2;\n\n void main()\n {\n     vec3 texel = texture2D(inputImageTexture, textureCoordinate).rgb;\n\n     vec2 lookup;\n     lookup.y = .5;\n\n     lookup.x = texel.r;\n     texel.r = texture2D(inputImageTexture2, lookup).r;\n\n     lookup.x = texel.g;\n     texel.g = texture2D(inputImageTexture2, lookup).g;\n\n     lookup.x = texel.b;\n     texel.b = texture2D(inputImageTexture2, lookup).b;\n\n     gl_FragColor = vec4(texel, 1.0);\n }\n"
  },
  {
    "path": "MagicShow/src/main/res/raw/latte.glsl",
    "content": "varying highp vec2 textureCoordinate; \nprecision highp float;\n\nuniform sampler2D inputImageTexture;\nuniform sampler2D curve;\n\nvec3 rgb2hsv(vec3 c) \n{ \n\tvec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);\n\tvec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));\n\tvec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));\n\t\n\tfloat d = q.x - min(q.w, q.y);\n\tfloat e = 1.0e-10;\n\treturn vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);\n} \n\nvec3 hsv2rgb(vec3 c) \n{ \n\tvec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);\n\tvec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);\n\treturn c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y); \n}\n\nvoid main()\n{\n\tfloat GreyVal;\n\tlowp vec4 textureColor;\n\tlowp vec4 textureColorOri;\n\tfloat xCoordinate = textureCoordinate.x;\n\tfloat yCoordinate = textureCoordinate.y; \n\n\thighp float redCurveValue; \n\thighp float greenCurveValue; \n\thighp float blueCurveValue;\n\t\n\ttextureColor = texture2D( inputImageTexture, vec2(xCoordinate, yCoordinate)); \n\tmediump vec4 base = textureColor; \n\tmediump vec4 overlay = vec4(0.792, 0.58, 0.372, 1.0); \n\t\n\t// step1 overlay blending \n\tmediump float ra; \n\tif (base.r < 0.5) \n\t{ \n\t\tra = overlay.r * base.r * 2.0; \n\t} \n\telse \n\t{ \n\t\tra = 1.0 - ((1.0 - base.r) * (1.0 - overlay.r) * 2.0); \n    } \n\t\n\tmediump float ga; \n\tif (base.g < 0.5) \n\t{ \n\t\tga = overlay.g * base.g * 2.0;\n    } \n\telse \n\t{ \n\t\tga = 1.0 - ((1.0 - base.g) * (1.0 - overlay.g) * 2.0); \n    } \n\t\n\tmediump float ba; \n\tif (base.b < 0.5) \n\t{ \n\t\tba = overlay.b * base.b * 2.0; \n    } \n\telse \n\t{ \n\t\tba = 1.0 - ((1.0 - base.b) * (1.0 - overlay.b) * 2.0); \n    } \n\t\n\ttextureColor = vec4(ra, ga, ba, 1.0); \n\ttextureColor = (textureColor - base) * 0.3 + base; \n\t\n\tredCurveValue = texture2D(curve, vec2(textureColor.r, 0.0)).r; \n\tgreenCurveValue = texture2D(curve, vec2(textureColor.g, 0.0)).g; \n\tblueCurveValue = texture2D(curve, vec2(textureColor.b, 0.0)).b; \n\t\n\tredCurveValue = texture2D(curve, vec2(redCurveValue, 1.0)).g; \n\tgreenCurveValue = texture2D(curve, vec2(greenCurveValue, 1.0)).g; \n\tblueCurveValue = texture2D(curve, vec2(blueCurveValue, 1.0)).g; \n\t\n\t\n\tvec3 tColor = vec3(redCurveValue, greenCurveValue, blueCurveValue); \n\ttColor = rgb2hsv(tColor); \n\t\n\ttColor.g = tColor.g * 0.6; \n\t\n\tfloat dStrength = 1.0; \n\tfloat dSatStrength = 0.2; \n\t\n\tfloat dGap = 0.0; \n\t\n\tif( tColor.r >= 0.0 && tColor.r < 0.417) \n\t{ \n\t\ttColor.g = tColor.g + (tColor.g * dSatStrength); \n    } \n\telse if( tColor.r > 0.958 && tColor.r <= 1.0) \n\t{ \n\t\ttColor.g = tColor.g + (tColor.g * dSatStrength); \n    } \n\telse if( tColor.r >= 0.875 && tColor.r <= 0.958) \n\t{ \n\t\tdGap = abs(tColor.r - 0.875); \n\t\tdStrength = (dGap / 0.0833); \n\t\t\n\t\ttColor.g = tColor.g + (tColor.g * dSatStrength * dStrength); \n    } \n\telse if( tColor.r >= 0.0417 && tColor.r <= 0.125) \n\t{ \n\t\tdGap = abs(tColor.r - 0.125);\n\t\tdStrength = (dGap / 0.0833); \n\t\t\n\t\ttColor.g = tColor.g + (tColor.g * dSatStrength * dStrength); \n\t} \n\t\n\t\n\ttColor = hsv2rgb(tColor); \n\ttColor = clamp(tColor, 0.0, 1.0); \n\t\n\tredCurveValue = texture2D(curve, vec2(tColor.r, 1.0)).r; \n\tgreenCurveValue = texture2D(curve, vec2(tColor.g, 1.0)).r; \n\tblueCurveValue = texture2D(curve, vec2(tColor.b, 1.0)).r; \n\n\tbase = vec4(redCurveValue, greenCurveValue, blueCurveValue, 1.0); \n\toverlay = vec4(0.792, 0.494, 0.372, 1.0); \n\n\t// step5 overlay blending \n\tif (base.r < 0.5) \n\t{\n\t\tra = overlay.r * base.r * 2.0; \n    } \n\telse \n\t{ \n\t\tra = 1.0 - ((1.0 - base.r) * (1.0 - overlay.r) * 2.0); \n    } \n\t\n\tif (base.g < 0.5) \n\t{ \n\t\tga = overlay.g * base.g * 2.0; \n\t} \n\telse \n\t{ \n\t\tga = 1.0 - ((1.0 - base.g) * (1.0 - overlay.g) * 2.0); \n\t} \n\t\n\tif (base.b < 0.5) \n\t{ \n\t\tba = overlay.b * base.b * 2.0; \n\t}\n\telse \n\t{ \n\t\tba = 1.0 - ((1.0 - base.b) * (1.0 - overlay.b) * 2.0);\n    } \n\t\n\ttextureColor = vec4(ra, ga, ba, 1.0); \n\ttextureColor = (textureColor - base) * 0.15 + base; \n\n\tgl_FragColor = vec4(textureColor.r, textureColor.g, textureColor.b, 1.0); \n}"
  },
  {
    "path": "MagicShow/src/main/res/raw/lomo.glsl",
    "content": "precision mediump float;\n \n varying mediump vec2 textureCoordinate;\n \n uniform sampler2D inputImageTexture;\n uniform sampler2D inputImageTexture2;\n uniform sampler2D inputImageTexture3;\n \n uniform float strength;\n\n void main()\n {\n     vec4 originColor = vec4(0.2,0.6,0.9,1.0);\n\n     vec3 texel;\n     vec2 tc = (2.0 * textureCoordinate) - 1.0;\n     float d = dot(tc, tc);\n     vec2 lookup = vec2(d, originColor.r);\n     texel.r = texture2D(inputImageTexture3, lookup).r;\n     lookup.y = originColor.g;\n     texel.g = texture2D(inputImageTexture3, lookup).g;\n     lookup.y = originColor.b;\n     texel.b\t= texture2D(inputImageTexture3, lookup).b;\n     \n     texel.rgb = mix(originColor.rgb, texel.rgb, strength);\n\n     gl_FragColor = vec4(texel,1.0);\n }"
  },
  {
    "path": "MagicShow/src/main/res/raw/n1977.glsl",
    "content": "precision mediump float;\n\n varying mediump vec2 textureCoordinate;\n\n uniform sampler2D inputImageTexture;\n uniform sampler2D inputImageTexture2;\n\n void main()\n {\n\n     vec3 texel = texture2D(inputImageTexture, textureCoordinate).rgb;\n\n     texel = vec3(\n                  texture2D(inputImageTexture2, vec2(texel.r, .16666)).r,\n                  texture2D(inputImageTexture2, vec2(texel.g, .5)).g,\n                  texture2D(inputImageTexture2, vec2(texel.b, .83333)).b);\n\n     gl_FragColor = vec4(texel, 1.0);\n }\n"
  },
  {
    "path": "MagicShow/src/main/res/raw/nashville.glsl",
    "content": "precision mediump float;\n\n varying mediump vec2 textureCoordinate;\n\n uniform sampler2D inputImageTexture;\n uniform sampler2D inputImageTexture2;\n\n void main()\n {\n     vec3 texel = texture2D(inputImageTexture, textureCoordinate).rgb;\n     texel = vec3(\n                  texture2D(inputImageTexture2, vec2(texel.r, .16666)).r,\n                  texture2D(inputImageTexture2, vec2(texel.g, .5)).g,\n                  texture2D(inputImageTexture2, vec2(texel.b, .83333)).b);\n     gl_FragColor = vec4(texel, 1.0);\n }\n"
  },
  {
    "path": "MagicShow/src/main/res/raw/nostalgia.glsl",
    "content": "varying highp vec2 textureCoordinate;\nprecision highp float; \n\nuniform sampler2D inputImageTexture;\nuniform sampler2D curve;\nuniform sampler2D curve2; \nuniform highp float texelWidthOffset;\nuniform highp float texelHeightOffset;\nuniform highp float blurSize;\n\nvec4 OverlayBlendingVec4(vec4 down, vec4 up, float fAlpha)\n{ \n\tif ( down.r < 0.5 ) \n\t{ \n\t\tup.r = up.r * down.r * 2.0; \n\t}\n\telse \n\t{ \n\t\tup.r = 1.0 - ( ( 1.0 - down.r) * ( 1.0 - up.r ) * 2.0 );\n\t} \n\tif ( down.g < 0.5 ) \n\t{ \n\t\tup.g = up.g * down.g * 2.0; \n\t} \n\telse \n\t{\n\t\tup.g = 1.0 - ( ( 1.0 - down.g) * ( 1.0 - up.g ) * 2.0 ); \n\t} \n\t\n    if ( down.b < 0.5 ) \n\t{ \n\t\tup.b = up.b * down.b * 2.0;\n\t} \n\telse \n\t{ \n\t\tup.b = 1.0 - ( ( 1.0 - down.b) * ( 1.0 - up.b ) * 2.0 ); \n\t} \n\t\n    down = ( up - down ) * fAlpha + down;\n\t\n\treturn down; \n} \n\nvoid main()\n{ \n\tfloat xCoordinate = textureCoordinate.x; \n\tfloat yCoordinate = textureCoordinate.y; \n\n\tvec4 textureColor = texture2D( inputImageTexture, vec2(xCoordinate, yCoordinate)); \n    highp vec2 firstOffset = vec2(1.3846153846 * texelWidthOffset, 1.3846153846 * texelHeightOffset) * blurSize; \n\thighp vec2 secondOffset = vec2(3.2307692308 * texelWidthOffset, 3.2307692308 * texelHeightOffset) * blurSize;\n\t\n\thighp vec2 centerTextureCoordinate = vec2(xCoordinate, yCoordinate); \n\thighp vec2 oneStepLeftTextureCoordinate = vec2(xCoordinate, yCoordinate) - firstOffset; \n\thighp vec2 twoStepsLeftTextureCoordinate = vec2(xCoordinate, yCoordinate) - secondOffset; \n\thighp vec2 oneStepRightTextureCoordinate = vec2(xCoordinate, yCoordinate) + firstOffset; \n    highp vec2 twoStepsRightTextureCoordinate = vec2(xCoordinate, yCoordinate) + secondOffset; \n\n\tlowp vec4 fragmentColor = texture2D(inputImageTexture, vec2(centerTextureCoordinate.x, centerTextureCoordinate.y)) * 0.2270270270; \n\tfragmentColor += texture2D(inputImageTexture, vec2(oneStepLeftTextureCoordinate.x, oneStepLeftTextureCoordinate.y)) * 0.3162162162; \n\tfragmentColor += texture2D(inputImageTexture, vec2(oneStepRightTextureCoordinate.x, oneStepRightTextureCoordinate.y)) * 0.3162162162; \n\tfragmentColor += texture2D(inputImageTexture, vec2(twoStepsLeftTextureCoordinate.x, twoStepsLeftTextureCoordinate.y)) * 0.0702702703; \n    fragmentColor += texture2D(inputImageTexture, vec2(twoStepsRightTextureCoordinate.x, twoStepsRightTextureCoordinate.y)) * 0.0702702703; \n\t\n\tlowp vec4 blurColor = fragmentColor; \n\t\n    // step1 ScreenBlending \n    blurColor = 1.0 - ((1.0 - textureColor) * (1.0 - blurColor)); \n\tblurColor =     clamp(blurColor, 0.0, 1.0);\n\ttextureColor = (blurColor - textureColor) * 0.7 + textureColor; \n\ttextureColor =  clamp(textureColor, 0.0, 1.0); \n\n\t// step2 OverlayBlending \n\ttextureColor = OverlayBlendingVec4(textureColor, vec4(0.0, 0.0, 0.0, 1.0), 0.3); \n    textureColor = clamp(textureColor, vec4(0.0, 0.0, 0.0, 1.0), vec4(1.0, 1.0, 1.0, 1.0)); \n\t\n\t// step3 curve \n    highp float redCurveValue = texture2D(curve, vec2(textureColor.r, 0.0)).r; \n\thighp float greenCurveValue = texture2D(curve, vec2(textureColor.g, 0.0)).g; \n\thighp float blueCurveValue = texture2D(curve, vec2(textureColor.b, 0.0)).b;\n\n    // step4 curve \n\tredCurveValue = texture2D(curve, vec2(redCurveValue, 1.0)).r; \n    greenCurveValue = texture2D(curve, vec2(greenCurveValue, 1.0)).r; \n    blueCurveValue = texture2D(curve, vec2(blueCurveValue, 1.0)).r; \n\n\t// step5 level \n    redCurveValue = texture2D(curve, vec2(redCurveValue, 1.0)).g; \n\tgreenCurveValue = texture2D(curve, vec2(greenCurveValue, 1.0)).g; \n    blueCurveValue = texture2D(curve, vec2(blueCurveValue, 1.0)).g; \n\n\t// step6 curve \n\tredCurveValue = texture2D(curve2, vec2(redCurveValue, 1.0)).r; \n\tgreenCurveValue = texture2D(curve2, vec2(greenCurveValue, 1.0)).g;\n    blueCurveValue = texture2D(curve2, vec2(blueCurveValue, 1.0)).b; \n\n\t// step7 curve \n\tredCurveValue = texture2D(curve, vec2(redCurveValue, 1.0)).b; \n\tgreenCurveValue = texture2D(curve, vec2(greenCurveValue, 1.0)).b; \n\n\tblueCurveValue = texture2D(curve, vec2(blueCurveValue, 1.0)).b; \n\t\n\tlowp vec4 BCSColor = vec4(redCurveValue, greenCurveValue, blueCurveValue, 1.0); \n\tgl_FragColor =  vec4(BCSColor.r,BCSColor.g,BCSColor.b,1.0); \n}"
  },
  {
    "path": "MagicShow/src/main/res/raw/pixar.glsl",
    "content": "precision mediump float;\n varying mediump vec2 textureCoordinate;\n \n uniform sampler2D inputImageTexture;\n uniform sampler2D inputImageTexture2;\n \n uniform float strength;\n\n // gray\n float NCGray(vec4 color)\n{\n    float gray = 0.2125 * color.r + 0.7154 * color.g + 0.0721 * color.b;\n    \n    return gray;\n}\n \n // tone mapping\n vec4 NCTonemapping(vec4 color)\n{\n    \n    vec4 mapped;\n    mapped.r = texture2D(inputImageTexture2, vec2(color.r, 0.0)).r;\n    mapped.g = texture2D(inputImageTexture2, vec2(color.g, 0.0)).g;\n    mapped.b = texture2D(inputImageTexture2, vec2(color.b, 0.0)).b;\n    mapped.a = color.a;\n    \n    return mapped;\n}\n \n // color control\n vec4 NCColorControl(vec4 color, float saturation, float brightness, float contrast)\n{\n    float gray = NCGray(color);\n    \n    color.rgb = vec3(saturation) * color.rgb + vec3(1.0-saturation) * vec3(gray);\n    color.r = clamp(color.r, 0.0, 1.0);\n    color.g = clamp(color.g, 0.0, 1.0);\n    color.b = clamp(color.b, 0.0, 1.0);\n    \n    color.rgb = vec3(contrast) * (color.rgb - vec3(0.5)) + vec3(0.5);\n    color.r = clamp(color.r, 0.0, 1.0);\n    color.g = clamp(color.g, 0.0, 1.0);\n    color.b = clamp(color.b, 0.0, 1.0);\n    \n    color.rgb = color.rgb + vec3(brightness);\n    color.r = clamp(color.r, 0.0, 1.0);\n    color.g = clamp(color.g, 0.0, 1.0);\n    color.b = clamp(color.b, 0.0, 1.0);\n    \n    return color;\n}\n \n // hue adjust\n vec4 NCHueAdjust(vec4 color, float hueAdjust)\n{\n    vec3 kRGBToYPrime = vec3(0.299, 0.587, 0.114);\n    vec3 kRGBToI = vec3(0.595716, -0.274453, -0.321263);\n    vec3 kRGBToQ = vec3(0.211456, -0.522591, 0.31135);\n    \n    vec3 kYIQToR   = vec3(1.0, 0.9563, 0.6210);\n    vec3 kYIQToG   = vec3(1.0, -0.2721, -0.6474);\n    vec3 kYIQToB   = vec3(1.0, -1.1070, 1.7046);\n    \n    float yPrime = dot(color.rgb, kRGBToYPrime);\n    float I = dot(color.rgb, kRGBToI);\n    float Q = dot(color.rgb, kRGBToQ);\n    \n    float hue = atan(Q, I);\n    float chroma  = sqrt (I * I + Q * Q);\n    \n    hue -= hueAdjust;\n    \n    Q = chroma * sin (hue);\n    I = chroma * cos (hue);\n    \n    color.r = dot(vec3(yPrime, I, Q), kYIQToR);\n    color.g = dot(vec3(yPrime, I, Q), kYIQToG);\n    color.b = dot(vec3(yPrime, I, Q), kYIQToB);\n    \n    return color;\n}\n \n // colorMatrix\n vec4 NCColorMatrix(vec4 color, float red, float green, float blue, float alpha, vec4 bias)\n{\n    color = color * vec4(red, green, blue, alpha) + bias;\n    \n    return color;\n}\n \n // multiply blend\n vec4 NCMultiplyBlend(vec4 overlay, vec4 base)\n{\n    vec4 outputColor;\n    \n    float a = overlay.a + base.a * (1.0 - overlay.a);\n    \n    //    // normal blend\n    //    outputColor.r = (base.r * base.a + overlay.r * overlay.a * (1.0 - base.a))/a;\n    //    outputColor.g = (base.g * base.a + overlay.g * overlay.a * (1.0 - base.a))/a;\n    //    outputColor.b = (base.b * base.a + overlay.b * overlay.a * (1.0 - base.a))/a;\n    \n    \n    // multiply blend\n    outputColor.rgb = ((1.0-base.a) * overlay.rgb * overlay.a + (1.0-overlay.a) * base.rgb * base.a + overlay.a * base.a * overlay.rgb * base.rgb) / a;\n    \n    \n    outputColor.a = a;\n    \n    return outputColor;\n}\n \n void main()\n{\n    vec4 originColor = texture2D(inputImageTexture, textureCoordinate);\n    vec4 color = texture2D(inputImageTexture, textureCoordinate);\n    \n    color.a = 1.0;\n    \n    // tone mapping\n    color.r = texture2D(inputImageTexture2, vec2(color.r, 0.0)).r;\n    color.g = texture2D(inputImageTexture2, vec2(color.g, 0.0)).g;\n    color.b = texture2D(inputImageTexture2, vec2(color.b, 0.0)).b;\n    \n    // color control\n    color = NCColorControl(color, 1.0, 0.08, 1.0);\n    \n    // hue adjust\n    color = NCHueAdjust(color, 0.0556);\n    \n    // color matrix\n    color = NCColorMatrix(color, 1.0, 1.0, 1.0, 1.0, vec4(0.02, 0.02, 0.06, 0));\n    \n    color.rgb = mix(originColor.rgb, color.rgb, strength);\n\n    gl_FragColor = color;\n}"
  },
  {
    "path": "MagicShow/src/main/res/raw/rise.glsl",
    "content": "precision mediump float;\n \n varying mediump vec2 textureCoordinate;\n \n uniform sampler2D inputImageTexture;\n uniform sampler2D inputImageTexture2; //blowout;\n uniform sampler2D inputImageTexture3; //overlay;\n uniform sampler2D inputImageTexture4; //map\n \n uniform float strength;\n \n void main()\n {\n     vec4 originColor = texture2D(inputImageTexture, textureCoordinate);\n     vec4 texel = texture2D(inputImageTexture, textureCoordinate);\n     vec3 bbTexel = texture2D(inputImageTexture2, textureCoordinate).rgb;\n     \n     texel.r = texture2D(inputImageTexture3, vec2(bbTexel.r, texel.r)).r;\n     texel.g = texture2D(inputImageTexture3, vec2(bbTexel.g, texel.g)).g;\n     texel.b = texture2D(inputImageTexture3, vec2(bbTexel.b, texel.b)).b;\n     \n     vec4 mapped;\n     mapped.r = texture2D(inputImageTexture4, vec2(texel.r, .16666)).r;\n     mapped.g = texture2D(inputImageTexture4, vec2(texel.g, .5)).g;\n     mapped.b = texture2D(inputImageTexture4, vec2(texel.b, .83333)).b;\n     mapped.a = 1.0;\n     \n     mapped.rgb = mix(originColor.rgb, mapped.rgb, strength);\n\n     gl_FragColor = mapped;\n }"
  },
  {
    "path": "MagicShow/src/main/res/raw/romance.glsl",
    "content": "varying highp vec2 textureCoordinate; \nprecision highp float; \n\nuniform sampler2D inputImageTexture; \nuniform sampler2D curve;\n\nvoid main()\n{ \n\tlowp vec4 textureColor;\n\tlowp vec4 textureColorRes; \n\tlowp vec4 textureColorOri; \n\tvec4 grey1Color; \n\tvec4 layerColor; \n\tmediump float satVal = 115.0 / 100.0; \n\n    float xCoordinate = textureCoordinate.x;\n\tfloat yCoordinate = textureCoordinate.y; \n\t\n\thighp float redCurveValue; \n\thighp float greenCurveValue; \n\thighp float blueCurveValue; \n\n\ttextureColor = texture2D( inputImageTexture, vec2(xCoordinate, yCoordinate)); \n    textureColorRes = textureColor; \n\ttextureColorOri = textureColor; \n\n\t// step1. screen blending \n\ttextureColor = 1.0 - ((1.0 - textureColorOri) * (1.0 - textureColorOri)); \n\ttextureColor = (textureColor - textureColorOri) + textureColorOri; \n\n\t// step2. curve \n\tredCurveValue = texture2D(curve, vec2(textureColor.r, 0.0)).r; \n\tgreenCurveValue = texture2D(curve, vec2(textureColor.g, 0.0)).g; \n    blueCurveValue = texture2D(curve, vec2(textureColor.b, 0.0)).b; \n\n\t// step3. saturation \n\thighp float G = (redCurveValue + greenCurveValue + blueCurveValue); \n\tG = G / 3.0; \n\n    redCurveValue = ((1.0 - satVal) * G + satVal * redCurveValue); \n\tgreenCurveValue = ((1.0 - satVal) * G + satVal * greenCurveValue); \n\tblueCurveValue = ((1.0 - satVal) * G + satVal * blueCurveValue); \n\n\ttextureColor = vec4(redCurveValue, greenCurveValue, blueCurveValue, 1.0); \n\n    gl_FragColor = vec4(textureColor.r, textureColor.g, textureColor.b, 1.0); \n}\n"
  },
  {
    "path": "MagicShow/src/main/res/raw/sakura.glsl",
    "content": "precision mediump float; \n\nuniform sampler2D inputImageTexture; \nuniform sampler2D curve; \nuniform float texelWidthOffset; \nuniform float texelHeightOffset; \n\nvarying mediump vec2 textureCoordinate; \n\nvec4 gaussianBlur(sampler2D sampler) { \n\tlowp float strength = 1.; \n\tvec4 color = vec4(0.); \n\tvec2 step  = vec2(0.); \n\n\tcolor += texture2D(sampler,textureCoordinate)* 0.25449 ; \n\t\n\tstep.x = 1.37754 * texelWidthOffset  * strength; \n\tstep.y = 1.37754 * texelHeightOffset * strength; \n\tcolor += texture2D(sampler,textureCoordinate+step) * 0.24797; \n\tcolor += texture2D(sampler,textureCoordinate-step) * 0.24797; \n\n\tstep.x = 3.37754 * texelWidthOffset  * strength; \n\tstep.y = 3.37754 * texelHeightOffset * strength; \n\tcolor += texture2D(sampler,textureCoordinate+step) * 0.09122; \n\tcolor += texture2D(sampler,textureCoordinate-step) * 0.09122; \n\n\tstep.x = 5.37754 * texelWidthOffset  * strength; \n\tstep.y = 5.37754 * texelHeightOffset * strength; \n\tcolor += texture2D(sampler,textureCoordinate+step) * 0.03356; \n\tcolor += texture2D(sampler,textureCoordinate-step) * 0.03356; \n\n\treturn color; \n} \n\nvec4 overlay(vec4 c1, vec4 c2){ \n\tvec4 r1 = vec4(0.,0.,0.,1.); \n\n\tr1.r = c1.r < 0.5 ? 2.0*c1.r*c2.r : 1.0 - 2.0*(1.0-c1.r)*(1.0-c2.r); \n\tr1.g = c1.g < 0.5 ? 2.0*c1.g*c2.g : 1.0 - 2.0*(1.0-c1.g)*(1.0-c2.g); \n\tr1.b = c1.b < 0.5 ? 2.0*c1.b*c2.b : 1.0 - 2.0*(1.0-c1.b)*(1.0-c2.b); \n\n\treturn r1; \n} \n\nvec4 level0c(vec4 color, sampler2D sampler) { \n    color.r = texture2D(sampler, vec2(color.r, 0.)).r; \n    color.g = texture2D(sampler, vec2(color.g, 0.)).r; \n\tcolor.b = texture2D(sampler, vec2(color.b, 0.)).r; \n\treturn color; \n} \n\nvec4 normal(vec4 c1, vec4 c2, float alpha) { \n    return (c2-c1) * alpha + c1; \n} \n\nvec4 screen(vec4 c1, vec4 c2) { \n\tvec4 r1 = vec4(1.) - ((vec4(1.) - c1) * (vec4(1.) - c2)); \n\treturn r1; \n} \n\nvoid main() { \n\t// naver skin \n\tlowp vec4 c0 = texture2D(inputImageTexture, textureCoordinate);\n\tlowp vec4 c1 = gaussianBlur(inputImageTexture); \n\tlowp vec4 c2 = overlay(c0, level0c(c1, curve)); \n\tlowp vec4 c3 = normal(c0,c2,0.15); \n\n\tgl_FragColor = c3; \n}"
  },
  {
    "path": "MagicShow/src/main/res/raw/sierra.glsl",
    "content": " precision mediump float;\n \n varying mediump vec2 textureCoordinate;\n \n uniform sampler2D inputImageTexture;\n uniform sampler2D inputImageTexture2; //blowout;\n uniform sampler2D inputImageTexture3; //overlay;\n uniform sampler2D inputImageTexture4; //map\n \n uniform float strength;\n \n void main()\n {\n     vec4 originColor = texture2D(inputImageTexture, textureCoordinate);\n     vec4 texel = texture2D(inputImageTexture, textureCoordinate);\n     vec3 bbTexel = texture2D(inputImageTexture2, textureCoordinate).rgb;\n     \n     texel.r = texture2D(inputImageTexture3, vec2(bbTexel.r, texel.r)).r;\n     texel.g = texture2D(inputImageTexture3, vec2(bbTexel.g, texel.g)).g;\n     texel.b = texture2D(inputImageTexture3, vec2(bbTexel.b, texel.b)).b;\n     \n     vec4 mapped;\n     mapped.r = texture2D(inputImageTexture4, vec2(texel.r, .16666)).r;\n     mapped.g = texture2D(inputImageTexture4, vec2(texel.g, .5)).g;\n     mapped.b = texture2D(inputImageTexture4, vec2(texel.b, .83333)).b;\n     mapped.a = 1.0;\n     \n     mapped.rgb = mix(originColor.rgb, mapped.rgb, strength);\n     gl_FragColor = mapped;\n }"
  },
  {
    "path": "MagicShow/src/main/res/raw/sketch.glsl",
    "content": "varying highp vec2 textureCoordinate;\nprecision mediump float;\n\nuniform sampler2D inputImageTexture;\nuniform vec2 singleStepOffset; \nuniform float strength;\n\nconst highp vec3 W = vec3(0.299,0.587,0.114);\n\n\nvoid main()\n{ \n\tfloat threshold = 0.0;\n\t//pic1\n\tvec4 oralColor = texture2D(inputImageTexture, textureCoordinate);\n\t\n\t//pic2\n\tvec3 maxValue = vec3(0.,0.,0.);\n\t\n\tfor(int i = -2; i<=2; i++)\n\t{\n\t\tfor(int j = -2; j<=2; j++)\n\t\t{\n\t\t\tvec4 tempColor = texture2D(inputImageTexture, textureCoordinate+singleStepOffset*vec2(i,j));\n\t\t\tmaxValue.r = max(maxValue.r,tempColor.r);\n\t\t\tmaxValue.g = max(maxValue.g,tempColor.g);\n\t\t\tmaxValue.b = max(maxValue.b,tempColor.b);\n\t\t\tthreshold += dot(tempColor.rgb, W);\n\t\t}\n\t}\n\t//pic3\n\tfloat gray1 = dot(oralColor.rgb, W);\n\t\n\t//pic4\n\tfloat gray2 = dot(maxValue, W);\n\t\n\t//pic5\n\tfloat contour = gray1 / gray2;\n\n\tthreshold = threshold / 25.;\n\tfloat alpha = max(1.0,gray1>threshold?1.0:(gray1/threshold));\n\t\n\tfloat result = contour * alpha + (1.0-alpha)*gray1;\n\t\n\tgl_FragColor = vec4(vec3(result,result,result), oralColor.w);\n} "
  },
  {
    "path": "MagicShow/src/main/res/raw/skinwhiten.glsl",
    "content": "precision highp float;\n\nuniform sampler2D inputImageTexture;\nuniform sampler2D curve; \n\nuniform float texelWidthOffset; \nuniform float texelHeightOffset; \n\nvarying mediump vec2 textureCoordinate; \n\nconst mediump vec3 luminanceWeighting = vec3(0.2125, 0.7154, 0.0721); \n\nvec4 gaussianBlur(sampler2D sampler) { \n\tlowp float strength = 1.; \n\tvec4 color = vec4(0.); \n\tvec2 step  = vec2(0.); \n\n\tcolor += texture2D(sampler,textureCoordinate)* 0.25449 ; \n\n\tstep.x = 1.37754 * texelWidthOffset  * strength; \n\tstep.y = 1.37754 * texelHeightOffset * strength;\n\tcolor += texture2D(sampler,textureCoordinate+step) * 0.24797; \n\tcolor += texture2D(sampler,textureCoordinate-step) * 0.24797; \n\n\tstep.x = 3.37754 * texelWidthOffset  * strength; \n\tstep.y = 3.37754 * texelHeightOffset * strength; \n\tcolor += texture2D(sampler,textureCoordinate+step) * 0.09122; \n\tcolor += texture2D(sampler,textureCoordinate-step) * 0.09122; \n\n\tstep.x = 5.37754 * texelWidthOffset  * strength; \n\tstep.y = 5.37754 * texelHeightOffset * strength; \n\n\tcolor += texture2D(sampler,textureCoordinate+step) * 0.03356; \n\tcolor += texture2D(sampler,textureCoordinate-step) * 0.03356; \n\n\treturn color; \n} \n\nvoid main() { \n\tvec4 blurColor; \n\tlowp vec4 textureColor; \n\tlowp float strength = -1.0 / 510.0; \n\n\tfloat xCoordinate = textureCoordinate.x; \n\tfloat yCoordinate = textureCoordinate.y;\n\n\tlowp float satura = 0.7; \n\t// naver skin \n\ttextureColor = texture2D(inputImageTexture, textureCoordinate); \n\tblurColor = gaussianBlur(inputImageTexture); \n\n\t//saturation \n    lowp float luminance = dot(blurColor.rgb, luminanceWeighting); \n\tlowp vec3 greyScaleColor = vec3(luminance); \n\n\tblurColor = vec4(mix(greyScaleColor, blurColor.rgb, satura), blurColor.w); \n     \n\tlowp float redCurveValue = texture2D(curve, vec2(textureColor.r, 0.0)).r; \n\tlowp float greenCurveValue = texture2D(curve, vec2(textureColor.g, 0.0)).r; \n    lowp float blueCurveValue = texture2D(curve, vec2(textureColor.b, 0.0)).r; \n\n\tredCurveValue = min(1.0, redCurveValue + strength); \n\tgreenCurveValue = min(1.0, greenCurveValue + strength); \n\tblueCurveValue = min(1.0, blueCurveValue + strength); \n\n    mediump vec4 overlay = blurColor;\n\n\tmediump vec4 base = vec4(redCurveValue, greenCurveValue, blueCurveValue, 1.0); \n    //gl_FragColor = overlay; \n\n    // step4 overlay blending \n\tmediump float ra; \n\tif (base.r < 0.5) { \n\t\tra = overlay.r * base.r * 2.0; \n\t} else { \n\t\tra = 1.0 - ((1.0 - base.r) * (1.0 - overlay.r) * 2.0); \n\t} \n\n    mediump float ga; \n\tif (base.g < 0.5) { \n\t\tga = overlay.g * base.g * 2.0; \n\t} else { \n\t\tga = 1.0 - ((1.0 - base.g) * (1.0 - overlay.g) * 2.0); \n\t} \n\n\tmediump float ba; \n\tif (base.b < 0.5) { \n\t\tba = overlay.b * base.b * 2.0;\n\t} else { \n\t\tba = 1.0 - ((1.0 - base.b) * (1.0 - overlay.b) * 2.0); \n\t} \n\n\ttextureColor = vec4(ra, ga, ba, 1.0); \n\n    gl_FragColor = vec4(textureColor.r, textureColor.g, textureColor.b, 1.0); \n}\n"
  },
  {
    "path": "MagicShow/src/main/res/raw/suger_tablets.glsl",
    "content": "varying mediump vec2 textureCoordinate;\n varying mediump vec2 textureCoordinate2; // TODO: This is not used\n \n uniform sampler2D inputImageTexture;\n uniform sampler2D inputImageTexture2; // lookup texture\n uniform mediump float strength;\n\n void main()\n {\n     mediump vec4 originColor = texture2D(inputImageTexture, textureCoordinate);\n     mediump vec4 textureColor = texture2D(inputImageTexture, textureCoordinate);\n     \n     mediump float blueColor = textureColor.b * 63.0;\n     \n     mediump vec2 quad1;\n     quad1.y = floor(floor(blueColor) / 8.0);\n     quad1.x = floor(blueColor) - (quad1.y * 8.0);\n     \n     mediump vec2 quad2;\n     quad2.y = floor(ceil(blueColor) / 8.0);\n     quad2.x = ceil(blueColor) - (quad2.y * 8.0);\n     \n     mediump vec2 texPos1;\n     texPos1.x = (quad1.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.r);\n     texPos1.y = (quad1.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.g);\n     \n     mediump vec2 texPos2;\n     texPos2.x = (quad2.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.r);\n     texPos2.y = (quad2.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.g);\n     \n     mediump vec4 newColor1 = texture2D(inputImageTexture2, texPos1);\n     mediump vec4 newColor2 = texture2D(inputImageTexture2, texPos2);\n     \n     mediump vec4 newColor = mix(newColor1, newColor2, fract(blueColor));\n\n     newColor.rgb = mix(originColor.rgb, newColor.rgb, strength);\n\n     gl_FragColor = vec4(newColor.rgb, textureColor.w);\n }"
  },
  {
    "path": "MagicShow/src/main/res/raw/sunrise.glsl",
    "content": "varying highp vec2 textureCoordinate;\nprecision highp float; \n\nuniform sampler2D inputImageTexture;\nuniform sampler2D curve;\n\nuniform sampler2D grey1Frame; \nuniform sampler2D grey2Frame;\nuniform sampler2D grey3Frame;\n\nvoid main() \n{ \n\tfloat GreyVal; \n\tlowp vec4 textureColor; \n    lowp vec4 textureColorOri; \n    float xCoordinate = textureCoordinate.x; \n    float yCoordinate = textureCoordinate.y;\n\n    highp float redCurveValue; \n\thighp float greenCurveValue;\n    highp float blueCurveValue; \n\n\tvec4 grey1Color;\n    vec4 grey2Color; \n\tvec4 grey3Color;\n\n    textureColor = texture2D( inputImageTexture, vec2(xCoordinate, yCoordinate)); \n\n\tgrey1Color = texture2D(grey1Frame, vec2(xCoordinate, yCoordinate)); \n\tgrey2Color = texture2D(grey2Frame, vec2(xCoordinate, yCoordinate)); \n\tgrey3Color = texture2D(grey3Frame, vec2(xCoordinate, yCoordinate)); \n\n\tmediump vec4 overlay = vec4(0, 0, 0, 1.0); \n\tmediump vec4 base = textureColor; \n\n\t// overlay blending \n    mediump float ra; \n    if (base.r < 0.5) \n\t{ \n\t\tra = overlay.r * base.r * 2.0; \n    } \n\telse \n\t{ \n\t\tra = 1.0 - ((1.0 - base.r) * (1.0 - overlay.r) * 2.0); \n    } \n\n    mediump float ga; \n\tif (base.g < 0.5)\n\t{ \n\t\tga = overlay.g * base.g * 2.0; \n    }\n\telse \n\t{ \n\t\tga = 1.0 - ((1.0 - base.g) * (1.0 - overlay.g) * 2.0); \n    } \n\n\tmediump float ba;\n    if (base.b < 0.5) \n\t{ \n\t\tba = overlay.b * base.b * 2.0; \n\t} \n\telse \n\t{\n\t\tba = 1.0 - ((1.0 - base.b) * (1.0 - overlay.b) * 2.0); \n\t} \n\n\ttextureColor = vec4(ra, ga, ba, 1.0); \n\tbase = (textureColor - base) * (grey1Color.r*0.1019) + base; \n\n\n\t// step2 60% opacity  ExclusionBlending \n\ttextureColor = vec4(base.r, base.g, base.b, 1.0); \n    mediump vec4 textureColor2 = vec4(0.098, 0.0, 0.1843, 1.0); \n    textureColor2 = textureColor + textureColor2 - (2.0 * textureColor2 * textureColor); \n\n\ttextureColor = (textureColor2 - textureColor) * 0.6 + textureColor; \n\n    // step3 normal blending with original \n\tredCurveValue = texture2D(curve, vec2(textureColor.r, 0.0)).r; \n\tgreenCurveValue = texture2D(curve, vec2(textureColor.g, 0.0)).g;\n    blueCurveValue = texture2D(curve, vec2(textureColor.b, 0.0)).b; \n\n    textureColorOri = vec4(redCurveValue, greenCurveValue, blueCurveValue, 1.0);\n\ttextureColor = (textureColorOri - textureColor) * grey2Color.r + textureColor; \n\n\t// step4 normal blending with original\n\tredCurveValue = texture2D(curve, vec2(textureColor.r, 1.0)).r; \n    greenCurveValue = texture2D(curve, vec2(textureColor.g, 1.0)).g; \n\tblueCurveValue = texture2D(curve, vec2(textureColor.b, 1.0)).b; \n\n\ttextureColorOri = vec4(redCurveValue, greenCurveValue, blueCurveValue, 1.0); \n\ttextureColor = (textureColorOri - textureColor) * (grey3Color.r) * 1.0 + textureColor; \n\n\n    overlay = vec4(0.6117, 0.6117, 0.6117, 1.0); \n\tbase = textureColor;\n    // overlay blending \n\tif (base.r < 0.5) \n\t{ \n\t\tra = overlay.r * base.r * 2.0; \n\t} \n\telse \n\t{ \n\t\tra = 1.0 - ((1.0 - base.r) * (1.0 - overlay.r) * 2.0); \n\t} \n\n\tif (base.g < 0.5) \n\t{ \n\t\tga = overlay.g * base.g * 2.0; \n\t} \n\telse \n\t{ \n\t\tga = 1.0 - ((1.0 - base.g) * (1.0 - overlay.g) * 2.0); \n\t} \n\n\tif (base.b < 0.5) \n\t{\n\t\tba = overlay.b * base.b * 2.0; \n    } \n\telse \n\t{ \n\t\tba = 1.0 - ((1.0 - base.b) * (1.0 - overlay.b) * 2.0);\n\t}\n\t\n\ttextureColor = vec4(ra, ga, ba, 1.0); \n\tbase = (textureColor - base) + base; \n\n\t// step5-2 30% opacity  ExclusionBlending \n\ttextureColor = vec4(base.r, base.g, base.b, 1.0); \n    textureColor2 = vec4(0.113725, 0.0039, 0.0, 1.0); \n    textureColor2 = textureColor + textureColor2 - (2.0 * textureColor2 * textureColor); \n\n\tbase = (textureColor2 - textureColor) * 0.3 + textureColor; \n\tredCurveValue = texture2D(curve, vec2(base.r, 1.0)).a; \n\tgreenCurveValue = texture2D(curve, vec2(base.g, 1.0)).a; \n    blueCurveValue = texture2D(curve, vec2(base.b, 1.0)).a; \n\n\t// step6 screen with 60%\n    base = vec4(redCurveValue, greenCurveValue, blueCurveValue, 1.0); \n\toverlay = vec4(1.0, 1.0, 1.0, 1.0); \n\n\t// screen blending \n    textureColor = 1.0 - ((1.0 - base) * (1.0 - overlay)); \n    textureColor = (textureColor - base) * 0.05098 + base; \n\n\tgl_FragColor = vec4(textureColor.r, textureColor.g, textureColor.b, 1.0);\n} "
  },
  {
    "path": "MagicShow/src/main/res/raw/sunset.glsl",
    "content": "varying highp vec2 textureCoordinate; \n\nprecision highp float; \nuniform sampler2D inputImageTexture;\nuniform sampler2D curve; \n\nuniform sampler2D grey1Frame; \nuniform sampler2D grey2Frame; \n\nvoid main() \n{ \n\tfloat GreyVal; \n\tlowp vec4 textureColor; \n\tlowp vec4 textureColorOri; \n\tfloat xCoordinate = textureCoordinate.x; \n\tfloat yCoordinate = textureCoordinate.y; \n\n\thighp float redCurveValue; \n    highp float greenCurveValue; \n\thighp float blueCurveValue; \n\n    vec4 grey1Color; \n\tvec4 grey2Color; \n\n    textureColor = texture2D( inputImageTexture, vec2(xCoordinate, yCoordinate)); \n\tgrey1Color = texture2D(grey2Frame, vec2(xCoordinate, yCoordinate)); \n\tgrey2Color = texture2D(grey1Frame, vec2(xCoordinate, yCoordinate)); \n\n\t// step1 normal blending with original \n\tredCurveValue = texture2D(curve, vec2(textureColor.r, 0.0)).r; \n\tgreenCurveValue = texture2D(curve, vec2(textureColor.g, 0.0)).g; \n\tblueCurveValue = texture2D(curve, vec2(textureColor.b, 0.0)).b; \n\n    textureColorOri = vec4(redCurveValue, greenCurveValue, blueCurveValue, 1.0); \n    textureColor = (textureColorOri - textureColor) * grey1Color.r + textureColor; \n\n\tredCurveValue = texture2D(curve, vec2(textureColor.r, 0.0)).a; \n\tgreenCurveValue = texture2D(curve, vec2(textureColor.g, 0.0)).a; \n    blueCurveValue = texture2D(curve, vec2(textureColor.b, 0.0)).a; \n\n\t//textureColor = vec4(redCurveValue, greenCurveValue, blueCurveValue, 1.0); \n\n    // step3 60% opacity  ExclusionBlending \n\ttextureColor = vec4(redCurveValue, greenCurveValue, blueCurveValue, 1.0); \n    mediump vec4 textureColor2 = vec4(0.08627, 0.03529, 0.15294, 1.0); \n\ttextureColor2 = textureColor + textureColor2 - (2.0 * textureColor2 * textureColor); \n\n    textureColor = (textureColor2 - textureColor) * 0.6784 + textureColor; \n\n\n\tmediump vec4 overlay = vec4(0.6431, 0.5882, 0.5803, 1.0); \n\tmediump vec4 base = textureColor;\n\n\t// overlay blending \n    mediump float ra; \n\tif (base.r < 0.5) { \n\t\tra = overlay.r * base.r * 2.0; \n\t} else {\n\t\tra = 1.0 - ((1.0 - base.r) * (1.0 - overlay.r) * 2.0); \n\t} \n\n\tmediump float ga; \n\tif (base.g < 0.5) { \n\t\tga = overlay.g * base.g * 2.0; \n\t} else { \n\t\tga = 1.0 - ((1.0 - base.g) * (1.0 - overlay.g) * 2.0); \n\t} \n\n\tmediump float ba; \n\tif (base.b < 0.5) {\n\t\tba = overlay.b * base.b * 2.0; \n\t} else { \n\t\tba = 1.0 - ((1.0 - base.b) * (1.0 - overlay.b) * 2.0); \n\t} \n\n\ttextureColor = vec4(ra, ga, ba, 1.0); \n\tbase = (textureColor - base) + base;\n\n    // again overlay blending \n    overlay = vec4(0.0, 0.0, 0.0, 1.0);\n\n\t// overlay blending \n\tif (base.r < 0.5) { \n\t\tra = overlay.r * base.r * 2.0; \n\t} else { \n\t\tra = 1.0 - ((1.0 - base.r) * (1.0 - overlay.r) * 2.0); \n\t} \n\n\tif (base.g < 0.5) { \n\t\tga = overlay.g * base.g * 2.0;\n\t} else { \n\t\tga = 1.0 - ((1.0 - base.g) * (1.0 - overlay.g) * 2.0); \n\t} \n\n\tif (base.b < 0.5) { \n\t\tba = overlay.b * base.b * 2.0; \n\t} else { \n\t\tba = 1.0 - ((1.0 - base.b) * (1.0 - overlay.b) * 2.0); \n\t} \n\n    textureColor = vec4(ra, ga, ba, 1.0); \n\ttextureColor = (textureColor - base) * (grey2Color * 0.549) + base; \n\n\tgl_FragColor = vec4(textureColor.r, textureColor.g, textureColor.b, 1.0); \n} "
  },
  {
    "path": "MagicShow/src/main/res/raw/sutro.glsl",
    "content": "precision mediump float;\n \n varying mediump vec2 textureCoordinate;\n \n uniform sampler2D inputImageTexture;\n uniform sampler2D inputImageTexture2; //sutroMap;\n uniform sampler2D inputImageTexture3; //sutroMetal;\n uniform sampler2D inputImageTexture4; //softLight\n uniform sampler2D inputImageTexture5; //sutroEdgeburn\n uniform sampler2D inputImageTexture6; //sutroCurves\n \n uniform float strength;\n \n void main()\n {\n     vec4 originColor = texture2D(inputImageTexture, textureCoordinate);\n     vec3 texel = texture2D(inputImageTexture, textureCoordinate).rgb;\n     \n     vec2 tc = (2.0 * textureCoordinate) - 1.0;\n     float d = dot(tc, tc);\n     vec2 lookup = vec2(d, texel.r);\n     texel.r = texture2D(inputImageTexture2, lookup).r;\n     lookup.y = texel.g;\n     texel.g = texture2D(inputImageTexture2, lookup).g;\n     lookup.y = texel.b;\n     texel.b\t= texture2D(inputImageTexture2, lookup).b;\n     \n     vec3 rgbPrime = vec3(0.1019, 0.0, 0.0);\n     float m = dot(vec3(.3, .59, .11), texel.rgb) - 0.03058;\n     texel = mix(texel, rgbPrime + m, 0.32);\n     \n     vec3 metal = texture2D(inputImageTexture3, textureCoordinate).rgb;\n     texel.r = texture2D(inputImageTexture4, vec2(metal.r, texel.r)).r;\n     texel.g = texture2D(inputImageTexture4, vec2(metal.g, texel.g)).g;\n     texel.b = texture2D(inputImageTexture4, vec2(metal.b, texel.b)).b;\n     \n     texel = texel * texture2D(inputImageTexture5, textureCoordinate).rgb;\n     \n     texel.r = texture2D(inputImageTexture6, vec2(texel.r, .16666)).r;\n     texel.g = texture2D(inputImageTexture6, vec2(texel.g, .5)).g;\n     texel.b = texture2D(inputImageTexture6, vec2(texel.b, .83333)).b;\n     \n     texel.rgb = mix(originColor.rgb, texel.rgb, strength);\n\n     gl_FragColor = vec4(texel, 1.0);\n }"
  },
  {
    "path": "MagicShow/src/main/res/raw/sweets.glsl",
    "content": "precision mediump float; \n\nuniform lowp sampler2D inputImageTexture; \nuniform lowp sampler2D curve;\nuniform lowp sampler2D samplerMask;\nuniform lowp int lowPerformance;\n\nuniform float texelWidthOffset ;\nuniform float texelHeightOffset;\n\nvarying mediump vec2 textureCoordinate;\n\nvec4 sharpen(sampler2D sampler) \n{ \n\tvec4 color = texture2D(sampler, textureCoordinate) * 2.; \n\t\n\tcolor -= texture2D(sampler, textureCoordinate-vec2(texelWidthOffset, 0. )) * 0.25;\n\tcolor -= texture2D(sampler, textureCoordinate+vec2(texelWidthOffset, 0. )) * 0.25; \n\tcolor -= texture2D(sampler, textureCoordinate-vec2(0., texelHeightOffset)) * 0.25; \n\tcolor -= texture2D(sampler, textureCoordinate+vec2(0., texelHeightOffset)) * 0.25; \n\n    return color; \n} \n\nvec4 gaussianBlur(sampler2D sampler) \n{ \n\tlowp float strength = 1.; \n\t\n\tvec4 color = vec4(0.); \n\tvec2 step  = vec2(0.);\n\t\n\tcolor += texture2D(sampler,textureCoordinate)* 0.0443 ; \n\t\n\tstep.x = 1.49583 * texelWidthOffset  * strength; \n\tstep.y = 1.49583 * texelHeightOffset * strength; \n\tcolor += texture2D(sampler,textureCoordinate+vec2(step.x, 0.)) * 0.04321; \n\tcolor += texture2D(sampler,textureCoordinate-vec2(step.x, 0.)) * 0.04321; \n\tcolor += texture2D(sampler,textureCoordinate+vec2(0., step.y)) * 0.04321; \n\tcolor += texture2D(sampler,textureCoordinate-vec2(0., step.y)) * 0.04321; \n\t\n\tstep.x = 2.4719250988753685 * texelWidthOffset  * strength; \n\tstep.y = 2.4719250988753685 * texelHeightOffset * strength; \n\tcolor += texture2D(sampler,textureCoordinate+step) * 0.041795; \n\tcolor += texture2D(sampler,textureCoordinate-step) * 0.041795; \n\tcolor += texture2D(sampler,textureCoordinate+vec2(-step.x, step.y)) * 0.041795; \n\tcolor += texture2D(sampler,textureCoordinate+vec2( step.x,-step.y)) * 0.041795; \n\t\n\tstep.x = 5.49583 * texelWidthOffset  * strength; \n\tstep.y = 5.49583 * texelHeightOffset * strength; \n\tcolor += texture2D(sampler,textureCoordinate+vec2(step.x, 0.)) * 0.040425; \n\tcolor += texture2D(sampler,textureCoordinate-vec2(step.x, 0.)) * 0.040425; \n\tcolor += texture2D(sampler,textureCoordinate+vec2(0., step.y)) * 0.040425; \n\tcolor += texture2D(sampler,textureCoordinate-vec2(0., step.y)) * 0.040425; \n\n\tstep.x = 5.300352223621558 * texelWidthOffset  * strength; \n\tstep.y = 5.300352223621558 * texelHeightOffset * strength; \n\tcolor += texture2D(sampler,textureCoordinate+step) * 0.0391; \n\tcolor += texture2D(sampler,textureCoordinate-step) * 0.0391; \n\tcolor += texture2D(sampler,textureCoordinate+vec2(-step.x, step.y)) * 0.0391; \n\tcolor += texture2D(sampler,textureCoordinate+vec2( step.x,-step.y)) * 0.0391; \n\n\tstep.x = 9.49583 * texelWidthOffset  * strength; \n\tstep.y = 9.49583 * texelHeightOffset * strength; \n\tcolor += texture2D(sampler,textureCoordinate+vec2(step.x, 0.)) * 0.037815; \n\tcolor += texture2D(sampler,textureCoordinate-vec2(step.x, 0.)) * 0.037815; \n\tcolor += texture2D(sampler,textureCoordinate+vec2(0., step.y)) * 0.037815; \n\tcolor += texture2D(sampler,textureCoordinate-vec2(0., step.y)) * 0.037815; \n\t\n\tstep.x = 8.128779348367749 * texelWidthOffset  * strength; \n\tstep.y = 8.128779348367749 * texelHeightOffset * strength; \n\tcolor += texture2D(sampler,textureCoordinate+step) * 0.03658; \n\tcolor += texture2D(sampler,textureCoordinate-step) * 0.03658; \n\tcolor += texture2D(sampler,textureCoordinate+vec2(-step.x, step.y)) * 0.03658; \n\tcolor += texture2D(sampler,textureCoordinate+vec2( step.x,-step.y)) * 0.03658; \n\n\treturn color; \n} \n\nvec4 level(vec4 color, sampler2D sampler) \n{ \n\tcolor.r = texture2D(sampler, vec2(color.r, 0.)).r; \n\tcolor.g = texture2D(sampler, vec2(color.g, 0.)).g;\n\tcolor.b = texture2D(sampler, vec2(color.b, 0.)).b; \n\n\treturn color; \n} \n   \nvec4 normal(vec4 c1, vec4 c2, float alpha) \n{ \n\treturn (c2-c1) * alpha + c1;\n}   \n\nvec4 lighten(vec4 c1, vec4 c2) \n{ \n\treturn max(c1,c2);\n}\n\nvec4 overlay(vec4 c1, vec4 c2)\n{\n\tvec4 r1 = vec4(0.,0.,0.,1.); \n\tr1.r = c1.r < 0.5 ? 2.0*c1.r*c2.r : 1.0 - 2.0*(1.0-c1.r)*(1.0-c2.r);\n\tr1.g = c1.g < 0.5 ? 2.0*c1.g*c2.g : 1.0 - 2.0*(1.0-c1.g)*(1.0-c2.g);\n\tr1.b = c1.b < 0.5 ? 2.0*c1.b*c2.b : 1.0 - 2.0*(1.0-c1.b)*(1.0-c2.b);\n\t\n\treturn r1;\n} \n\nvec3 lerp (vec3 x, vec3 y, float s) \n{\n\treturn x+s*(y-x);\n} \n\nvec4 adjust (vec4 color, float brightness, float contrast, float saturation)\n{\n\tvec3 averageLuminance = vec3(0.5);\n\tvec3 brightedColor    = color.rgb * (brightness+1.);\n\tvec3 intensity        = vec3(dot(brightedColor, vec3(0.299, 0.587, 0.114)));\n\tvec3 saturatedColor   = lerp(intensity, brightedColor, saturation+1.);\n\tvec3 contrastedColor  = lerp(averageLuminance, saturatedColor, contrast+1.);\n\t\n\treturn vec4(contrastedColor,1.); \n}\n\nvec4 vibrance(vec4 color, float strength)\n{ \n\tfloat luminance = (color.r+color.g+color.b)/3.;\n\t//dot(color.rgb, vec3(0.299,0.587,0.114)); \n\tfloat maximum   = max(color.r, max(color.g, color.b));\n\tfloat amount    = (maximum-luminance)*-strength; \n\t\n\treturn vec4(color.rgb * (1.-amount) + maximum*amount, 1.); \n} \n  \nvoid main() \n{ \n\tvec4 c1; \n\tvec4 c2; \n\tif (lowPerformance == 1) \n\t{ \t\n\t\tc1 = texture2D(inputImageTexture, textureCoordinate); \t\n\t\tc2 = texture2D(inputImageTexture, textureCoordinate); \n    } \n\telse \n\t{ \n\t\tc1 = sharpen(inputImageTexture); \n\t\tc2 = normal(c1, gaussianBlur(inputImageTexture), 0.8); // radius = 13. sharpen?? gaussian blur? ???? ??, ?? blending?? ?? \n\t} \n\tvec4 c3 = normal(c1, lighten(c1,c2), 0.6); // lighten (0.6) \n    c3 = adjust(c3, 0.12, 0., 0.05); // brightness = 12, saturation = 0.5; \n    c3 = vibrance(level(c3, curve), 0.5); // vibrance = 0.5; \n\tc3 = normal(c3, overlay(c3, vec4(0.)), 1.-texture2D(samplerMask, textureCoordinate).r); // vignetting \n\t\n\tgl_FragColor = c3;\n}"
  },
  {
    "path": "MagicShow/src/main/res/raw/tender.glsl",
    "content": "varying highp vec2 textureCoordinate; \nprecision highp float; \n\nuniform sampler2D inputImageTexture;\nuniform sampler2D curve;\nuniform sampler2D grey1Frame; \n\nvoid main()\n{ \n\tmediump vec4 textureColor;\n\tmediump vec4 textureColorRes;\n\tvec4 grey1Color;\n\tmediump float satVal = 65.0 / 100.0; \n\tmediump float mask1R = 29.0 / 255.0; \n\tmediump float mask1G = 43.0 / 255.0; \n\tmediump float mask1B = 95.0 / 255.0;\n\t\n\thighp float xCoordinate = textureCoordinate.x;\n\thighp float yCoordinate = textureCoordinate.y;\n\t\n\thighp float redCurveValue;\n\thighp float greenCurveValue; \n\thighp float blueCurveValue; \n\n\ttextureColor = texture2D( inputImageTexture, vec2(xCoordinate, yCoordinate));\n\ttextureColorRes = textureColor;\n\n\tgrey1Color = texture2D(grey1Frame, vec2(xCoordinate, yCoordinate)); \n\n\t// step1. saturation\n    highp float G = (textureColor.r + textureColor.g + textureColor.b); \n\tG = G / 3.0; \n\n\tredCurveValue = ((1.0 - satVal) * G + satVal * textureColor.r);\n\tgreenCurveValue = ((1.0 - satVal) * G + satVal * textureColor.g); \n\tblueCurveValue = ((1.0 - satVal) * G + satVal * textureColor.b); \n\n\t// step2 curve \n    redCurveValue = texture2D(curve, vec2(textureColor.r, 0.0)).r;\n\tgreenCurveValue = texture2D(curve, vec2(textureColor.g, 0.0)).g;\n\tblueCurveValue = texture2D(curve, vec2(textureColor.b, 0.0)).b;\n\n\t// step3 30% opacity  ExclusionBlending\n\ttextureColor = vec4(redCurveValue, greenCurveValue, blueCurveValue, 1.0);\n\tmediump vec4 textureColor2 = vec4(mask1R, mask1G, mask1B, 1.0);\n    textureColor2 = textureColor + textureColor2 - (2.0 * textureColor2 * textureColor); \n\n\ttextureColor = (textureColor2 - textureColor) * 0.3 + textureColor; \n\n\tmediump vec4 overlay = vec4(0, 0, 0, 1.0); \n\tmediump vec4 base = vec4(textureColor.r, textureColor.g, textureColor.b, 1.0); \n\n\t// step4 overlay blending \n\tmediump float ra; \n    if (base.r < 0.5) \n\t{ \n\t\tra = overlay.r * base.r * 2.0; \n\t} \n\telse\n\t{ \n\t\tra = 1.0 - ((1.0 - base.r) * (1.0 - overlay.r) * 2.0);\n\t} \n\n\tmediump float ga; \n\tif (base.g < 0.5)\n\t{ \n\t\tga = overlay.g * base.g * 2.0;\n\t} \n\telse \n\t{ \n\t\tga = 1.0 - ((1.0 - base.g) * (1.0 - overlay.g) * 2.0); \n\t} \n\n    mediump float ba; \n\tif (base.b < 0.5) \n\t{ \n\t\tba = overlay.b * base.b * 2.0; \n\t} \n\telse \n\t{ \n\t\tba = 1.0 - ((1.0 - base.b) * (1.0 - overlay.b) * 2.0); \n\t} \n\n    textureColor = vec4(ra, ga, ba, 1.0); \n\tbase = (textureColor - base) * (grey1Color.r/2.0) + base; \n\n\tgl_FragColor = vec4(base.r, base.g, base.b, 1.0);\n}\n  "
  },
  {
    "path": "MagicShow/src/main/res/raw/toaster2_filter_shader.glsl",
    "content": "precision mediump float;\n\nvarying mediump vec2 textureCoordinate;\n\nuniform sampler2D inputImageTexture;\nuniform sampler2D inputImageTexture2; //toaster_metal\nuniform sampler2D inputImageTexture3; //toaster_soft_light\nuniform sampler2D inputImageTexture4; //toaster_curves\nuniform sampler2D inputImageTexture5; //toaster_overlay_map_warm\nuniform sampler2D inputImageTexture6; //toaster_color_shift\n\nvoid main()\n{\n    mediump vec3 texel;\n    mediump vec2 lookup;\n    vec2 blue;\n    vec2 green;\n    vec2 red;\n    mediump vec4 tmpvar_1;\n    tmpvar_1 = texture2D (inputImageTexture, textureCoordinate);\n    texel = tmpvar_1.xyz;\n    mediump vec4 tmpvar_2;\n    tmpvar_2 = texture2D (inputImageTexture2, textureCoordinate);\n    mediump vec2 tmpvar_3;\n    tmpvar_3.x = tmpvar_2.x;\n    tmpvar_3.y = tmpvar_1.x;\n    texel.x = texture2D (inputImageTexture3, tmpvar_3).x;\n    mediump vec2 tmpvar_4;\n    tmpvar_4.x = tmpvar_2.y;\n    tmpvar_4.y = tmpvar_1.y;\n    texel.y = texture2D (inputImageTexture3, tmpvar_4).y;\n    mediump vec2 tmpvar_5;\n    tmpvar_5.x = tmpvar_2.z;\n    tmpvar_5.y = tmpvar_1.z;\n    texel.z = texture2D (inputImageTexture3, tmpvar_5).z;\n    red.x = texel.x;\n    red.y = 0.16666;\n    green.x = texel.y;\n    green.y = 0.5;\n    blue.x = texel.z;\n    blue.y = 0.833333;\n    texel.x = texture2D (inputImageTexture4, red).x;\n    texel.y = texture2D (inputImageTexture4, green).y;\n    texel.z = texture2D (inputImageTexture4, blue).z;\n    mediump vec2 tmpvar_6;\n    tmpvar_6 = ((2.0 * textureCoordinate) - 1.0);\n    mediump vec2 tmpvar_7;\n    tmpvar_7.x = dot (tmpvar_6, tmpvar_6);\n    tmpvar_7.y = texel.x;\n    lookup = tmpvar_7;\n    texel.x = texture2D (inputImageTexture5, tmpvar_7).x;\n    lookup.y = texel.y;\n    texel.y = texture2D (inputImageTexture5, lookup).y;\n    lookup.y = texel.z;\n    texel.z = texture2D (inputImageTexture5, lookup).z;\n    red.x = texel.x;\n    green.x = texel.y;\n    blue.x = texel.z;\n    texel.x = texture2D (inputImageTexture6, red).x;\n    texel.y = texture2D (inputImageTexture6, green).y;\n    texel.z = texture2D (inputImageTexture6, blue).z;\n    mediump vec4 tmpvar_8;\n    tmpvar_8.w = 1.0;\n    tmpvar_8.xyz = texel;\n    gl_FragColor = tmpvar_8;\n}"
  },
  {
    "path": "MagicShow/src/main/res/raw/valencia.glsl",
    "content": "precision mediump float;\n \n varying mediump vec2 textureCoordinate;\n \n uniform sampler2D inputImageTexture;\n uniform sampler2D inputImageTexture2; //map\n uniform sampler2D inputImageTexture3; //gradMap\n \n mat3 saturateMatrix = mat3(\n                            1.1402,\n                            -0.0598,\n                            -0.061,\n                            -0.1174,\n                            1.0826,\n                            -0.1186,\n                            -0.0228,\n                            -0.0228,\n                            1.1772);\n \n vec3 lumaCoeffs = vec3(.3, .59, .11);\n \n uniform float strength;\n \n void main()\n {\n     vec4 originColor = texture2D(inputImageTexture, textureCoordinate);\n     vec3 texel = texture2D(inputImageTexture, textureCoordinate).rgb;\n     \n     texel = vec3(\n                  texture2D(inputImageTexture2, vec2(texel.r, .1666666)).r,\n                  texture2D(inputImageTexture2, vec2(texel.g, .5)).g,\n                  texture2D(inputImageTexture2, vec2(texel.b, .8333333)).b\n                  );\n     \n     texel = saturateMatrix * texel;\n     float luma = dot(lumaCoeffs, texel);\n     texel = vec3(\n                  texture2D(inputImageTexture3, vec2(luma, texel.r)).r,\n                  texture2D(inputImageTexture3, vec2(luma, texel.g)).g,\n                  texture2D(inputImageTexture3, vec2(luma, texel.b)).b);\n     \n     texel.rgb = mix(originColor.rgb, texel.rgb, strength);\n     gl_FragColor = vec4(texel, 1.0);\n }"
  },
  {
    "path": "MagicShow/src/main/res/raw/walden.glsl",
    "content": "precision mediump float;\n \nvarying mediump vec2 textureCoordinate;\n \nuniform sampler2D inputImageTexture;\nuniform sampler2D inputImageTexture2; //map\nuniform sampler2D inputImageTexture3; //vigMap\n\nuniform float strength;\n \nvoid main()\n{\n    vec4 originColor = texture2D(inputImageTexture, textureCoordinate);\n    vec3 texel = texture2D(inputImageTexture, textureCoordinate).rgb;\n     \n    texel = vec3(\n                  texture2D(inputImageTexture2, vec2(texel.r, .16666)).r,\n                  texture2D(inputImageTexture2, vec2(texel.g, .5)).g,\n                  texture2D(inputImageTexture2, vec2(texel.b, .83333)).b);\n     \n    vec2 tc = (2.0 * textureCoordinate) - 1.0;\n    float d = dot(tc, tc);\n    vec2 lookup = vec2(d, texel.r);\n    texel.r = texture2D(inputImageTexture3, lookup).r;\n    lookup.y = texel.g;\n    texel.g = texture2D(inputImageTexture3, lookup).g;\n    lookup.y = texel.b;\n    texel.b\t= texture2D(inputImageTexture3, lookup).b;\n     \n    texel.rgb = mix(originColor.rgb, texel.rgb, strength);\n\n    gl_FragColor = vec4(texel, 1.0);\n}"
  },
  {
    "path": "MagicShow/src/main/res/raw/warm.glsl",
    "content": "varying highp vec2 textureCoordinate;\nprecision highp float; \n  \nuniform sampler2D inputImageTexture;\nuniform sampler2D curve;\nuniform sampler2D greyFrame;\nuniform sampler2D layerImage;\n\nvoid main()\n{ \n\tlowp vec4 textureColor; \n\tvec4 greyColor;\n\tvec4 layerColor;\n\t\n\tfloat xCoordinate = textureCoordinate.x;\n\tfloat yCoordinate = textureCoordinate.y;\n\t\n\thighp float redCurveValue;\n\thighp float greenCurveValue; \n\thighp float blueCurveValue;\n\t\n\ttextureColor = texture2D( inputImageTexture, vec2(xCoordinate, yCoordinate));\n\t\n\tgreyColor = texture2D(greyFrame, vec2(xCoordinate, yCoordinate));\n\tlayerColor = texture2D(layerImage, vec2(xCoordinate, yCoordinate));\n\n\t// step1 curve\n\tredCurveValue = texture2D(curve, vec2(textureColor.r, 0.0)).r; \n\tgreenCurveValue = texture2D(curve, vec2(textureColor.g, 0.0)).g;\n\tblueCurveValue = texture2D(curve, vec2(textureColor.b, 0.0)).b; \n\n    // step2 curve with mask \n\ttextureColor = vec4(redCurveValue, greenCurveValue, blueCurveValue, 1.0);\n\n\tredCurveValue = texture2D(curve, vec2(textureColor.r, 0.0)).a;\n\tgreenCurveValue = texture2D(curve, vec2(textureColor.g, 0.0)).a; \n    blueCurveValue = texture2D(curve, vec2(textureColor.b, 0.0)).a; \n\n\tlowp vec4 textureColor2 = vec4(redCurveValue, greenCurveValue, blueCurveValue, 1.0); \n\n\t// step3 screen with 60% \n\tlowp vec4 base = vec4(mix(textureColor.rgb, textureColor2.rgb, 1.0 - greyColor.r), textureColor.a); \n\tlowp vec4 overlayer = vec4(layerColor.r, layerColor.g, layerColor.b, 1.0);\n\n    // screen blending \n\ttextureColor = 1.0 - ((1.0 - base) * (1.0 - overlayer));\n\ttextureColor = (textureColor - base) * 0.6 + base;\n\t\n\tredCurveValue = texture2D(curve, vec2(textureColor.r, 1.0)).r; \n\tgreenCurveValue = texture2D(curve, vec2(textureColor.g, 1.0)).g;\n\tblueCurveValue = texture2D(curve, vec2(textureColor.b, 1.0)).b; \n\ttextureColor = vec4(redCurveValue, greenCurveValue, blueCurveValue, 1.0); \n\n\tgl_FragColor = vec4(textureColor.r, textureColor.g, textureColor.b, 1.0); \n}"
  },
  {
    "path": "MagicShow/src/main/res/raw/whitecat.glsl",
    "content": "varying highp vec2 textureCoordinate;\nprecision highp float;\nuniform sampler2D inputImageTexture; \nuniform sampler2D curve; \n\nvec3 rgb2hsv(vec3 c) \n{ \n\tvec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0); \n\tvec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));\n\tvec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r)); \n\t\n\tfloat d = q.x - min(q.w, q.y); \n\tfloat e = 1.0e-10; \n\treturn vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x); \n} \n\nvec3 hsv2rgb(vec3 c) \n{ \n\tvec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0); \n\tvec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www); \n\treturn c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y); \n} \n\nvoid main() \n{ \n    float GreyVal; \n\tlowp vec4 textureColor; \n\tlowp vec4 textureColorOri;\n\tfloat xCoordinate = textureCoordinate.x;\n\tfloat yCoordinate = textureCoordinate.y; \n\n\thighp float redCurveValue;\n\thighp float greenCurveValue;\n\thighp float blueCurveValue; \n\n\ttextureColor = texture2D( inputImageTexture, vec2(xCoordinate, yCoordinate)); \n\n\t// step1 20% opacity  ExclusionBlending \n    mediump vec4 textureColor2 = textureColor; \n\ttextureColor2 = textureColor + textureColor2 - (2.0 * textureColor2 * textureColor); \n\n\ttextureColor = (textureColor2 - textureColor) * 0.2 + textureColor; \n\n    // step2 curve \n    redCurveValue = texture2D(curve, vec2(textureColor.r, 0.0)).r; \n\tgreenCurveValue = texture2D(curve, vec2(textureColor.g, 0.0)).g; \n\tblueCurveValue = texture2D(curve, vec2(textureColor.b, 0.0)).b; \n\n    redCurveValue = texture2D(curve, vec2(redCurveValue, 1.0)).r; \n\tgreenCurveValue = texture2D(curve, vec2(greenCurveValue, 1.0)).r;\n\tblueCurveValue = texture2D(curve, vec2(blueCurveValue, 1.0)).r; \n\n\tredCurveValue = texture2D(curve, vec2(redCurveValue, 1.0)).g; \n\tgreenCurveValue = texture2D(curve, vec2(greenCurveValue, 1.0)).g; \n\tblueCurveValue = texture2D(curve, vec2(blueCurveValue, 1.0)).g; \n\n\n\tvec3 tColor = vec3(redCurveValue, greenCurveValue, blueCurveValue); \n\ttColor = rgb2hsv(tColor); \n\n\ttColor.g = tColor.g * 0.65; \n\n\ttColor = hsv2rgb(tColor); \n    tColor = clamp(tColor, 0.0, 1.0); \n\n    mediump vec4 base = vec4(tColor, 1.0); \n\tmediump vec4 overlay = vec4(0.62, 0.6, 0.498, 1.0); \n\t// step6 overlay blending \n    mediump float ra; \n\tif (base.r < 0.5) \n\t{ \n\t\tra = overlay.r * base.r * 2.0;\n\t} else \n\t{ \n\t\tra = 1.0 - ((1.0 - base.r) * (1.0 - overlay.r) * 2.0);\n\t}\n\n    mediump float ga; \n\tif (base.g < 0.5) \n\t{ \n\t\tga = overlay.g * base.g * 2.0; \n\t} else \n\t{ \n\t\tga = 1.0 - ((1.0 - base.g) * (1.0 - overlay.g) * 2.0); \n\t} \n\n\tmediump float ba; \n\tif (base.b < 0.5) \n\t{ \n\t\tba = overlay.b * base.b * 2.0; \n\t} else \n\t{ \n\t\tba = 1.0 - ((1.0 - base.b) * (1.0 - overlay.b) * 2.0); \n\t} \n\ttextureColor = vec4(ra, ga, ba, 1.0); \n\ttextureColor = (textureColor - base) * 0.1 + base; \n\n\tgl_FragColor = vec4(textureColor.r, textureColor.g, textureColor.b, 1.0); \n} \n\t"
  },
  {
    "path": "MagicShow/src/main/res/raw/xproii_filter_shader.glsl",
    "content": "precision mediump float;\n \n varying mediump vec2 textureCoordinate;\n \n uniform sampler2D inputImageTexture;\n uniform sampler2D inputImageTexture2; //map\n uniform sampler2D inputImageTexture3; //vigMap\n \n uniform float strength;\n \n void main()\n {\n     vec4 originColor = texture2D(inputImageTexture, textureCoordinate);\n    vec3 texel = texture2D(inputImageTexture, textureCoordinate).rgb;\n    \n    vec2 tc = (2.0 * textureCoordinate) - 1.0;\n    float d = dot(tc, tc);\n    vec2 lookup = vec2(d, texel.r);\n    texel.r = texture2D(inputImageTexture3, lookup).r;\n    lookup.y = texel.g;\n    texel.g = texture2D(inputImageTexture3, lookup).g;\n    lookup.y = texel.b;\n    texel.b\t= texture2D(inputImageTexture3, lookup).b;\n    \n    vec2 red = vec2(texel.r, 0.16666);\n    vec2 green = vec2(texel.g, 0.5);\n    vec2 blue = vec2(texel.b, .83333);\n    texel.r = texture2D(inputImageTexture2, red).r;\n    texel.g = texture2D(inputImageTexture2, green).g;\n    texel.b = texture2D(inputImageTexture2, blue).b;\n    \n     texel.rgb = mix(originColor.rgb, texel.rgb, strength);\n     \n    gl_FragColor = vec4(texel, 1.0);\n    \n}"
  },
  {
    "path": "MagicShow/src/main/res/values/colors.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n    <color name=\"filter_color_blue\">#ff5cbadc</color>\n    <color name=\"filter_color_blue_dark\">#3d5afe</color>\n    <color name=\"filter_color_blue_dark_dark\">#1e3250</color>\n    <color name=\"filter_color_red\">#ff6666</color>\n    <color name=\"filter_color_red_dark\">#b93221</color>\n    <color name=\"filter_color_orange\">#fe9833</color>\n    <color name=\"filter_color_pink\">#cc99cc</color>\n    <color name=\"filter_color_grey_light\">#c4c4c4</color>\n    <color name=\"filter_color_yellow_dark\">#c8ca34</color>\n    <color name=\"filter_color_green_dark\">#568f35</color>\n    <color name=\"filter_color_brown_dark\">#e69138</color>\n    <color name=\"filter_color_brown\">#c8ca34</color>\n    <color name=\"filter_color_brown_light\">#ff9933</color>\n    <color name=\"image_edit_modify_controller_bg\">#89000000</color>\n    <!--90% 白-->\n    <color name=\"white_percent_90\">#e6ffffff</color>\n    <color name=\"white\">#ffffff</color>\n    <color name=\"qian_lan\">#32c4c4</color>\n    <color name=\"greyish_brown\">#3c3c3c</color>\n    <color name=\"warm_grey\">#7d7d7d</color>\n</resources>\n"
  },
  {
    "path": "MagicShow/src/main/res/values/dimens.xml",
    "content": "<resources>\n\t<dimen name=\"seekbar_progress_height\">3.0dip</dimen> \n\t<dimen name=\"seekbar_thumb_offset\">6.0dip</dimen>\n\t<dimen name=\"seekbar_button_height\">60.0dip</dimen>\n    <dimen name=\"seekbar_gradient_seek_bar_line_width\">12.0px</dimen>\n    <dimen name=\"seekbar_layout_height\">220.0dip</dimen>\n    <dimen name=\"seekbar_line_width\">2.0px</dimen>\n    <dimen name=\"seekbar_margin_left\">34.0dip</dimen>\n    <dimen name=\"seekbar_margin_right\">34.0dip</dimen>\n    <dimen name=\"seekbar_nail_radius\">8.0px</dimen>\n    <dimen name=\"seekbar_nail_stroke_width\">2.0px</dimen>\n    <dimen name=\"seekbar_thumb_radius\">24.0px</dimen>\n</resources>\n"
  },
  {
    "path": "MagicShow/src/main/res/values/strings.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n\n    <string name=\"app_name\">MagicCamera</string>\n    <string name=\"filter_none\">Original</string>\n    <string name=\"filter_amaro\">Amaro</string>\n\t<string name=\"filter_brannan\">Brannan</string>\n\t<string name=\"filter_brooklyn\">Brooklyn</string>\n\t<string name=\"filter_Earlybird\">EarlyBird</string>\n\t<string name=\"filter_freud\">Freud</string>\n\t<string name=\"filter_hefe\">Hefe</string>\n\t<string name=\"filter_hudson\">Hudson</string>\n\t<string name=\"filter_inkwell\">Inkwell</string>\n\t<string name=\"filter_kevin\">Kevin</string>\n\t<string name=\"filter_lomo\">Lomo</string>\n\t<string name=\"filter_n1977\">1977</string>\n\t<string name=\"filter_nashville\">Nashville</string>\n\t<string name=\"filter_pixar\">Pixar</string>\n\t<string name=\"filter_rise\">Rise</string>\n\t<string name=\"filter_sierra\">Sierra</string>\n\t<string name=\"filter_sutro\">Sutro</string>\n\t<string name=\"filter_toastero\">Toaster2</string>\n\t<string name=\"filter_valencia\">Valencia</string>\n\t<string name=\"filter_walden\">Walden</string>\n\t<string name=\"filter_xproii\">XproII</string>\n\t<string name=\"filter_whitecat\">WhiteCat</string>\n\t<string name=\"filter_blackcat\">BlackCat</string>\n\t<string name=\"filter_romance\">Romance</string>\n\t<string name=\"filter_sakura\">Sakura</string>\n\t<string name=\"filter_antique\">Antique</string>\n\t<string name=\"filter_beauty\">Beauty</string>\n\t<string name=\"filter_calm\">Calm</string>\n\t<string name=\"filter_cool\">Cool</string>\n\t<string name=\"filter_emerald\">Emerald</string>\n\t<string name=\"filter_evergreen\">Evergreen</string>\n\t<string name=\"filter_fairytale\">Fairytale</string>\n\t<string name=\"filter_healthy\">Healthy</string>\n\t<string name=\"filter_latte\">Latte</string>\n\t<string name=\"filter_nostalgia\">Nostalgia</string>\n\t<string name=\"filter_tender\">Tender</string>\n\t<string name=\"filter_warm\">Warm</string>\n\t<string name=\"filter_sweets\">Sweets</string>\n\t<string name=\"filter_sunrise\">Sunrise</string>\n\t<string name=\"filter_sunset\">Sunset</string>\n\t<string name=\"filter_skinwhiten\">SkinWhiten</string>\n\t<string name=\"filter_crayon\">Crayon</string>\n\t<string name=\"filter_sketch\">Sketch</string>\n\t\n\t<string name=\"edit_filter\">Filter</string>\n\t<string name=\"edit_edit\">Edit</string>\n\t<string name=\"edit_adds\">Adds</string>\n\t<string name=\"edit_frame\">Frame</string>\n\t<string name=\"edit_beauty\">Beauty</string>\n\t\n\t<string name=\"edit_contrast\">Contrast</string>\n\t<string name=\"edit_exposure\">Exposure</string>\n\t<string name=\"edit_vibrance\">Vibrance</string>\n\t<string name=\"edit_saturation\">Saturation</string>\n\t<string name=\"edit_sharpness\">Sharpness</string>\n\t<string name=\"edit_brightness\">Bright</string>\n\t<string name=\"edit_hue\">Hue</string>\n\t<string name=\"dialog_yes_or_no_yes\">Confirm</string>\n\t<string name=\"dialog_yes_or_no_no\">Cancel</string>\n</resources>\n"
  },
  {
    "path": "MagicShow/src/main/res/values/styles.xml",
    "content": "<resources xmlns:android=\"http://schemas.android.com/apk/res/android\">\n\n    <!--\n        Base application theme, dependent on API level. This theme is replaced\n        by AppBaseTheme from res/values-vXX/styles.xml on newer devices.\n    -->\n    <style name=\"AppBaseTheme\" parent=\"android:Theme.Light\">\n        <!--\n            Theme customizations available in newer API levels can go in\n            res/values-vXX/styles.xml, while customizations related to\n            backward-compatibility can go here.\n        -->\n    </style>\n\n    <!-- Application theme. -->\n    <style name=\"AppTheme\" parent=\"AppBaseTheme\">\n        <item name=\"android:windowNoTitle\">true</item>\n        <item name=\"android:windowFullscreen\">true</item>\n        <item name=\"android:windowBackground\">@android:color/black</item>\n    </style>\n    \n    <style name=\"SeekBar\">\n        <item name=\"android:paddingLeft\">15.0dip</item>\n        <item name=\"android:paddingRight\">15.0dip</item>\n        <item name=\"android:layout_width\">fill_parent</item>\n        <item name=\"android:layout_height\">wrap_content</item>\n        <item name=\"android:layout_marginTop\">5.0dip</item>\n        <item name=\"android:layout_marginBottom\">5.0dip</item>\n        <item name=\"android:maxHeight\">@dimen/seekbar_progress_height</item>\n        <item name=\"android:progressDrawable\">@drawable/seekbar_progress</item>\n        <item name=\"android:minHeight\">@dimen/seekbar_progress_height</item>\n        <item name=\"android:thumb\">@drawable/seekbar_thumb</item>\n        <item name=\"android:isScrollContainer\">true</item>\n        <item name=\"android:fadeScrollbars\">true</item>\n    </style>\n    <style name=\"SeekBar.Light\" parent=\"@style/SeekBar\">\n        <item name=\"android:layout_marginTop\">0.0dip</item>\n        <item name=\"android:layout_marginBottom\">0.0dip</item>\n        <item name=\"android:progressDrawable\">@drawable/seekbar_progress_light</item>\n        <item name=\"android:thumb\">@drawable/seekbar_thumb_light</item>\n    </style>\n    <style name=\"ImageEditor_radiobutton\">\n        <item name=\"android:layout_weight\">1.0</item>\n        <item name=\"android:layout_width\">0dip</item>\n        <item name=\"android:layout_height\">wrap_content</item>\n        <item name=\"android:button\">@null</item>\n        <item name=\"android:gravity\">center</item>\n        <item name=\"android:textColor\">@color/selector_image_edit</item>\n        <item name=\"android:textSize\">15sp</item>\n    </style>\n    <style name=\"ImageEditor_button_txt\">\n        <item name=\"android:gravity\">center</item>\n        <item name=\"android:textColor\">@color/selector_image_edit</item>\n        <item name=\"android:textSize\">14sp</item>\n    </style>\n    <style name=\"ImageEditor_adjust_radiobutton\">\n        <item name=\"android:layout_weight\">1.0</item>\n        <item name=\"android:layout_width\">0dip</item>\n        <item name=\"android:layout_height\">wrap_content</item>\n        <item name=\"android:button\">@null</item>\n        <item name=\"android:gravity\">center</item>\n        <item name=\"android:textColor\">@color/selector_image_edit_yellow</item>\n        <item name=\"android:paddingLeft\">10dp</item>\n        <item name=\"android:paddingRight\">10dp</item>\n        <item name=\"android:textSize\">14sp</item>\n    </style>\n\n    <style name=\"loading_dialog\" parent=\"android:style/Theme.Dialog\">\n        <item name=\"android:windowFrame\">@null</item>\n        <item name=\"android:windowNoTitle\">true</item>\n        <item name=\"android:backgroundDimEnabled\">true</item>\n        <item name=\"android:windowBackground\">@android:color/transparent</item>\n        <item name=\"android:windowIsFloating\">true</item>\n        <item name=\"android:windowContentOverlay\">@null</item>\n    </style>\n</resources>\n"
  },
  {
    "path": "MagicShow/src/main/res/values-v11/styles.xml",
    "content": "<resources>\n\n    <!--\n        Base application theme for API 11+. This theme completely replaces\n        AppBaseTheme from res/values/styles.xml on API 11+ devices.\n    -->\n    <style name=\"AppBaseTheme\" parent=\"android:Theme.Holo.Light\">\n       <item name=\"android:windowNoTitle\">true</item>\n        <item name=\"android:windowFullscreen\">true</item>\n        <item name=\"android:windowContentOverlay\">@null</item>\n    </style>\n\n</resources>\n"
  },
  {
    "path": "MagicShow/src/main/res/values-v14/styles.xml",
    "content": "<resources>\n\n    <!--\n        Base application theme for API 14+. This theme completely replaces\n        AppBaseTheme from BOTH res/values/styles.xml and\n        res/values-v11/styles.xml on API 14+ devices.\n    -->\n    <style name=\"AppBaseTheme\" parent=\"android:Theme.Holo.Light.DarkActionBar\">\n        <item name=\"android:windowNoTitle\">true</item>\n        <item name=\"android:windowFullscreen\">true</item>\n        <item name=\"android:windowContentOverlay\">@null</item>\n    </style>\n\n</resources>\n"
  },
  {
    "path": "MagicShow/src/main/res/values-v21/styles.xml",
    "content": "<resources>\n\n    <!--\n        Base application theme for API 14+. This theme completely replaces\n        AppBaseTheme from BOTH res/values/styles.xml and\n        res/values-v11/styles.xml on API 14+ devices.\n    -->\n    <style name=\"AppBaseTheme\" parent=\"android:Theme.Holo.Light.DarkActionBar\">\n        <item name=\"android:windowNoTitle\">true</item>\n        <item name=\"android:windowFullscreen\">true</item>\n        <item name=\"android:windowContentOverlay\">@null</item>\n\n    </style>\n\n</resources>\n"
  },
  {
    "path": "MagicShow/src/main/res/values-w820dp/dimens.xml",
    "content": "<resources>\n    <!-- Example customization of dimensions originally defined in res/values/dimens.xml\n         (such as screen margins) for screens with more than 820dp of available width. This\n         would include 7\" and 10\" devices in landscape (~960dp and ~1280dp respectively). -->\n    <dimen name=\"activity_horizontal_margin\">64dp</dimen>\n</resources>\n"
  },
  {
    "path": "MagicShow/src/main/res/values-zh-rCN/strings.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n    <string name=\"filter_none\">原图</string>\n\t<string name=\"filter_whitecat\">白猫</string>\n\t<string name=\"filter_blackcat\">黑猫</string>\n\t<string name=\"filter_romance\">浪漫</string>\n\t<string name=\"filter_sakura\">樱花</string>\n\t<string name=\"filter_antique\">复古</string>\n\t<string name=\"filter_beauty\">美肤</string>\n\t<string name=\"filter_calm\">平静</string>\n\t<string name=\"filter_cool\">冰冷</string>\n\t<string name=\"filter_emerald\">祖母绿</string>\n\t<string name=\"filter_evergreen\">常青</string>\n\t<string name=\"filter_fairytale\">童话</string>\n\t<string name=\"filter_healthy\">健康</string>\n\t<string name=\"filter_latte\">拿铁</string>\n\t<string name=\"filter_nostalgia\">怀旧</string>\n\t<string name=\"filter_tender\">温柔</string>\n\t<string name=\"filter_warm\">温暖</string>\n\t<string name=\"filter_sweets\">甜品</string>\n\t<string name=\"filter_sunrise\">日出</string>\n\t<string name=\"filter_sunset\">日落</string>\n\t<string name=\"filter_skinwhiten\">美白</string>\n\t<string name=\"filter_crayon\">蜡笔</string>\n\t<string name=\"filter_sketch\">素描</string>\n\t\n\t<string name=\"edit_filter\">滤镜</string>\n\t<string name=\"edit_edit\">编辑</string>\n\t<string name=\"edit_adds\">装饰</string>\n\t<string name=\"edit_frame\">边框</string>\n\t<string name=\"edit_beauty\">美颜</string>\n\t\n\t<string name=\"edit_contrast\">对比度</string>\n\t<string name=\"edit_exposure\">曝光</string>\n\t<string name=\"edit_vibrance\">自然饱和度</string>\n\t<string name=\"edit_saturation\">饱和度</string>\n\t<string name=\"edit_sharpness\">锐化</string>\n\t<string name=\"edit_brightness\">亮度</string>\n\t<string name=\"edit_hue\">色调</string>\n\t<string name=\"dialog_yes_or_no_yes\">确定</string>\n\t<string name=\"dialog_yes_or_no_no\">取消</string>\n</resources>\n"
  },
  {
    "path": "MagicShow/src/test/java/com/zero/magicshow/core/ExampleUnitTest.java",
    "content": "package com.zero.lib;\n\nimport org.junit.Test;\n\nimport static org.junit.Assert.*;\n\n/**\n * To work on unit tests, switch the Test Artifact in the Build Variants view.\n */\npublic class ExampleUnitTest {\n    @Test\n    public void addition_isCorrect() throws Exception {\n        assertEquals(4, 2 + 2);\n    }\n}"
  },
  {
    "path": "README.md",
    "content": "### 疯狂的程序员群：186305789，没准你能遇到绝影大神\n### 个人兴趣网站，[zero接码平台](https://xinghai.party)\n### 个人兴趣网站，[猿指](https://blog.xinghai.party)\n# MagicShow\n包含美颜等40余种实时滤镜相机，可拍照、图片修改 \n图片编辑包含常规参数设置（对比度，饱和度等）、美颜（美白，磨皮）、滤镜\n# Demo说明\n本demo并不包含相册功能，所以demo中打开Album请预先在SD卡中存储如下图片：/sdcard/DCIM/dark.jpg\n# 集成方法\n```java\n// 根目录build.gradle文件下引入jitpack仓库\nmaven {\n    url 'https://jitpack.io'\n}\n// 具体使用的module中添加如下依赖\ndependencies {\n    implementation 'com.github.zerochl:MagicShow:1.0.4'\n}\n```\n# 使用方式\n```java\nMagicShowManager.getInstance().openEdit(activity,imagePath, new ImageEditCallBack() {\n    @Override\n    public void onCompentFinished(MagicShowResultEntity magicShowResultEntity) {\n        Log.e(\"HongLi\",\"获取图片地址:\" + magicShowResultEntity.getFilePath());\n    }\n});\n```\n    \n打开拍照，拍照之后直接进图片编辑\n```java\nMagicShowManager.getInstance().openCameraAndEdit(activity,new ImageEditCallBack(){\n    @Override\n    public void onCompentFinished(MagicShowResultEntity magicShowResultEntity) {\n\n    }\n});\n```\n    \n打开拍照,拍照实现了滤镜效果，CameraConfig可设置拍照图片的大小\n```java\nMagicShowManager.getInstance().openCamera(activity,new CameraShootCallBack(){\n    @Override\n    public void onCompentFinished(MagicShowResultEntity magicShowResultEntity) {\n\n    }\n});\n```\n    \n提供了MagicShowManager方法，回调里面会返回编辑成功之后的图片信息\n\n"
  },
  {
    "path": "app/.gitignore",
    "content": "/build\n"
  },
  {
    "path": "app/build.gradle",
    "content": "apply plugin: 'com.android.application'\napply from: \"$project.rootDir/tools/versions_configuration.gradle\"\n\nandroid {\n    compileSdkVersion getProject().compileSdkVersion\n    buildToolsVersion getProject().buildToolsVersion\n\n    defaultConfig {\n        applicationId \"com.zero.magicshowsim\"\n        minSdkVersion getProject().minSdkVersion\n        targetSdkVersion getProject().targetSdkVersion\n        versionCode getProject().appCode\n        versionName getProject().appVersions\n    }\n    signingConfigs {\n        release {\n//            storeFile file(\"I:\\\\document\\\\real\\\\DuNang.keystore\")\n            storePassword \"android\"\n            keyAlias \"DuNang\"\n            keyPassword \"android\"\n        }\n        debug {\n//            storeFile file(\"I:\\\\document\\\\DuNangTest.keystore\")\n//            storePassword \"android\"\n//            keyAlias \"androiddebugkey\"\n//            keyPassword \"android\"\n        }\n    }\n    buildTypes {\n        release {\n            signingConfig signingConfigs.release\n            minifyEnabled = false\n            // Zipalign优化\n            zipAlignEnabled true\n            proguardFiles.add(file('proguard-rules.pro'))\n        }\n        debug {\n            minifyEnabled = false\n            // Zipalign优化\n            zipAlignEnabled true\n            proguardFiles.add(file('proguard-rules.pro'))\n        }\n    }\n    sourceSets{\n        main{\n            jniLibs.srcDirs = ['src/main/jniLibs']\n        }\n    }\n    lintOptions{\n        checkReleaseBuilds false\n        abortOnError false\n    }\n}\n\n\ndependencies {\n    implementation fileTree(dir: 'libs', include: ['*.jar'])\n    testImplementation 'junit:junit:4.12'\n    implementation project(':MagicShow')\n}\n"
  },
  {
    "path": "app/proguard-rules.pro",
    "content": "# Add project specific ProGuard rules here.\n# By default, the flags in this file are appended to flags specified\n# in D:\\android-sdk-windows/tools/proguard/proguard-android.txt\n# You can edit the include path and order by changing the proguardFiles\n# directive in build.gradle.\n#\n# For more details, see\n#   http://developer.android.com/guide/developing/tools/proguard.html\n\n# Add any project specific keep options here:\n\n# If your project uses WebView with JS, uncomment the following\n# and specify the fully qualified class name to the JavaScript interface\n# class:\n#-keepclassmembers class fqcn.of.javascript.interface.for.webview {\n#   public *;\n#}\n"
  },
  {
    "path": "app/src/androidTest/java/com/zero/magicshow/ApplicationTest.java",
    "content": "package com.zero.magicshow;\n\nimport android.app.Application;\nimport android.test.ApplicationTestCase;\n\n/**\n * <a href=\"http://d.android.com/tools/testing/testing_android.html\">Testing Fundamentals</a>\n */\npublic class ApplicationTest extends ApplicationTestCase<Application> {\n    public ApplicationTest() {\n        super(Application.class);\n    }\n}"
  },
  {
    "path": "app/src/main/AndroidManifest.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    package=\"com.zero.magicshowsim\">\n\n    <uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\" />\n    <uses-permission android:name=\"android.permission.CAMERA\" />\n\n    <uses-permission android:name=\"android.permission.INTERNET\" />\n    <application\n        android:allowBackup=\"true\"\n        android:icon=\"@drawable/ic_launcher\"\n        android:label=\"@string/app_name\">\n        <activity\n            android:name=\"com.zero.magicshowsim.MainActivity\"\n            android:configChanges=\"keyboardHidden|orientation\"\n            android:theme=\"@style/AppTheme\">\n            <intent-filter>\n                <action android:name=\"android.intent.action.MAIN\" />\n\n                <category android:name=\"android.intent.category.LAUNCHER\" />\n            </intent-filter>\n        </activity>\n        <activity android:name=\"com.zero.magicshow.activity.CameraActivity\"\n            android:configChanges=\"keyboardHidden|orientation\"\n            android:theme=\"@style/AppTheme\"></activity>\n        <activity android:name=\"com.zero.magicshow.activity.AlbumActivity\"\n            android:screenOrientation=\"portrait\"\n            android:configChanges=\"keyboardHidden|orientation\"\n            android:theme=\"@style/AppTheme\"></activity>\n    </application>\n</manifest>\n"
  },
  {
    "path": "app/src/main/java/com/zero/magicshowsim/MainActivity.java",
    "content": "package com.zero.magicshowsim;\n\nimport android.Manifest;\nimport android.app.Activity;\nimport android.content.Intent;\nimport android.content.pm.PackageManager;\nimport android.os.Bundle;\nimport android.support.v4.app.ActivityCompat;\nimport android.support.v4.content.PermissionChecker;\nimport android.util.Log;\nimport android.view.View;\n\nimport com.zero.magicshow.MagicShowManager;\nimport com.zero.magicshow.activity.AlbumActivity;\nimport com.zero.magicshow.activity.CameraActivity;\nimport com.zero.magicshow.common.config.PathConfig;\nimport com.zero.magicshow.common.entity.MagicShowResultEntity;\nimport com.zero.magicshow.common.iface.ImageEditCallBack;\nimport com.zero.zerolib.util.BaseUtil;\n\npublic class MainActivity extends Activity {\n\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(com.zero.magicshow.R.layout.activity_main);\n        PathConfig.setTempCache(\"/sdcard/DCIM\");\n        findViewById(com.zero.magicshow.R.id.button_camera).setOnClickListener(new View.OnClickListener() {\n            @Override\n            public void onClick(View v) {\n                if (PermissionChecker.checkSelfPermission(MainActivity.this, Manifest.permission.CAMERA)\n                        == PackageManager.PERMISSION_DENIED) {\n                    ActivityCompat.requestPermissions(MainActivity.this, new String[] { Manifest.permission.CAMERA },\n                            v.getId());\n                } else {\n//                    startActivity(v.getId());\n                    MagicShowManager.getInstance().openCameraAndEdit(MainActivity.this, new ImageEditCallBack() {\n                        @Override\n                        public void onCompentFinished(MagicShowResultEntity magicShowResultEntity) {\n                            Log.e(\"HongLi\",\"获取图片地址:\" + magicShowResultEntity.getAngle() + \";\" + magicShowResultEntity.getFilePath());\n                            BaseUtil.showToast(MainActivity.this,magicShowResultEntity.getFilePath());\n                        }\n                    });\n                }\n            }\n        });\n        findViewById(com.zero.magicshow.R.id.button_album).setOnClickListener(new View.OnClickListener() {\n            @Override\n            public void onClick(View v) {\n//                startActivity(new Intent(MainActivity.this, AlbumActivity.class));\n                Log.e(\"HongLi\",\"图片角度:\" + com.zero.magicshow.common.utils.BaseUtil.readPictureDegree(\"/sdcard/DCIM/dark.jpg\"));\n                MagicShowManager.getInstance().openEdit(MainActivity.this,\"/sdcard/DCIM/dark.jpg\", new ImageEditCallBack() {\n                    @Override\n                    public void onCompentFinished(MagicShowResultEntity magicShowResultEntity) {\n                        Log.e(\"HongLi\",\"获取图片地址:\" + magicShowResultEntity.getFilePath());\n                    }\n                });\n            }\n        });\n    }\n\n    @Override\n    public void onRequestPermissionsResult(int requestCode, String[] permissions,\n                                                     int[] grantResults) {\n        if (grantResults.length != 1 || grantResults[0] == PackageManager.PERMISSION_GRANTED) {\n            startActivity(requestCode);\n        } else {\n            super.onRequestPermissionsResult(requestCode, permissions, grantResults);\n        }\n    }\n\n    private void startActivity(int id) {\n        switch (id) {\n            case com.zero.magicshow.R.id.button_camera:\n                startActivity(new Intent(this, CameraActivity.class));\n                break;\n            default:\n                startActivity(new Intent(this, AlbumActivity.class));\n                break;\n        }\n    }\n}\n"
  },
  {
    "path": "app/src/main/res/anim/bottom_sliding_in.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<set xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <translate android:fromYDelta=\"100%p\" android:toYDelta=\"0\"\n        android:duration=\"300\"/>\n</set>"
  },
  {
    "path": "app/src/main/res/anim/bottom_sliding_out.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<set xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <translate android:fromYDelta=\"0\" android:toYDelta=\"100%p\"\n        android:duration=\"300\"/>\n</set>"
  },
  {
    "path": "app/src/main/res/color/selector_image_back.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<selector\n  xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <item android:state_pressed=\"true\" android:color=\"@android:color/background_light\" />\n    <item android:color=\"@android:color/black\" />\n</selector>"
  },
  {
    "path": "app/src/main/res/color/selector_image_edit.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<selector\n  xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <item android:state_checked=\"true\" android:color=\"@color/filter_color_orange\" />\n    <item android:state_pressed=\"true\" android:color=\"@color/filter_color_orange\" />\n    <item android:color=\"@android:color/white\" />\n</selector>"
  },
  {
    "path": "app/src/main/res/color/selector_image_edit_yellow.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<selector\n  xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <item android:state_checked=\"true\" android:color=\"#EEEE00\" />\n    <item android:state_pressed=\"true\" android:color=\"#EEEE00\" />\n    <item android:color=\"@android:color/white\" />\n</selector>"
  },
  {
    "path": "app/src/main/res/layout/activity_main.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:tools=\"http://schemas.android.com/tools\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    tools:context=\".MainActivity\">\n\n    <Button\n        android:id=\"@+id/button_album\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:text=\"Album\"\n        android:layout_below=\"@+id/button_camera\"\n        android:layout_centerHorizontal=\"true\"\n        android:layout_marginTop=\"56dp\" />\n\n    <Button\n        android:id=\"@+id/button_camera\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:text=\"Camera\"\n        android:layout_centerVertical=\"true\"\n        android:layout_centerHorizontal=\"true\" />\n\n</RelativeLayout>\n"
  },
  {
    "path": "app/src/main/res/values/colors.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n    <color name=\"filter_color_blue\">#ff5cbadc</color>\n    <color name=\"filter_color_blue_dark\">#3d5afe</color>\n    <color name=\"filter_color_blue_dark_dark\">#1e3250</color>\n    <color name=\"filter_color_red\">#ff6666</color>\n    <color name=\"filter_color_red_dark\">#b93221</color>\n    <color name=\"filter_color_orange\">#fe9833</color>\n    <color name=\"filter_color_pink\">#cc99cc</color>\n    <color name=\"filter_color_grey_light\">#c4c4c4</color>\n    <color name=\"filter_color_yellow_dark\">#c8ca34</color>\n    <color name=\"filter_color_green_dark\">#568f35</color>\n    <color name=\"filter_color_brown_dark\">#e69138</color>\n    <color name=\"filter_color_brown\">#c8ca34</color>\n    <color name=\"filter_color_brown_light\">#ff9933</color>\n    <color name=\"image_edit_modify_controller_bg\">#89000000</color>\n    <!--90% 白-->\n    <color name=\"white_percent_90\">#e6ffffff</color>\n    <color name=\"white\">#ffffff</color>\n    <color name=\"qian_lan\">#32c4c4</color>\n    <color name=\"greyish_brown\">#3c3c3c</color>\n    <color name=\"warm_grey\">#7d7d7d</color>\n</resources>\n"
  },
  {
    "path": "app/src/main/res/values/dimens.xml",
    "content": "<resources>\n\t<dimen name=\"seekbar_progress_height\">3.0dip</dimen> \n\t<dimen name=\"seekbar_thumb_offset\">6.0dip</dimen>\n\t<dimen name=\"seekbar_button_height\">60.0dip</dimen>\n    <dimen name=\"seekbar_gradient_seek_bar_line_width\">12.0px</dimen>\n    <dimen name=\"seekbar_layout_height\">220.0dip</dimen>\n    <dimen name=\"seekbar_line_width\">2.0px</dimen>\n    <dimen name=\"seekbar_margin_left\">34.0dip</dimen>\n    <dimen name=\"seekbar_margin_right\">34.0dip</dimen>\n    <dimen name=\"seekbar_nail_radius\">8.0px</dimen>\n    <dimen name=\"seekbar_nail_stroke_width\">2.0px</dimen>\n    <dimen name=\"seekbar_thumb_radius\">24.0px</dimen>\n</resources>\n"
  },
  {
    "path": "app/src/main/res/values/strings.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n\n    <string name=\"app_name\">MagicCameraDemo</string>\n    <string name=\"filter_none\">Original</string>\n    <string name=\"filter_amaro\">Amaro</string>\n\t<string name=\"filter_brannan\">Brannan</string>\n\t<string name=\"filter_brooklyn\">Brooklyn</string>\n\t<string name=\"filter_Earlybird\">EarlyBird</string>\n\t<string name=\"filter_freud\">Freud</string>\n\t<string name=\"filter_hefe\">Hefe</string>\n\t<string name=\"filter_hudson\">Hudson</string>\n\t<string name=\"filter_inkwell\">Inkwell</string>\n\t<string name=\"filter_kevin\">Kevin</string>\n\t<string name=\"filter_lomo\">Lomo</string>\n\t<string name=\"filter_n1977\">1977</string>\n\t<string name=\"filter_nashville\">Nashville</string>\n\t<string name=\"filter_pixar\">Pixar</string>\n\t<string name=\"filter_rise\">Rise</string>\n\t<string name=\"filter_sierra\">Sierra</string>\n\t<string name=\"filter_sutro\">Sutro</string>\n\t<string name=\"filter_toastero\">Toaster2</string>\n\t<string name=\"filter_valencia\">Valencia</string>\n\t<string name=\"filter_walden\">Walden</string>\n\t<string name=\"filter_xproii\">XproII</string>\n\t<string name=\"filter_whitecat\">WhiteCat</string>\n\t<string name=\"filter_blackcat\">BlackCat</string>\n\t<string name=\"filter_romance\">Romance</string>\n\t<string name=\"filter_sakura\">Sakura</string>\n\t<string name=\"filter_antique\">Antique</string>\n\t<string name=\"filter_beauty\">Beauty</string>\n\t<string name=\"filter_calm\">Calm</string>\n\t<string name=\"filter_cool\">Cool</string>\n\t<string name=\"filter_emerald\">Emerald</string>\n\t<string name=\"filter_evergreen\">Evergreen</string>\n\t<string name=\"filter_fairytale\">Fairytale</string>\n\t<string name=\"filter_healthy\">Healthy</string>\n\t<string name=\"filter_latte\">Latte</string>\n\t<string name=\"filter_nostalgia\">Nostalgia</string>\n\t<string name=\"filter_tender\">Tender</string>\n\t<string name=\"filter_warm\">Warm</string>\n\t<string name=\"filter_sweets\">Sweets</string>\n\t<string name=\"filter_sunrise\">Sunrise</string>\n\t<string name=\"filter_sunset\">Sunset</string>\n\t<string name=\"filter_skinwhiten\">SkinWhiten</string>\n\t<string name=\"filter_crayon\">Crayon</string>\n\t<string name=\"filter_sketch\">Sketch</string>\n\t\n\t<string name=\"edit_filter\">Filter</string>\n\t<string name=\"edit_edit\">Edit</string>\n\t<string name=\"edit_adds\">Adds</string>\n\t<string name=\"edit_frame\">Frame</string>\n\t<string name=\"edit_beauty\">Beauty</string>\n\t\n\t<string name=\"edit_contrast\">Contrast</string>\n\t<string name=\"edit_exposure\">Exposure</string>\n\t<string name=\"edit_vibrance\">Vibrance</string>\n\t<string name=\"edit_saturation\">Saturation</string>\n\t<string name=\"edit_sharpness\">Sharpness</string>\n\t<string name=\"edit_brightness\">Bright</string>\n\t<string name=\"edit_hue\">Hue</string>\n</resources>\n"
  },
  {
    "path": "app/src/main/res/values/styles.xml",
    "content": "<resources xmlns:android=\"http://schemas.android.com/apk/res/android\">\n\n    <!--\n        Base application theme, dependent on API level. This theme is replaced\n        by AppBaseTheme from res/values-vXX/styles.xml on newer devices.\n    -->\n    <style name=\"AppBaseTheme\" parent=\"android:Theme.Light\">\n        <!--\n            Theme customizations available in newer API levels can go in\n            res/values-vXX/styles.xml, while customizations related to\n            backward-compatibility can go here.\n        -->\n    </style>\n\n    <!-- Application theme. -->\n    <style name=\"AppTheme\" parent=\"AppBaseTheme\">\n        <item name=\"android:windowNoTitle\">true</item>\n        <item name=\"android:windowFullscreen\">true</item>\n        <item name=\"android:windowContentOverlay\">@null</item>\n    </style>\n    \n    <style name=\"SeekBar\">\n        <item name=\"android:paddingLeft\">15.0dip</item>\n        <item name=\"android:paddingRight\">15.0dip</item>\n        <item name=\"android:layout_width\">fill_parent</item>\n        <item name=\"android:layout_height\">wrap_content</item>\n        <item name=\"android:layout_marginTop\">5.0dip</item>\n        <item name=\"android:layout_marginBottom\">5.0dip</item>\n        <item name=\"android:maxHeight\">@dimen/seekbar_progress_height</item>\n        <item name=\"android:progressDrawable\">@drawable/seekbar_progress</item>\n        <item name=\"android:minHeight\">@dimen/seekbar_progress_height</item>\n        <item name=\"android:thumb\">@drawable/seekbar_thumb</item>\n        <item name=\"android:isScrollContainer\">true</item>\n        <item name=\"android:fadeScrollbars\">true</item>\n    </style>\n    <style name=\"SeekBar.Light\" parent=\"@style/SeekBar\">\n        <item name=\"android:layout_marginTop\">0.0dip</item>\n        <item name=\"android:layout_marginBottom\">0.0dip</item>\n        <item name=\"android:progressDrawable\">@drawable/seekbar_progress_light</item>\n        <item name=\"android:thumb\">@drawable/seekbar_thumb_light</item>\n    </style>\n    <style name=\"ImageEditor_radiobutton\">\n        <item name=\"android:layout_weight\">1.0</item>\n        <item name=\"android:layout_width\">0dip</item>\n        <item name=\"android:layout_height\">wrap_content</item>\n        <item name=\"android:button\">@null</item>\n        <item name=\"android:gravity\">center</item>\n        <item name=\"android:textColor\">@color/selector_image_edit</item>\n        <item name=\"android:textSize\">15sp</item>\n    </style>\n    <style name=\"ImageEditor_button_txt\">\n        <item name=\"android:gravity\">center</item>\n        <item name=\"android:textColor\">@color/selector_image_edit</item>\n        <item name=\"android:textSize\">14sp</item>\n    </style>\n    <style name=\"ImageEditor_adjust_radiobutton\">\n        <item name=\"android:layout_weight\">1.0</item>\n        <item name=\"android:layout_width\">0dip</item>\n        <item name=\"android:layout_height\">wrap_content</item>\n        <item name=\"android:button\">@null</item>\n        <item name=\"android:gravity\">center</item>\n        <item name=\"android:textColor\">@color/selector_image_edit_yellow</item>\n        <item name=\"android:paddingLeft\">10dp</item>\n        <item name=\"android:paddingRight\">10dp</item>\n        <item name=\"android:textSize\">14sp</item>\n    </style>\n\n    <style name=\"loading_dialog\" parent=\"android:style/Theme.Dialog\">\n        <item name=\"android:windowFrame\">@null</item>\n        <item name=\"android:windowNoTitle\">true</item>\n        <item name=\"android:backgroundDimEnabled\">true</item>\n        <item name=\"android:windowBackground\">@android:color/transparent</item>\n        <item name=\"android:windowIsFloating\">true</item>\n        <item name=\"android:windowContentOverlay\">@null</item>\n    </style>\n</resources>\n"
  },
  {
    "path": "app/src/main/res/values-v11/styles.xml",
    "content": "<resources>\n\n    <!--\n        Base application theme for API 11+. This theme completely replaces\n        AppBaseTheme from res/values/styles.xml on API 11+ devices.\n    -->\n    <style name=\"AppBaseTheme\" parent=\"android:Theme.Holo.Light\">\n       <item name=\"android:windowNoTitle\">true</item>\n        <item name=\"android:windowFullscreen\">true</item>\n        <item name=\"android:windowContentOverlay\">@null</item>\n    </style>\n\n</resources>\n"
  },
  {
    "path": "app/src/main/res/values-v14/styles.xml",
    "content": "<resources>\n\n    <!--\n        Base application theme for API 14+. This theme completely replaces\n        AppBaseTheme from BOTH res/values/styles.xml and\n        res/values-v11/styles.xml on API 14+ devices.\n    -->\n    <style name=\"AppBaseTheme\" parent=\"android:Theme.Holo.Light.DarkActionBar\">\n        <item name=\"android:windowNoTitle\">true</item>\n        <item name=\"android:windowFullscreen\">true</item>\n        <item name=\"android:windowContentOverlay\">@null</item>\n    </style>\n\n</resources>\n"
  },
  {
    "path": "app/src/main/res/values-v21/styles.xml",
    "content": "<resources>\n\n    <!--\n        Base application theme for API 14+. This theme completely replaces\n        AppBaseTheme from BOTH res/values/styles.xml and\n        res/values-v11/styles.xml on API 14+ devices.\n    -->\n    <style name=\"AppBaseTheme\" parent=\"android:Theme.Holo.Light.DarkActionBar\">\n        <item name=\"android:windowNoTitle\">true</item>\n        <item name=\"android:windowFullscreen\">true</item>\n        <item name=\"android:windowContentOverlay\">@null</item>\n\n    </style>\n\n</resources>\n"
  },
  {
    "path": "app/src/main/res/values-w820dp/dimens.xml",
    "content": "<resources>\n    <!-- Example customization of dimensions originally defined in res/values/dimens.xml\n         (such as screen margins) for screens with more than 820dp of available width. This\n         would include 7\" and 10\" devices in landscape (~960dp and ~1280dp respectively). -->\n    <dimen name=\"activity_horizontal_margin\">64dp</dimen>\n</resources>\n"
  },
  {
    "path": "app/src/main/res/values-zh-rCN/strings.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n    <string name=\"filter_none\">原图</string>\n\t<string name=\"filter_whitecat\">白猫</string>\n\t<string name=\"filter_blackcat\">黑猫</string>\n\t<string name=\"filter_romance\">浪漫</string>\n\t<string name=\"filter_sakura\">樱花</string>\n\t<string name=\"filter_antique\">复古</string>\n\t<string name=\"filter_beauty\">美肤</string>\n\t<string name=\"filter_calm\">平静</string>\n\t<string name=\"filter_cool\">冰冷</string>\n\t<string name=\"filter_emerald\">祖母绿</string>\n\t<string name=\"filter_evergreen\">常青</string>\n\t<string name=\"filter_fairytale\">童话</string>\n\t<string name=\"filter_healthy\">健康</string>\n\t<string name=\"filter_latte\">拿铁</string>\n\t<string name=\"filter_nostalgia\">怀旧</string>\n\t<string name=\"filter_tender\">温柔</string>\n\t<string name=\"filter_warm\">温暖</string>\n\t<string name=\"filter_sweets\">甜品</string>\n\t<string name=\"filter_sunrise\">日出</string>\n\t<string name=\"filter_sunset\">日落</string>\n\t<string name=\"filter_skinwhiten\">美白</string>\n\t<string name=\"filter_crayon\">蜡笔</string>\n\t<string name=\"filter_sketch\">素描</string>\n\t\n\t<string name=\"edit_filter\">滤镜</string>\n\t<string name=\"edit_edit\">编辑</string>\n\t<string name=\"edit_adds\">装饰</string>\n\t<string name=\"edit_frame\">边框</string>\n\t<string name=\"edit_beauty\">美颜</string>\n\t\n\t<string name=\"edit_contrast\">对比度</string>\n\t<string name=\"edit_exposure\">曝光</string>\n\t<string name=\"edit_vibrance\">自然饱和度</string>\n\t<string name=\"edit_saturation\">饱和度</string>\n\t<string name=\"edit_sharpness\">锐化</string>\n\t<string name=\"edit_brightness\">亮度</string>\n\t<string name=\"edit_hue\">色调</string>\n\t<string name=\"dialog_yes_or_no_yes\">确定</string>\n\t<string name=\"dialog_yes_or_no_no\">取消</string>\n</resources>\n"
  },
  {
    "path": "app/src/test/java/com/zero/magicshow/ExampleUnitTest.java",
    "content": "package com.zero.magicshow;\n\nimport org.junit.Test;\n\nimport static org.junit.Assert.*;\n\n/**\n * To work on unit tests, switch the Test Artifact in the Build Variants view.\n */\npublic class ExampleUnitTest {\n    @Test\n    public void addition_isCorrect() throws Exception {\n        assertEquals(4, 2 + 2);\n    }\n}"
  },
  {
    "path": "build.gradle",
    "content": "// Top-level build file where you can add configuration options common to all sub-projects/modules.\n\nbuildscript {\n    apply from: \"$project.rootDir/tools/versions_configuration.gradle\"\n    repositories {\n        jcenter()\n        google()\n    }\n    dependencies {\n//        classpath 'com.android.tools.build:gradle-experimental:0.9.3'\n        classpath \"com.android.tools.build:gradle:$libVersions.gradleTool\"\n        classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'\n\n        // NOTE: Do not place your application dependencies here; they belong\n        // in the individual module build.gradle files\n    }\n}\n\nallprojects {\n    repositories {\n        jcenter()\n        google()\n    }\n}\n\ntask clean(type: Delete) {\n    delete rootProject.buildDir\n}\n"
  },
  {
    "path": "gradle/wrapper/gradle-wrapper.properties",
    "content": "#Fri Jan 31 15:25:33 CST 2020\ndistributionBase=GRADLE_USER_HOME\ndistributionPath=wrapper/dists\nzipStoreBase=GRADLE_USER_HOME\nzipStorePath=wrapper/dists\ndistributionUrl=https\\://services.gradle.org/distributions/gradle-5.1.1-all.zip\n"
  },
  {
    "path": "gradle.properties",
    "content": "## Project-wide Gradle settings.\n#\n# For more details on how to configure your build environment visit\n# http://www.gradle.org/docs/current/userguide/build_environment.html\n#\n# Specifies the JVM arguments used for the daemon process.\n# The setting is particularly useful for tweaking memory settings.\n# Default value: -Xmx1024m -XX:MaxPermSize=256m\n# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8\n#\n# When configured, Gradle will run in incubating parallel mode.\n# This option should only be used with decoupled projects. More details, visit\n# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects\n# org.gradle.parallel=true\n#Thu Jun 21 10:43:50 CST 2018\nsystemProp.http.proxyHost=127.0.0.1\nsystemProp.http.proxyPort=1080\n"
  },
  {
    "path": "gradlew",
    "content": "#!/usr/bin/env bash\n\n##############################################################################\n##\n##  Gradle start up script for UN*X\n##\n##############################################################################\n\n# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.\nDEFAULT_JVM_OPTS=\"\"\n\nAPP_NAME=\"Gradle\"\nAPP_BASE_NAME=`basename \"$0\"`\n\n# Use the maximum available, or set MAX_FD != -1 to use that value.\nMAX_FD=\"maximum\"\n\nwarn ( ) {\n    echo \"$*\"\n}\n\ndie ( ) {\n    echo\n    echo \"$*\"\n    echo\n    exit 1\n}\n\n# OS specific support (must be 'true' or 'false').\ncygwin=false\nmsys=false\ndarwin=false\ncase \"`uname`\" in\n  CYGWIN* )\n    cygwin=true\n    ;;\n  Darwin* )\n    darwin=true\n    ;;\n  MINGW* )\n    msys=true\n    ;;\nesac\n\n# Attempt to set APP_HOME\n# Resolve links: $0 may be a link\nPRG=\"$0\"\n# Need this for relative symlinks.\nwhile [ -h \"$PRG\" ] ; do\n    ls=`ls -ld \"$PRG\"`\n    link=`expr \"$ls\" : '.*-> \\(.*\\)$'`\n    if expr \"$link\" : '/.*' > /dev/null; then\n        PRG=\"$link\"\n    else\n        PRG=`dirname \"$PRG\"`\"/$link\"\n    fi\ndone\nSAVED=\"`pwd`\"\ncd \"`dirname \\\"$PRG\\\"`/\" >/dev/null\nAPP_HOME=\"`pwd -P`\"\ncd \"$SAVED\" >/dev/null\n\nCLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar\n\n# Determine the Java command to use to start the JVM.\nif [ -n \"$JAVA_HOME\" ] ; then\n    if [ -x \"$JAVA_HOME/jre/sh/java\" ] ; then\n        # IBM's JDK on AIX uses strange locations for the executables\n        JAVACMD=\"$JAVA_HOME/jre/sh/java\"\n    else\n        JAVACMD=\"$JAVA_HOME/bin/java\"\n    fi\n    if [ ! -x \"$JAVACMD\" ] ; then\n        die \"ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME\n\nPlease set the JAVA_HOME variable in your environment to match the\nlocation of your Java installation.\"\n    fi\nelse\n    JAVACMD=\"java\"\n    which java >/dev/null 2>&1 || die \"ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.\n\nPlease set the JAVA_HOME variable in your environment to match the\nlocation of your Java installation.\"\nfi\n\n# Increase the maximum file descriptors if we can.\nif [ \"$cygwin\" = \"false\" -a \"$darwin\" = \"false\" ] ; then\n    MAX_FD_LIMIT=`ulimit -H -n`\n    if [ $? -eq 0 ] ; then\n        if [ \"$MAX_FD\" = \"maximum\" -o \"$MAX_FD\" = \"max\" ] ; then\n            MAX_FD=\"$MAX_FD_LIMIT\"\n        fi\n        ulimit -n $MAX_FD\n        if [ $? -ne 0 ] ; then\n            warn \"Could not set maximum file descriptor limit: $MAX_FD\"\n        fi\n    else\n        warn \"Could not query maximum file descriptor limit: $MAX_FD_LIMIT\"\n    fi\nfi\n\n# For Darwin, add options to specify how the application appears in the dock\nif $darwin; then\n    GRADLE_OPTS=\"$GRADLE_OPTS \\\"-Xdock:name=$APP_NAME\\\" \\\"-Xdock:icon=$APP_HOME/media/gradle.icns\\\"\"\nfi\n\n# For Cygwin, switch paths to Windows format before running java\nif $cygwin ; then\n    APP_HOME=`cygpath --path --mixed \"$APP_HOME\"`\n    CLASSPATH=`cygpath --path --mixed \"$CLASSPATH\"`\n    JAVACMD=`cygpath --unix \"$JAVACMD\"`\n\n    # We build the pattern for arguments to be converted via cygpath\n    ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`\n    SEP=\"\"\n    for dir in $ROOTDIRSRAW ; do\n        ROOTDIRS=\"$ROOTDIRS$SEP$dir\"\n        SEP=\"|\"\n    done\n    OURCYGPATTERN=\"(^($ROOTDIRS))\"\n    # Add a user-defined pattern to the cygpath arguments\n    if [ \"$GRADLE_CYGPATTERN\" != \"\" ] ; then\n        OURCYGPATTERN=\"$OURCYGPATTERN|($GRADLE_CYGPATTERN)\"\n    fi\n    # Now convert the arguments - kludge to limit ourselves to /bin/sh\n    i=0\n    for arg in \"$@\" ; do\n        CHECK=`echo \"$arg\"|egrep -c \"$OURCYGPATTERN\" -`\n        CHECK2=`echo \"$arg\"|egrep -c \"^-\"`                                 ### Determine if an option\n\n        if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### Added a condition\n            eval `echo args$i`=`cygpath --path --ignore --mixed \"$arg\"`\n        else\n            eval `echo args$i`=\"\\\"$arg\\\"\"\n        fi\n        i=$((i+1))\n    done\n    case $i in\n        (0) set -- ;;\n        (1) set -- \"$args0\" ;;\n        (2) set -- \"$args0\" \"$args1\" ;;\n        (3) set -- \"$args0\" \"$args1\" \"$args2\" ;;\n        (4) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" ;;\n        (5) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" ;;\n        (6) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" ;;\n        (7) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" ;;\n        (8) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" \"$args7\" ;;\n        (9) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" \"$args7\" \"$args8\" ;;\n    esac\nfi\n\n# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules\nfunction splitJvmOpts() {\n    JVM_OPTS=(\"$@\")\n}\neval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS\nJVM_OPTS[${#JVM_OPTS[*]}]=\"-Dorg.gradle.appname=$APP_BASE_NAME\"\n\nexec \"$JAVACMD\" \"${JVM_OPTS[@]}\" -classpath \"$CLASSPATH\" org.gradle.wrapper.GradleWrapperMain \"$@\"\n"
  },
  {
    "path": "gradlew.bat",
    "content": "@if \"%DEBUG%\" == \"\" @echo off\n@rem ##########################################################################\n@rem\n@rem  Gradle startup script for Windows\n@rem\n@rem ##########################################################################\n\n@rem Set local scope for the variables with windows NT shell\nif \"%OS%\"==\"Windows_NT\" setlocal\n\n@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.\nset DEFAULT_JVM_OPTS=\n\nset DIRNAME=%~dp0\nif \"%DIRNAME%\" == \"\" set DIRNAME=.\nset APP_BASE_NAME=%~n0\nset APP_HOME=%DIRNAME%\n\n@rem Find java.exe\nif defined JAVA_HOME goto findJavaFromJavaHome\n\nset JAVA_EXE=java.exe\n%JAVA_EXE% -version >NUL 2>&1\nif \"%ERRORLEVEL%\" == \"0\" goto init\n\necho.\necho ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.\necho.\necho Please set the JAVA_HOME variable in your environment to match the\necho location of your Java installation.\n\ngoto fail\n\n:findJavaFromJavaHome\nset JAVA_HOME=%JAVA_HOME:\"=%\nset JAVA_EXE=%JAVA_HOME%/bin/java.exe\n\nif exist \"%JAVA_EXE%\" goto init\n\necho.\necho ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%\necho.\necho Please set the JAVA_HOME variable in your environment to match the\necho location of your Java installation.\n\ngoto fail\n\n:init\n@rem Get command-line arguments, handling Windowz variants\n\nif not \"%OS%\" == \"Windows_NT\" goto win9xME_args\nif \"%@eval[2+2]\" == \"4\" goto 4NT_args\n\n:win9xME_args\n@rem Slurp the command line arguments.\nset CMD_LINE_ARGS=\nset _SKIP=2\n\n:win9xME_args_slurp\nif \"x%~1\" == \"x\" goto execute\n\nset CMD_LINE_ARGS=%*\ngoto execute\n\n:4NT_args\n@rem Get arguments from the 4NT Shell from JP Software\nset CMD_LINE_ARGS=%$\n\n:execute\n@rem Setup the command line\n\nset CLASSPATH=%APP_HOME%\\gradle\\wrapper\\gradle-wrapper.jar\n\n@rem Execute Gradle\n\"%JAVA_EXE%\" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% \"-Dorg.gradle.appname=%APP_BASE_NAME%\" -classpath \"%CLASSPATH%\" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%\n\n:end\n@rem End local scope for the variables with windows NT shell\nif \"%ERRORLEVEL%\"==\"0\" goto mainEnd\n\n:fail\nrem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of\nrem the _cmd.exe /c_ return code!\nif  not \"\" == \"%GRADLE_EXIT_CONSOLE%\" exit 1\nexit /b 1\n\n:mainEnd\nif \"%OS%\"==\"Windows_NT\" endlocal\n\n:omega\n"
  },
  {
    "path": "settings.gradle",
    "content": "include ':app', ':MagicShow'\n"
  },
  {
    "path": "tools/versions_configuration.gradle",
    "content": "ext {\n    javaSourceCompatibility = JavaVersion.VERSION_1_8\n    appVersions = '1.1.5'\n    appCode = 55\n    compileSdkVersion = 28\n    buildToolsVersion = \"28.0.0\"\n    minSdkVersion = 18\n    targetSdkVersion = 28\n\n    sdk = [\n            support         : '27.1.1',\n            multidex        : '1.0.3',\n            constraintLayout: '1.1.2',\n    ]\n\n    appcompatV7 = \"com.android.support:appcompat-v7:$sdk.support\"\n    design = \"com.android.support:design:$sdk.support\"\n    recyclerviewV7 = \"com.android.support:recyclerview-v7:$sdk.support\"\n    cardviewV7 = \"com.android.support:cardview-v7:$sdk.support\"\n    constraintLayout = \"com.android.support.constraint:constraint-layout:$sdk.constraintLayout\"\n    multidex = \"com.android.support:multidex:$sdk.multidex\"\n    annotations = \"com.android.support:support-annotations:$sdk.support\"\n    cardViewV7 = \"com.android.support:cardview-v7:$sdk.support\"\n\n    libVersions = [\n            gradleTool  : '3.4.0',\n\n            MobSDK  : '2018.0319.1724',\n\n            bugly       : [\n                    crashreportUpgrade: '1.3.5',\n                    nativecrashreport : '3.3.1',\n                    tinkerSupport     : '1.1.2',\n                    tinkerAndroidLib  : '1.9.6'\n            ],\n\n            aliSecturity: [\n                    NoCaptchaSDK    : '5.4.18',\n                    SecurityBodySDK : '5.4.28',\n                    SecurityGuardSDK: '5.4.38',\n                    windvane        : '8.0.3.2.3',\n                    rpsdk           : '2.4.0.2',\n                    FaceLivenessOpen: '2.1.6.6',\n                    AVMPSDK         : '5.4.1001'\n            ],\n\n            glide       : [\n                    base           : '3.8.0',\n                    transformations: '2.0.1'\n            ],\n\n            retrofit2   : [\n                    retrofit: '2.4.0'\n            ],\n\n            okhttp3     : [\n                    loggingInterceptor: '3.11.0',\n                    okhttp            : '3.11.0',\n                    okio              : '1.15.0'\n            ],\n\n            rx          : [\n                    rxandroid   : '2.1.0',//2.0.1\n                    rxjava      : '2.2.0',//2.1.3\n                    rxlifecycle : '2.2.2',\n                    rxpermission: '0.9.4'\n            ],\n\n            gson        : '2.8.0',\n            zxing       : '1.9.4',\n            PBKDF2      : '1.1.2',\n\n            umeng       : [\n                    common   : '1.5.0',\n                    analytics: '7.5.3'\n            ],\n\n            Luban       : '1.1.3',\n            oss         : '2.4.3',\n            leakcanary  : '1.6.1',\n            download    : '1.0.5',\n            lottie      : '2.5.5',\n            ZXing       : '3.3.0',\n            Soter       : '1.3.13',\n            permission  : '2.0.0',\n            zero        : [\n                    ClassicDownload: '1.0.8'\n            ],\n            JPush       : [\n                    core: '1.2.6',\n                    push: '3.1.7'\n            ],\n            FastJson    : '1.1.56.android',\n            sensorsdata : [\n                    plugin2: '3.0.2',\n                    SensorsAnalyticsSDK: '3.0.3'\n            ],\n            yunxin      : [\n                    basesdk: '6.4.0',\n                    avchat: '6.4.0'\n            ],\n            share       : [\n                    wechatsdk: '5.1.6',\n                    weibo: '4.3.7'\n            ],\n            webviewCache: '2.1.8'\n    ]\n}"
  }
]