├── .gitignore ├── Gpu-Image ├── .gitignore ├── AndroidManifest.xml ├── build.gradle ├── gradle.properties ├── libs │ ├── arm64-v8a │ │ └── libgpuimage-library.so │ ├── armeabi-v7a │ │ └── libgpuimage-library.so │ ├── armeabi │ │ └── libgpuimage-library.so │ ├── mips │ │ └── libgpuimage-library.so │ ├── mips64 │ │ └── libgpuimage-library.so │ ├── x86 │ │ └── libgpuimage-library.so │ └── x86_64 │ │ └── libgpuimage-library.so ├── proguard-project.txt ├── project.properties └── src │ └── jp │ └── co │ └── cyberagent │ └── android │ └── gpuimage │ ├── GPUImage.java │ ├── GPUImage3x3ConvolutionFilter.java │ ├── GPUImage3x3TextureSamplingFilter.java │ ├── GPUImageAddBlendFilter.java │ ├── GPUImageAlphaBlendFilter.java │ ├── GPUImageBoxBlurFilter.java │ ├── GPUImageBrightnessFilter.java │ ├── GPUImageBulgeDistortionFilter.java │ ├── GPUImageCGAColorspaceFilter.java │ ├── GPUImageChromaKeyBlendFilter.java │ ├── GPUImageColorBalanceFilter.java │ ├── GPUImageColorBlendFilter.java │ ├── GPUImageColorBurnBlendFilter.java │ ├── GPUImageColorDodgeBlendFilter.java │ ├── GPUImageColorInvertFilter.java │ ├── GPUImageColorMatrixFilter.java │ ├── GPUImageContrastFilter.java │ ├── GPUImageCrosshatchFilter.java │ ├── GPUImageDarkenBlendFilter.java │ ├── GPUImageDifferenceBlendFilter.java │ ├── GPUImageDilationFilter.java │ ├── GPUImageDirectionalSobelEdgeDetectionFilter.java │ ├── GPUImageDissolveBlendFilter.java │ ├── GPUImageDivideBlendFilter.java │ ├── GPUImageEmbossFilter.java │ ├── GPUImageExclusionBlendFilter.java │ ├── GPUImageExposureFilter.java │ ├── GPUImageFalseColorFilter.java │ ├── GPUImageFilter.java │ ├── GPUImageFilterGroup.java │ ├── GPUImageGammaFilter.java │ ├── GPUImageGaussianBlurFilter.java │ ├── GPUImageGlassSphereFilter.java │ ├── GPUImageGrayscaleFilter.java │ ├── GPUImageHardLightBlendFilter.java │ ├── GPUImageHazeFilter.java │ ├── GPUImageHighlightShadowFilter.java │ ├── GPUImageHueBlendFilter.java │ ├── GPUImageHueFilter.java │ ├── GPUImageKuwaharaFilter.java │ ├── GPUImageLaplacianFilter.java │ ├── GPUImageLevelsFilter.java │ ├── GPUImageLightenBlendFilter.java │ ├── GPUImageLinearBurnBlendFilter.java │ ├── GPUImageLookupFilter.java │ ├── GPUImageLuminosityBlendFilter.java │ ├── GPUImageMixBlendFilter.java │ ├── GPUImageMonochromeFilter.java │ ├── GPUImageMultiplyBlendFilter.java │ ├── GPUImageNativeLibrary.java │ ├── GPUImageNonMaximumSuppressionFilter.java │ ├── GPUImageNormalBlendFilter.java │ ├── GPUImageOpacityFilter.java │ ├── GPUImageOverlayBlendFilter.java │ ├── GPUImagePixelationFilter.java │ ├── GPUImagePosterizeFilter.java │ ├── GPUImageRGBDilationFilter.java │ ├── GPUImageRGBFilter.java │ ├── GPUImageRenderer.java │ ├── GPUImageSaturationBlendFilter.java │ ├── GPUImageSaturationFilter.java │ ├── GPUImageScreenBlendFilter.java │ ├── GPUImageSepiaFilter.java │ ├── GPUImageSharpenFilter.java │ ├── GPUImageSketchFilter.java │ ├── GPUImageSmoothToonFilter.java │ ├── GPUImageSobelEdgeDetection.java │ ├── GPUImageSobelThresholdFilter.java │ ├── GPUImageSoftLightBlendFilter.java │ ├── GPUImageSourceOverBlendFilter.java │ ├── GPUImageSphereRefractionFilter.java │ ├── GPUImageSubtractBlendFilter.java │ ├── GPUImageSwirlFilter.java │ ├── GPUImageThresholdEdgeDetection.java │ ├── GPUImageToneCurveFilter.java │ ├── GPUImageToonFilter.java │ ├── GPUImageTwoInputFilter.java │ ├── GPUImageTwoPassFilter.java │ ├── GPUImageTwoPassTextureSamplingFilter.java │ ├── GPUImageView.java │ ├── GPUImageVignetteFilter.java │ ├── GPUImageWeakPixelInclusionFilter.java │ ├── GPUImageWhiteBalanceFilter.java │ ├── OpenGlUtils.java │ ├── PixelBuffer.java │ ├── Rotation.java │ └── util │ └── TextureRotationUtil.java ├── ImageViewTouch ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── imagezoom │ │ └── ApplicationTest.java │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── imagezoom │ │ ├── ImageViewTouch.java │ │ ├── ImageViewTouchBase.java │ │ ├── easing │ │ ├── Back.java │ │ ├── Bounce.java │ │ ├── Circ.java │ │ ├── Cubic.java │ │ ├── Easing.java │ │ ├── Elastic.java │ │ ├── Expo.java │ │ ├── Linear.java │ │ ├── Quad.java │ │ ├── Quart.java │ │ ├── Quint.java │ │ └── Sine.java │ │ ├── graphics │ │ ├── FastBitmapDrawable.java │ │ └── IBitmapDrawable.java │ │ └── utils │ │ └── IDisposable.java │ └── res │ └── values │ └── strings.xml ├── README.md ├── app ├── .gitignore ├── build.gradle ├── libs │ ├── fastjson-1.2.5.jar │ └── universal-image-loader-1.9.4.jar ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── github │ │ └── skykai │ │ └── stickercamera │ │ └── ApplicationTest.java │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ ├── common │ │ └── util │ │ │ ├── AppUtils.java │ │ │ ├── ArrayUtils.java │ │ │ ├── CollectionUtils.java │ │ │ ├── DataUtils.java │ │ │ ├── DistanceUtil.java │ │ │ ├── FileUtils.java │ │ │ ├── IOUtil.java │ │ │ ├── ImageLoaderUtils.java │ │ │ ├── ImageUtils.java │ │ │ ├── ListUtils.java │ │ │ ├── MD5Util.java │ │ │ ├── MapUtils.java │ │ │ ├── NetWorkUtils.java │ │ │ ├── ObjectUtils.java │ │ │ ├── PackageUtils.java │ │ │ ├── PreferencesUtils.java │ │ │ ├── RandomUtils.java │ │ │ ├── ResourceUtils.java │ │ │ ├── ShellUtils.java │ │ │ ├── StringUtils.java │ │ │ ├── SystemUtils.java │ │ │ └── TimeUtils.java │ │ ├── customview │ │ ├── CameraGrid.java │ │ ├── CommonTitleBar.java │ │ ├── FlowLayout.java │ │ ├── GlobalLimitClickOnClickListener.java │ │ ├── LabelSelector.java │ │ ├── LabelView.java │ │ ├── MyHighlightView.java │ │ ├── MyImageViewDrawableOverlay.java │ │ ├── PagerSlidingTabStrip.java │ │ └── drawable │ │ │ ├── EditableDrawable.java │ │ │ ├── FeatherDrawable.java │ │ │ └── StickerDrawable.java │ │ └── stickercamera │ │ ├── App.java │ │ ├── AppConstants.java │ │ ├── app │ │ ├── camera │ │ │ ├── CameraBaseActivity.java │ │ │ ├── CameraBaseFragmentActivity.java │ │ │ ├── CameraManager.java │ │ │ ├── EffectService.java │ │ │ ├── adapter │ │ │ │ ├── FilterAdapter.java │ │ │ │ ├── GalleryAdapter.java │ │ │ │ └── StickerToolAdapter.java │ │ │ ├── effect │ │ │ │ └── FilterEffect.java │ │ │ ├── fragment │ │ │ │ └── AlbumFragment.java │ │ │ ├── ui │ │ │ │ ├── AlbumActivity.java │ │ │ │ ├── CameraActivity.java │ │ │ │ ├── CropPhotoActivity.java │ │ │ │ └── PhotoProcessActivity.java │ │ │ └── util │ │ │ │ ├── CameraHelper.java │ │ │ │ ├── CameraHelperBase.java │ │ │ │ ├── CameraHelperGB.java │ │ │ │ ├── EffectUtil.java │ │ │ │ ├── GPUImageFilterTools.java │ │ │ │ ├── MatrixUtils.java │ │ │ │ ├── Point2D.java │ │ │ │ └── UIUtils.java │ │ ├── model │ │ │ ├── Addon.java │ │ │ ├── Album.java │ │ │ ├── FeedItem.java │ │ │ ├── PhotoItem.java │ │ │ └── TagItem.java │ │ └── ui │ │ │ ├── EditTextActivity.java │ │ │ └── MainActivity.java │ │ └── base │ │ ├── ActivityHelper.java │ │ ├── ActivityResponsable.java │ │ ├── BaseActivity.java │ │ ├── BaseFragmentActivity.java │ │ └── util │ │ ├── DialogHelper.java │ │ └── GenericProgressDialog.java │ └── res │ ├── drawable-hdpi │ ├── aviary_delete_knob.png │ ├── aviary_resize_knob.png │ ├── back.png │ ├── camera_back.png │ ├── camera_flash_auto.png │ ├── camera_flash_off.png │ ├── camera_flash_on.png │ ├── camera_flip.png │ ├── camera_library.png │ ├── default_img.png │ ├── dot.png │ ├── ic_camera_white.png │ ├── ic_launcher.png │ ├── icon_biaoqian.9.png │ ├── icon_biaoqian_i.9.png │ ├── lookup_amatorka.png │ ├── next.png │ ├── point_poi.png │ ├── position.png │ ├── select_icon.png │ ├── simple_toast_bg.9.png │ ├── sticker1.png │ ├── sticker2.png │ ├── sticker3.png │ ├── sticker4.png │ ├── sticker5.png │ ├── sticker6.png │ ├── sticker7.png │ ├── sticker8.png │ ├── tip.png │ ├── vertical_shaped_button.png │ └── vertical_shaped_button_click.png │ ├── drawable-mdpi │ ├── aviary_delete_knob.png │ ├── aviary_resize_knob.png │ └── ic_launcher.png │ ├── drawable-xhdpi │ ├── aviary_delete_knob.png │ ├── aviary_resize_knob.png │ └── ic_launcher.png │ ├── drawable-xxhdpi │ └── ic_launcher.png │ ├── drawable │ ├── background_tab.xml │ ├── black_white_selector.xml │ ├── bottom_tool.xml │ ├── btn_crop_selector.xml │ ├── btn_take_photo.xml │ ├── cam_focus.xml │ ├── corners_bg_white_2r_borderd.xml │ └── toolbar_shadow.xml │ ├── layout │ ├── activity_album.xml │ ├── activity_camera.xml │ ├── activity_edit_text.xml │ ├── activity_image_process.xml │ ├── activity_main.xml │ ├── activity_new_crop.xml │ ├── fragment_album.xml │ ├── item_bottom_filter.xml │ ├── item_bottom_tool.xml │ ├── item_gallery.xml │ ├── item_picture.xml │ ├── toolbar_shadow_layout.xml │ ├── view_drawable_overlay.xml │ ├── view_label.xml │ ├── view_label_bottom.xml │ ├── view_label_layout.xml │ ├── view_progress_dialog.xml │ ├── view_title_bar.xml │ └── view_transient_notification.xml │ ├── menu │ └── menu_main.xml │ ├── raw │ ├── aimei.acv │ ├── danhuang.acv │ ├── danlan.acv │ ├── fugu.acv │ ├── gaoleng.acv │ ├── huaijiu.acv │ ├── jiaopian.acv │ ├── keai.acv │ ├── lomo.acv │ ├── morenjiaqiang.acv │ ├── nuanxin.acv │ ├── qingxin.acv │ ├── rixi.acv │ ├── tone_cuver_sample.acv │ └── wennuan.acv │ ├── values-w820dp │ └── dimens.xml │ └── values │ ├── attrs.xml │ ├── colors.xml │ ├── dimens.xml │ ├── strings.xml │ └── styles.xml ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── screenshot ├── Screenshot_01.gif ├── Screenshot_2015-07-19-11-21-39.png ├── Screenshot_2015-07-19-11-22-05.png ├── Screenshot_2015-07-19-11-23-00.png ├── Screenshot_2015-07-19-11-23-04.png ├── Screenshot_2015-07-19-11-23-22.png └── StickerCamera.zip └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | # Built application files 2 | *.apk 3 | *.ap_ 4 | 5 | # Files for the Dalvik VM 6 | *.dex 7 | 8 | # Java class files 9 | *.class 10 | 11 | # Generated files 12 | bin/ 13 | gen/ 14 | 15 | # Gradle files 16 | .gradle/ 17 | build/ 18 | /*/build/ 19 | 20 | # Local configuration file (sdk path, etc) 21 | local.properties 22 | 23 | # Proguard folder generated by Eclipse 24 | proguard/ 25 | 26 | # Log Files 27 | *.log 28 | 29 | bin 30 | gen 31 | .project 32 | .classpath 33 | .settings 34 | .idea 35 | *.iml 36 | *.ipr 37 | *.iws 38 | out 39 | target 40 | release.properties 41 | pom.xml.* 42 | build.xml 43 | local.properties 44 | proguard.cfg 45 | .DS_Store 46 | .gradle 47 | build 48 | app/*/build 49 | -------------------------------------------------------------------------------- /Gpu-Image/.gitignore: -------------------------------------------------------------------------------- 1 | #Android generated 2 | bin 3 | gen 4 | obj 5 | 6 | #Eclipse 7 | #.project 8 | #.classpath 9 | .settings 10 | 11 | #IntelliJ IDEA 12 | .idea 13 | *.iml 14 | *.ipr 15 | *.iws 16 | out 17 | 18 | #Checkstyle 19 | .checkstyle 20 | 21 | #Maven 22 | target 23 | release.properties 24 | pom.xml.* 25 | 26 | #Ant 27 | build.xml 28 | local.properties 29 | proguard.cfg 30 | 31 | #OSX 32 | .DS_Store 33 | -------------------------------------------------------------------------------- /Gpu-Image/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | -------------------------------------------------------------------------------- /Gpu-Image/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | compileSdkVersion 22 5 | buildToolsVersion "22.0.1" 6 | 7 | defaultConfig { 8 | minSdkVersion 15 9 | targetSdkVersion 22 10 | 11 | versionCode = 1 12 | versionName = "1.0" 13 | 14 | } 15 | 16 | sourceSets { 17 | main { 18 | manifest.srcFile 'AndroidManifest.xml' 19 | java.srcDirs = ['src'] 20 | resources.srcDirs = ['src'] 21 | aidl.srcDirs = ['src'] 22 | renderscript.srcDirs = ['src'] 23 | res.srcDirs = ['res'] 24 | assets.srcDirs = ['assets'] 25 | jni.srcDirs = ['jni'] 26 | } 27 | 28 | instrumentTest.setRoot('tests') 29 | } 30 | 31 | lintOptions { 32 | abortOnError false 33 | } 34 | 35 | } -------------------------------------------------------------------------------- /Gpu-Image/gradle.properties: -------------------------------------------------------------------------------- 1 | POM_NAME=GPUImage for Android Library 2 | POM_ARTIFACT_ID=gpuimage-library 3 | POM_PACKAGING=aar -------------------------------------------------------------------------------- /Gpu-Image/libs/arm64-v8a/libgpuimage-library.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skykai521/StickerCamera/d0a9c4d3f0ea1acfe339128624ddcb28c4bf85df/Gpu-Image/libs/arm64-v8a/libgpuimage-library.so -------------------------------------------------------------------------------- /Gpu-Image/libs/armeabi-v7a/libgpuimage-library.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skykai521/StickerCamera/d0a9c4d3f0ea1acfe339128624ddcb28c4bf85df/Gpu-Image/libs/armeabi-v7a/libgpuimage-library.so -------------------------------------------------------------------------------- /Gpu-Image/libs/armeabi/libgpuimage-library.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skykai521/StickerCamera/d0a9c4d3f0ea1acfe339128624ddcb28c4bf85df/Gpu-Image/libs/armeabi/libgpuimage-library.so -------------------------------------------------------------------------------- /Gpu-Image/libs/mips/libgpuimage-library.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skykai521/StickerCamera/d0a9c4d3f0ea1acfe339128624ddcb28c4bf85df/Gpu-Image/libs/mips/libgpuimage-library.so -------------------------------------------------------------------------------- /Gpu-Image/libs/mips64/libgpuimage-library.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skykai521/StickerCamera/d0a9c4d3f0ea1acfe339128624ddcb28c4bf85df/Gpu-Image/libs/mips64/libgpuimage-library.so -------------------------------------------------------------------------------- /Gpu-Image/libs/x86/libgpuimage-library.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skykai521/StickerCamera/d0a9c4d3f0ea1acfe339128624ddcb28c4bf85df/Gpu-Image/libs/x86/libgpuimage-library.so -------------------------------------------------------------------------------- /Gpu-Image/libs/x86_64/libgpuimage-library.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skykai521/StickerCamera/d0a9c4d3f0ea1acfe339128624ddcb28c4bf85df/Gpu-Image/libs/x86_64/libgpuimage-library.so -------------------------------------------------------------------------------- /Gpu-Image/proguard-project.txt: -------------------------------------------------------------------------------- 1 | # To enable ProGuard in your project, edit project.properties 2 | # to define the proguard.config property as described in that file. 3 | # 4 | # Add project specific ProGuard rules here. 5 | # By default, the flags in this file are appended to flags specified 6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt 7 | # You can edit the include path and order by changing the ProGuard 8 | # include property in project.properties. 9 | # 10 | # For more details, see 11 | # http://developer.android.com/guide/developing/tools/proguard.html 12 | 13 | # Add any project specific keep options here: 14 | 15 | # If your project uses WebView with JS, uncomment the following 16 | # and specify the fully qualified class name to the JavaScript interface 17 | # class: 18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 19 | # public *; 20 | #} 21 | -------------------------------------------------------------------------------- /Gpu-Image/project.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system edit 7 | # "ant.properties", and override values to adapt the script to your 8 | # project structure. 9 | # 10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): 11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt 12 | 13 | # Project target. 14 | target=android-21 15 | android.library=true 16 | -------------------------------------------------------------------------------- /Gpu-Image/src/jp/co/cyberagent/android/gpuimage/GPUImageAddBlendFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 CyberAgent 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package jp.co.cyberagent.android.gpuimage; 18 | 19 | public class GPUImageAddBlendFilter extends GPUImageTwoInputFilter { 20 | public static final String ADD_BLEND_FRAGMENT_SHADER = "varying highp vec2 textureCoordinate;\n" + 21 | " varying highp vec2 textureCoordinate2;\n" + 22 | "\n" + 23 | " uniform sampler2D inputImageTexture;\n" + 24 | " uniform sampler2D inputImageTexture2;\n" + 25 | " \n" + 26 | " void main()\n" + 27 | " {\n" + 28 | " lowp vec4 base = texture2D(inputImageTexture, textureCoordinate);\n" + 29 | " lowp vec4 overlay = texture2D(inputImageTexture2, textureCoordinate2);\n" + 30 | "\n" + 31 | " mediump float r;\n" + 32 | " if (overlay.r * base.a + base.r * overlay.a >= overlay.a * base.a) {\n" + 33 | " r = overlay.a * base.a + overlay.r * (1.0 - base.a) + base.r * (1.0 - overlay.a);\n" + 34 | " } else {\n" + 35 | " r = overlay.r + base.r;\n" + 36 | " }\n" + 37 | "\n" + 38 | " mediump float g;\n" + 39 | " if (overlay.g * base.a + base.g * overlay.a >= overlay.a * base.a) {\n" + 40 | " g = overlay.a * base.a + overlay.g * (1.0 - base.a) + base.g * (1.0 - overlay.a);\n" + 41 | " } else {\n" + 42 | " g = overlay.g + base.g;\n" + 43 | " }\n" + 44 | "\n" + 45 | " mediump float b;\n" + 46 | " if (overlay.b * base.a + base.b * overlay.a >= overlay.a * base.a) {\n" + 47 | " b = overlay.a * base.a + overlay.b * (1.0 - base.a) + base.b * (1.0 - overlay.a);\n" + 48 | " } else {\n" + 49 | " b = overlay.b + base.b;\n" + 50 | " }\n" + 51 | "\n" + 52 | " mediump float a = overlay.a + base.a - overlay.a * base.a;\n" + 53 | " \n" + 54 | " gl_FragColor = vec4(r, g, b, a);\n" + 55 | " }"; 56 | 57 | public GPUImageAddBlendFilter() { 58 | super(ADD_BLEND_FRAGMENT_SHADER); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /Gpu-Image/src/jp/co/cyberagent/android/gpuimage/GPUImageAlphaBlendFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 CyberAgent 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package jp.co.cyberagent.android.gpuimage; 18 | 19 | /** 20 | * Mix ranges from 0.0 (only image 1) to 1.0 (only image 2), with 0.5 (half of either) as the normal level 21 | */ 22 | public class GPUImageAlphaBlendFilter extends GPUImageMixBlendFilter{ 23 | public static final String ALPHA_BLEND_FRAGMENT_SHADER = "varying highp vec2 textureCoordinate;\n" + 24 | " varying highp vec2 textureCoordinate2;\n" + 25 | "\n" + 26 | " uniform sampler2D inputImageTexture;\n" + 27 | " uniform sampler2D inputImageTexture2;\n" + 28 | " \n" + 29 | " uniform lowp float mixturePercent;\n" + 30 | "\n" + 31 | " void main()\n" + 32 | " {\n" + 33 | " lowp vec4 textureColor = texture2D(inputImageTexture, textureCoordinate);\n" + 34 | " lowp vec4 textureColor2 = texture2D(inputImageTexture2, textureCoordinate2);\n" + 35 | "\n" + 36 | " gl_FragColor = vec4(mix(textureColor.rgb, textureColor2.rgb, textureColor2.a * mixturePercent), textureColor.a);\n" + 37 | " }"; 38 | 39 | public GPUImageAlphaBlendFilter() { 40 | super(ALPHA_BLEND_FRAGMENT_SHADER); 41 | } 42 | 43 | public GPUImageAlphaBlendFilter(float mix) { 44 | super(ALPHA_BLEND_FRAGMENT_SHADER, mix); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Gpu-Image/src/jp/co/cyberagent/android/gpuimage/GPUImageBrightnessFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 CyberAgent 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package jp.co.cyberagent.android.gpuimage; 18 | 19 | import android.opengl.GLES20; 20 | 21 | /** 22 | * brightness value ranges from -1.0 to 1.0, with 0.0 as the normal level 23 | */ 24 | public class GPUImageBrightnessFilter extends GPUImageFilter { 25 | public static final String BRIGHTNESS_FRAGMENT_SHADER = "" + 26 | "varying highp vec2 textureCoordinate;\n" + 27 | " \n" + 28 | " uniform sampler2D inputImageTexture;\n" + 29 | " uniform lowp float brightness;\n" + 30 | " \n" + 31 | " void main()\n" + 32 | " {\n" + 33 | " lowp vec4 textureColor = texture2D(inputImageTexture, textureCoordinate);\n" + 34 | " \n" + 35 | " gl_FragColor = vec4((textureColor.rgb + vec3(brightness)), textureColor.w);\n" + 36 | " }"; 37 | 38 | private int mBrightnessLocation; 39 | private float mBrightness; 40 | 41 | public GPUImageBrightnessFilter() { 42 | this(0.0f); 43 | } 44 | 45 | public GPUImageBrightnessFilter(final float brightness) { 46 | super(NO_FILTER_VERTEX_SHADER, BRIGHTNESS_FRAGMENT_SHADER); 47 | mBrightness = brightness; 48 | } 49 | 50 | @Override 51 | public void onInit() { 52 | super.onInit(); 53 | mBrightnessLocation = GLES20.glGetUniformLocation(getProgram(), "brightness"); 54 | } 55 | 56 | @Override 57 | public void onInitialized() { 58 | super.onInitialized(); 59 | setBrightness(mBrightness); 60 | } 61 | 62 | public void setBrightness(final float brightness) { 63 | mBrightness = brightness; 64 | setFloat(mBrightnessLocation, mBrightness); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /Gpu-Image/src/jp/co/cyberagent/android/gpuimage/GPUImageColorBurnBlendFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 CyberAgent 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package jp.co.cyberagent.android.gpuimage; 18 | 19 | public class GPUImageColorBurnBlendFilter extends GPUImageTwoInputFilter { 20 | public static final String COLOR_BURN_BLEND_FRAGMENT_SHADER = "varying highp vec2 textureCoordinate;\n" + 21 | " varying highp vec2 textureCoordinate2;\n" + 22 | "\n" + 23 | " uniform sampler2D inputImageTexture;\n" + 24 | " uniform sampler2D inputImageTexture2;\n" + 25 | " \n" + 26 | " void main()\n" + 27 | " {\n" + 28 | " mediump vec4 textureColor = texture2D(inputImageTexture, textureCoordinate);\n" + 29 | " mediump vec4 textureColor2 = texture2D(inputImageTexture2, textureCoordinate2);\n" + 30 | " mediump vec4 whiteColor = vec4(1.0);\n" + 31 | " gl_FragColor = whiteColor - (whiteColor - textureColor) / textureColor2;\n" + 32 | " }"; 33 | 34 | public GPUImageColorBurnBlendFilter() { 35 | super(COLOR_BURN_BLEND_FRAGMENT_SHADER); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Gpu-Image/src/jp/co/cyberagent/android/gpuimage/GPUImageColorDodgeBlendFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 CyberAgent 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package jp.co.cyberagent.android.gpuimage; 18 | 19 | public class GPUImageColorDodgeBlendFilter extends GPUImageTwoInputFilter { 20 | public static final String COLOR_DODGE_BLEND_FRAGMENT_SHADER = "precision mediump float;\n" + 21 | " \n" + 22 | " varying highp vec2 textureCoordinate;\n" + 23 | " varying highp vec2 textureCoordinate2;\n" + 24 | " \n" + 25 | " uniform sampler2D inputImageTexture;\n" + 26 | " uniform sampler2D inputImageTexture2;\n" + 27 | " \n" + 28 | " void main()\n" + 29 | " {\n" + 30 | " vec4 base = texture2D(inputImageTexture, textureCoordinate);\n" + 31 | " vec4 overlay = texture2D(inputImageTexture2, textureCoordinate2);\n" + 32 | " \n" + 33 | " vec3 baseOverlayAlphaProduct = vec3(overlay.a * base.a);\n" + 34 | " vec3 rightHandProduct = overlay.rgb * (1.0 - base.a) + base.rgb * (1.0 - overlay.a);\n" + 35 | " \n" + 36 | " vec3 firstBlendColor = baseOverlayAlphaProduct + rightHandProduct;\n" + 37 | " vec3 overlayRGB = clamp((overlay.rgb / clamp(overlay.a, 0.01, 1.0)) * step(0.0, overlay.a), 0.0, 0.99);\n" + 38 | " \n" + 39 | " vec3 secondBlendColor = (base.rgb * overlay.a) / (1.0 - overlayRGB) + rightHandProduct;\n" + 40 | " \n" + 41 | " vec3 colorChoice = step((overlay.rgb * base.a + base.rgb * overlay.a), baseOverlayAlphaProduct);\n" + 42 | " \n" + 43 | " gl_FragColor = vec4(mix(firstBlendColor, secondBlendColor, colorChoice), 1.0);\n" + 44 | " }"; 45 | 46 | public GPUImageColorDodgeBlendFilter() { 47 | super(COLOR_DODGE_BLEND_FRAGMENT_SHADER); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Gpu-Image/src/jp/co/cyberagent/android/gpuimage/GPUImageColorInvertFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 CyberAgent 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package jp.co.cyberagent.android.gpuimage; 18 | 19 | /** 20 | * Invert all the colors in the image. 21 | */ 22 | public class GPUImageColorInvertFilter extends GPUImageFilter { 23 | public static final String COLOR_INVERT_FRAGMENT_SHADER = "" + 24 | "varying highp vec2 textureCoordinate;\n" + 25 | "\n" + 26 | "uniform sampler2D inputImageTexture;\n" + 27 | "\n" + 28 | "void main()\n" + 29 | "{\n" + 30 | " lowp vec4 textureColor = texture2D(inputImageTexture, textureCoordinate);\n" + 31 | " \n" + 32 | " gl_FragColor = vec4((1.0 - textureColor.rgb), textureColor.w);\n" + 33 | "}"; 34 | 35 | public GPUImageColorInvertFilter() { 36 | super(NO_FILTER_VERTEX_SHADER, COLOR_INVERT_FRAGMENT_SHADER); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Gpu-Image/src/jp/co/cyberagent/android/gpuimage/GPUImageContrastFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 CyberAgent 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package jp.co.cyberagent.android.gpuimage; 18 | 19 | import android.opengl.GLES20; 20 | 21 | /** 22 | * Changes the contrast of the image.
23 | *
24 | * contrast value ranges from 0.0 to 4.0, with 1.0 as the normal level 25 | */ 26 | public class GPUImageContrastFilter extends GPUImageFilter { 27 | public static final String CONTRAST_FRAGMENT_SHADER = "" + 28 | "varying highp vec2 textureCoordinate;\n" + 29 | " \n" + 30 | " uniform sampler2D inputImageTexture;\n" + 31 | " uniform lowp float contrast;\n" + 32 | " \n" + 33 | " void main()\n" + 34 | " {\n" + 35 | " lowp vec4 textureColor = texture2D(inputImageTexture, textureCoordinate);\n" + 36 | " \n" + 37 | " gl_FragColor = vec4(((textureColor.rgb - vec3(0.5)) * contrast + vec3(0.5)), textureColor.w);\n" + 38 | " }"; 39 | 40 | private int mContrastLocation; 41 | private float mContrast; 42 | 43 | public GPUImageContrastFilter() { 44 | this(1.2f); 45 | } 46 | 47 | public GPUImageContrastFilter(float contrast) { 48 | super(NO_FILTER_VERTEX_SHADER, CONTRAST_FRAGMENT_SHADER); 49 | mContrast = contrast; 50 | } 51 | 52 | @Override 53 | public void onInit() { 54 | super.onInit(); 55 | mContrastLocation = GLES20.glGetUniformLocation(getProgram(), "contrast"); 56 | } 57 | 58 | @Override 59 | public void onInitialized() { 60 | super.onInitialized(); 61 | setContrast(mContrast); 62 | } 63 | 64 | public void setContrast(final float contrast) { 65 | mContrast = contrast; 66 | setFloat(mContrastLocation, mContrast); 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /Gpu-Image/src/jp/co/cyberagent/android/gpuimage/GPUImageDarkenBlendFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 CyberAgent 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package jp.co.cyberagent.android.gpuimage; 18 | 19 | public class GPUImageDarkenBlendFilter extends GPUImageTwoInputFilter { 20 | public static final String DARKEN_BLEND_FRAGMENT_SHADER = "varying highp vec2 textureCoordinate;\n" + 21 | " varying highp vec2 textureCoordinate2;\n" + 22 | "\n" + 23 | " uniform sampler2D inputImageTexture;\n" + 24 | " uniform sampler2D inputImageTexture2;\n" + 25 | " \n" + 26 | " void main()\n" + 27 | " {\n" + 28 | " lowp vec4 base = texture2D(inputImageTexture, textureCoordinate);\n" + 29 | " lowp vec4 overlayer = texture2D(inputImageTexture2, textureCoordinate2);\n" + 30 | " \n" + 31 | " gl_FragColor = vec4(min(overlayer.rgb * base.a, base.rgb * overlayer.a) + overlayer.rgb * (1.0 - base.a) + base.rgb * (1.0 - overlayer.a), 1.0);\n" + 32 | " }"; 33 | 34 | public GPUImageDarkenBlendFilter() { 35 | super(DARKEN_BLEND_FRAGMENT_SHADER); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Gpu-Image/src/jp/co/cyberagent/android/gpuimage/GPUImageDifferenceBlendFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 CyberAgent 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package jp.co.cyberagent.android.gpuimage; 18 | 19 | public class GPUImageDifferenceBlendFilter extends GPUImageTwoInputFilter { 20 | public static final String DIFFERENCE_BLEND_FRAGMENT_SHADER = "varying highp vec2 textureCoordinate;\n" + 21 | " varying highp vec2 textureCoordinate2;\n" + 22 | "\n" + 23 | " uniform sampler2D inputImageTexture;\n" + 24 | " uniform sampler2D inputImageTexture2;\n" + 25 | " \n" + 26 | " void main()\n" + 27 | " {\n" + 28 | " mediump vec4 textureColor = texture2D(inputImageTexture, textureCoordinate);\n" + 29 | " mediump vec4 textureColor2 = texture2D(inputImageTexture2, textureCoordinate2);\n" + 30 | " gl_FragColor = vec4(abs(textureColor2.rgb - textureColor.rgb), textureColor.a);\n" + 31 | " }"; 32 | 33 | public GPUImageDifferenceBlendFilter() { 34 | super(DIFFERENCE_BLEND_FRAGMENT_SHADER); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Gpu-Image/src/jp/co/cyberagent/android/gpuimage/GPUImageDissolveBlendFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 CyberAgent 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package jp.co.cyberagent.android.gpuimage; 18 | 19 | import android.opengl.GLES20; 20 | 21 | /** 22 | * Mix ranges from 0.0 (only image 1) to 1.0 (only image 2), with 0.5 (half of either) as the normal level 23 | */ 24 | public class GPUImageDissolveBlendFilter extends GPUImageMixBlendFilter{ 25 | public static final String DISSOLVE_BLEND_FRAGMENT_SHADER = "varying highp vec2 textureCoordinate;\n" + 26 | " varying highp vec2 textureCoordinate2;\n" + 27 | "\n" + 28 | " uniform sampler2D inputImageTexture;\n" + 29 | " uniform sampler2D inputImageTexture2;\n" + 30 | " uniform lowp float mixturePercent;\n" + 31 | " \n" + 32 | " void main()\n" + 33 | " {\n" + 34 | " lowp vec4 textureColor = texture2D(inputImageTexture, textureCoordinate);\n" + 35 | " lowp vec4 textureColor2 = texture2D(inputImageTexture2, textureCoordinate2);\n" + 36 | " \n" + 37 | " gl_FragColor = mix(textureColor, textureColor2, mixturePercent);\n" + 38 | " }"; 39 | 40 | public GPUImageDissolveBlendFilter() { 41 | super(DISSOLVE_BLEND_FRAGMENT_SHADER); 42 | } 43 | 44 | public GPUImageDissolveBlendFilter(float mix) { 45 | super(DISSOLVE_BLEND_FRAGMENT_SHADER, mix); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Gpu-Image/src/jp/co/cyberagent/android/gpuimage/GPUImageEmbossFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 CyberAgent 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package jp.co.cyberagent.android.gpuimage; 18 | 19 | /** 20 | * Applies an emboss effect to the image.
21 | *
22 | * Intensity ranges from 0.0 to 4.0, with 1.0 as the normal level 23 | */ 24 | public class GPUImageEmbossFilter extends GPUImage3x3ConvolutionFilter { 25 | private float mIntensity; 26 | 27 | public GPUImageEmbossFilter() { 28 | this(1.0f); 29 | } 30 | 31 | public GPUImageEmbossFilter(final float intensity) { 32 | super(); 33 | mIntensity = intensity; 34 | } 35 | 36 | @Override 37 | public void onInit() { 38 | super.onInit(); 39 | setIntensity(mIntensity); 40 | } 41 | 42 | public void setIntensity(final float intensity) { 43 | mIntensity = intensity; 44 | setConvolutionKernel(new float[] { 45 | intensity * (-2.0f), -intensity, 0.0f, 46 | -intensity, 1.0f, intensity, 47 | 0.0f, intensity, intensity * 2.0f, 48 | }); 49 | } 50 | 51 | public float getIntensity() { 52 | return mIntensity; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /Gpu-Image/src/jp/co/cyberagent/android/gpuimage/GPUImageExclusionBlendFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 CyberAgent 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package jp.co.cyberagent.android.gpuimage; 18 | 19 | public class GPUImageExclusionBlendFilter extends GPUImageTwoInputFilter { 20 | public static final String EXCLUSION_BLEND_FRAGMENT_SHADER = "varying highp vec2 textureCoordinate;\n" + 21 | " varying highp vec2 textureCoordinate2;\n" + 22 | "\n" + 23 | " uniform sampler2D inputImageTexture;\n" + 24 | " uniform sampler2D inputImageTexture2;\n" + 25 | " \n" + 26 | " void main()\n" + 27 | " {\n" + 28 | " mediump vec4 base = texture2D(inputImageTexture, textureCoordinate);\n" + 29 | " mediump vec4 overlay = texture2D(inputImageTexture2, textureCoordinate2);\n" + 30 | " \n" + 31 | " // Dca = (Sca.Da + Dca.Sa - 2.Sca.Dca) + Sca.(1 - Da) + Dca.(1 - Sa)\n" + 32 | " \n" + 33 | " gl_FragColor = vec4((overlay.rgb * base.a + base.rgb * overlay.a - 2.0 * overlay.rgb * base.rgb) + overlay.rgb * (1.0 - base.a) + base.rgb * (1.0 - overlay.a), base.a);\n" + 34 | " }"; 35 | 36 | public GPUImageExclusionBlendFilter() { 37 | super(EXCLUSION_BLEND_FRAGMENT_SHADER); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Gpu-Image/src/jp/co/cyberagent/android/gpuimage/GPUImageExposureFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 CyberAgent 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package jp.co.cyberagent.android.gpuimage; 18 | 19 | import android.opengl.GLES20; 20 | 21 | /** 22 | * exposure: The adjusted exposure (-10.0 - 10.0, with 0.0 as the default) 23 | */ 24 | public class GPUImageExposureFilter extends GPUImageFilter { 25 | public static final String EXPOSURE_FRAGMENT_SHADER = "" + 26 | " varying highp vec2 textureCoordinate;\n" + 27 | " \n" + 28 | " uniform sampler2D inputImageTexture;\n" + 29 | " uniform highp float exposure;\n" + 30 | " \n" + 31 | " void main()\n" + 32 | " {\n" + 33 | " highp vec4 textureColor = texture2D(inputImageTexture, textureCoordinate);\n" + 34 | " \n" + 35 | " gl_FragColor = vec4(textureColor.rgb * pow(2.0, exposure), textureColor.w);\n" + 36 | " } "; 37 | 38 | private int mExposureLocation; 39 | private float mExposure; 40 | 41 | public GPUImageExposureFilter() { 42 | this(1.0f); 43 | } 44 | 45 | public GPUImageExposureFilter(final float exposure) { 46 | super(NO_FILTER_VERTEX_SHADER, EXPOSURE_FRAGMENT_SHADER); 47 | mExposure = exposure; 48 | } 49 | 50 | @Override 51 | public void onInit() { 52 | super.onInit(); 53 | mExposureLocation = GLES20.glGetUniformLocation(getProgram(), "exposure"); 54 | } 55 | 56 | @Override 57 | public void onInitialized() { 58 | super.onInitialized(); 59 | setExposure(mExposure); 60 | } 61 | 62 | public void setExposure(final float exposure) { 63 | mExposure = exposure; 64 | setFloat(mExposureLocation, mExposure); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /Gpu-Image/src/jp/co/cyberagent/android/gpuimage/GPUImageGammaFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 CyberAgent 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package jp.co.cyberagent.android.gpuimage; 18 | 19 | import android.opengl.GLES20; 20 | 21 | /** 22 | * gamma value ranges from 0.0 to 3.0, with 1.0 as the normal level 23 | */ 24 | public class GPUImageGammaFilter extends GPUImageFilter { 25 | public static final String GAMMA_FRAGMENT_SHADER = "" + 26 | "varying highp vec2 textureCoordinate;\n" + 27 | " \n" + 28 | " uniform sampler2D inputImageTexture;\n" + 29 | " uniform lowp float gamma;\n" + 30 | " \n" + 31 | " void main()\n" + 32 | " {\n" + 33 | " lowp vec4 textureColor = texture2D(inputImageTexture, textureCoordinate);\n" + 34 | " \n" + 35 | " gl_FragColor = vec4(pow(textureColor.rgb, vec3(gamma)), textureColor.w);\n" + 36 | " }"; 37 | 38 | private int mGammaLocation; 39 | private float mGamma; 40 | 41 | public GPUImageGammaFilter() { 42 | this(1.2f); 43 | } 44 | 45 | public GPUImageGammaFilter(final float gamma) { 46 | super(NO_FILTER_VERTEX_SHADER, GAMMA_FRAGMENT_SHADER); 47 | mGamma = gamma; 48 | } 49 | 50 | @Override 51 | public void onInit() { 52 | super.onInit(); 53 | mGammaLocation = GLES20.glGetUniformLocation(getProgram(), "gamma"); 54 | } 55 | 56 | @Override 57 | public void onInitialized() { 58 | super.onInitialized(); 59 | setGamma(mGamma); 60 | } 61 | 62 | public void setGamma(final float gamma) { 63 | mGamma = gamma; 64 | setFloat(mGammaLocation, mGamma); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /Gpu-Image/src/jp/co/cyberagent/android/gpuimage/GPUImageGrayscaleFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 CyberAgent 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package jp.co.cyberagent.android.gpuimage; 18 | 19 | /** 20 | * Applies a grayscale effect to the image. 21 | */ 22 | public class GPUImageGrayscaleFilter extends GPUImageFilter { 23 | public static final String GRAYSCALE_FRAGMENT_SHADER = "" + 24 | "precision highp float;\n" + 25 | "\n" + 26 | "varying vec2 textureCoordinate;\n" + 27 | "\n" + 28 | "uniform sampler2D inputImageTexture;\n" + 29 | "\n" + 30 | "const highp vec3 W = vec3(0.2125, 0.7154, 0.0721);\n" + 31 | "\n" + 32 | "void main()\n" + 33 | "{\n" + 34 | " lowp vec4 textureColor = texture2D(inputImageTexture, textureCoordinate);\n" + 35 | " float luminance = dot(textureColor.rgb, W);\n" + 36 | "\n" + 37 | " gl_FragColor = vec4(vec3(luminance), textureColor.a);\n" + 38 | "}"; 39 | 40 | public GPUImageGrayscaleFilter() { 41 | super(NO_FILTER_VERTEX_SHADER, GRAYSCALE_FRAGMENT_SHADER); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Gpu-Image/src/jp/co/cyberagent/android/gpuimage/GPUImageLightenBlendFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 CyberAgent 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package jp.co.cyberagent.android.gpuimage; 18 | 19 | public class GPUImageLightenBlendFilter extends GPUImageTwoInputFilter { 20 | public static final String LIGHTEN_BLEND_FRAGMENT_SHADER = "varying highp vec2 textureCoordinate;\n" + 21 | " varying highp vec2 textureCoordinate2;\n" + 22 | "\n" + 23 | " uniform sampler2D inputImageTexture;\n" + 24 | " uniform sampler2D inputImageTexture2;\n" + 25 | " \n" + 26 | " void main()\n" + 27 | " {\n" + 28 | " lowp vec4 textureColor = texture2D(inputImageTexture, textureCoordinate);\n" + 29 | " lowp vec4 textureColor2 = texture2D(inputImageTexture2, textureCoordinate2);\n" + 30 | " \n" + 31 | " gl_FragColor = max(textureColor, textureColor2);\n" + 32 | " }"; 33 | 34 | public GPUImageLightenBlendFilter() { 35 | super(LIGHTEN_BLEND_FRAGMENT_SHADER); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Gpu-Image/src/jp/co/cyberagent/android/gpuimage/GPUImageLinearBurnBlendFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 CyberAgent 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package jp.co.cyberagent.android.gpuimage; 18 | 19 | public class GPUImageLinearBurnBlendFilter extends GPUImageTwoInputFilter { 20 | public static final String LINEAR_BURN_BLEND_FRAGMENT_SHADER = "varying highp vec2 textureCoordinate;\n" + 21 | " varying highp vec2 textureCoordinate2;\n" + 22 | " \n" + 23 | " uniform sampler2D inputImageTexture;\n" + 24 | " uniform sampler2D inputImageTexture2;\n" + 25 | " \n" + 26 | " void main()\n" + 27 | " {\n" + 28 | " mediump vec4 textureColor = texture2D(inputImageTexture, textureCoordinate);\n" + 29 | " mediump vec4 textureColor2 = texture2D(inputImageTexture2, textureCoordinate2);\n" + 30 | " \n" + 31 | " gl_FragColor = vec4(clamp(textureColor.rgb + textureColor2.rgb - vec3(1.0), vec3(0.0), vec3(1.0)), textureColor.a);\n" + 32 | " }"; 33 | 34 | public GPUImageLinearBurnBlendFilter() { 35 | super(LINEAR_BURN_BLEND_FRAGMENT_SHADER); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Gpu-Image/src/jp/co/cyberagent/android/gpuimage/GPUImageLookupFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 CyberAgent 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package jp.co.cyberagent.android.gpuimage; 18 | 19 | public class GPUImageLookupFilter extends GPUImageTwoInputFilter { 20 | 21 | public static final String LOOKUP_FRAGMENT_SHADER = "varying highp vec2 textureCoordinate;\n" + 22 | " varying highp vec2 textureCoordinate2; // TODO: This is not used\n" + 23 | " \n" + 24 | " uniform sampler2D inputImageTexture;\n" + 25 | " uniform sampler2D inputImageTexture2; // lookup texture\n" + 26 | " \n" + 27 | " void main()\n" + 28 | " {\n" + 29 | " lowp vec4 textureColor = texture2D(inputImageTexture, textureCoordinate);\n" + 30 | " \n" + 31 | " mediump float blueColor = textureColor.b * 63.0;\n" + 32 | " \n" + 33 | " mediump vec2 quad1;\n" + 34 | " quad1.y = floor(floor(blueColor) / 8.0);\n" + 35 | " quad1.x = floor(blueColor) - (quad1.y * 8.0);\n" + 36 | " \n" + 37 | " mediump vec2 quad2;\n" + 38 | " quad2.y = floor(ceil(blueColor) / 8.0);\n" + 39 | " quad2.x = ceil(blueColor) - (quad2.y * 8.0);\n" + 40 | " \n" + 41 | " highp vec2 texPos1;\n" + 42 | " texPos1.x = (quad1.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.r);\n" + 43 | " texPos1.y = (quad1.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.g);\n" + 44 | " \n" + 45 | " highp vec2 texPos2;\n" + 46 | " texPos2.x = (quad2.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.r);\n" + 47 | " texPos2.y = (quad2.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.g);\n" + 48 | " \n" + 49 | " lowp vec4 newColor1 = texture2D(inputImageTexture2, texPos1);\n" + 50 | " lowp vec4 newColor2 = texture2D(inputImageTexture2, texPos2);\n" + 51 | " \n" + 52 | " lowp vec4 newColor = mix(newColor1, newColor2, fract(blueColor));\n" + 53 | " gl_FragColor = vec4(newColor.rgb, textureColor.w);\n" + 54 | " }"; 55 | 56 | 57 | public GPUImageLookupFilter() { 58 | super(LOOKUP_FRAGMENT_SHADER); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /Gpu-Image/src/jp/co/cyberagent/android/gpuimage/GPUImageMixBlendFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 CyberAgent 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package jp.co.cyberagent.android.gpuimage; 18 | 19 | import android.opengl.GLES20; 20 | 21 | public class GPUImageMixBlendFilter extends GPUImageTwoInputFilter { 22 | 23 | private int mMixLocation; 24 | private float mMix; 25 | 26 | public GPUImageMixBlendFilter(String fragmentShader) { 27 | this(fragmentShader, 0.5f); 28 | } 29 | 30 | public GPUImageMixBlendFilter(String fragmentShader, float mix) { 31 | super(fragmentShader); 32 | mMix = mix; 33 | } 34 | 35 | @Override 36 | public void onInit() { 37 | super.onInit(); 38 | mMixLocation = GLES20.glGetUniformLocation(getProgram(), "mixturePercent"); 39 | } 40 | 41 | @Override 42 | public void onInitialized() { 43 | super.onInitialized(); 44 | setMix(mMix); 45 | } 46 | 47 | /** 48 | * @param mix ranges from 0.0 (only image 1) to 1.0 (only image 2), with 0.5 (half of either) as the normal level 49 | */ 50 | public void setMix(final float mix) { 51 | mMix = mix; 52 | setFloat(mMixLocation, mMix); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /Gpu-Image/src/jp/co/cyberagent/android/gpuimage/GPUImageMultiplyBlendFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 CyberAgent 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package jp.co.cyberagent.android.gpuimage; 18 | 19 | public class GPUImageMultiplyBlendFilter extends GPUImageTwoInputFilter { 20 | public static final String MULTIPLY_BLEND_FRAGMENT_SHADER = "varying highp vec2 textureCoordinate;\n" + 21 | " varying highp vec2 textureCoordinate2;\n" + 22 | "\n" + 23 | " uniform sampler2D inputImageTexture;\n" + 24 | " uniform sampler2D inputImageTexture2;\n" + 25 | " \n" + 26 | " void main()\n" + 27 | " {\n" + 28 | " lowp vec4 base = texture2D(inputImageTexture, textureCoordinate);\n" + 29 | " lowp vec4 overlayer = texture2D(inputImageTexture2, textureCoordinate2);\n" + 30 | " \n" + 31 | " gl_FragColor = overlayer * base + overlayer * (1.0 - base.a) + base * (1.0 - overlayer.a);\n" + 32 | " }"; 33 | 34 | public GPUImageMultiplyBlendFilter() { 35 | super(MULTIPLY_BLEND_FRAGMENT_SHADER); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Gpu-Image/src/jp/co/cyberagent/android/gpuimage/GPUImageNativeLibrary.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 CyberAgent 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package jp.co.cyberagent.android.gpuimage; 18 | 19 | public class GPUImageNativeLibrary { 20 | static { 21 | System.loadLibrary("gpuimage-library"); 22 | } 23 | 24 | public static native void YUVtoRBGA(byte[] yuv, int width, int height, int[] out); 25 | 26 | public static native void YUVtoARBG(byte[] yuv, int width, int height, int[] out); 27 | } 28 | -------------------------------------------------------------------------------- /Gpu-Image/src/jp/co/cyberagent/android/gpuimage/GPUImageNormalBlendFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 CyberAgent 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package jp.co.cyberagent.android.gpuimage; 18 | 19 | /** 20 | * This equation is a simplification of the general blending equation. It assumes the destination color is opaque, and therefore drops the destination color's alpha term. 21 | * 22 | * D = C1 * C1a + C2 * C2a * (1 - C1a) 23 | * where D is the resultant color, C1 is the color of the first element, C1a is the alpha of the first element, C2 is the second element color, C2a is the alpha of the second element. The destination alpha is calculated with: 24 | * 25 | * Da = C1a + C2a * (1 - C1a) 26 | * The resultant color is premultiplied with the alpha. To restore the color to the unmultiplied values, just divide by Da, the resultant alpha. 27 | * 28 | * http://stackoverflow.com/questions/1724946/blend-mode-on-a-transparent-and-semi-transparent-background 29 | * 30 | * For some reason Photoshop behaves 31 | * D = C1 + C2 * C2a * (1 - C1a) 32 | */ 33 | public class GPUImageNormalBlendFilter extends GPUImageTwoInputFilter { 34 | public static final String NORMAL_BLEND_FRAGMENT_SHADER = "varying highp vec2 textureCoordinate;\n" + 35 | " varying highp vec2 textureCoordinate2;\n" + 36 | " \n" + 37 | " uniform sampler2D inputImageTexture;\n" + 38 | " uniform sampler2D inputImageTexture2;\n" + 39 | " \n" + 40 | " void main()\n" + 41 | " {\n" + 42 | " lowp vec4 c2 = texture2D(inputImageTexture, textureCoordinate);\n" + 43 | "\t lowp vec4 c1 = texture2D(inputImageTexture2, textureCoordinate2);\n" + 44 | " \n" + 45 | " lowp vec4 outputColor;\n" + 46 | " \n" + 47 | " outputColor.r = c1.r + c2.r * c2.a * (1.0 - c1.a);\n" + 48 | "\n" + 49 | " outputColor.g = c1.g + c2.g * c2.a * (1.0 - c1.a);\n" + 50 | " \n" + 51 | " outputColor.b = c1.b + c2.b * c2.a * (1.0 - c1.a);\n" + 52 | " \n" + 53 | " outputColor.a = c1.a + c2.a * (1.0 - c1.a);\n" + 54 | " \n" + 55 | " gl_FragColor = outputColor;\n" + 56 | " }"; 57 | 58 | public GPUImageNormalBlendFilter() { 59 | super(NORMAL_BLEND_FRAGMENT_SHADER); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /Gpu-Image/src/jp/co/cyberagent/android/gpuimage/GPUImageOpacityFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 CyberAgent 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package jp.co.cyberagent.android.gpuimage; 18 | 19 | import android.opengl.GLES20; 20 | 21 | /** 22 | * Adjusts the alpha channel of the incoming image 23 | * opacity: The value to multiply the incoming alpha channel for each pixel by (0.0 - 1.0, with 1.0 as the default) 24 | */ 25 | public class GPUImageOpacityFilter extends GPUImageFilter { 26 | public static final String OPACITY_FRAGMENT_SHADER = "" + 27 | " varying highp vec2 textureCoordinate;\n" + 28 | " \n" + 29 | " uniform sampler2D inputImageTexture;\n" + 30 | " uniform lowp float opacity;\n" + 31 | " \n" + 32 | " void main()\n" + 33 | " {\n" + 34 | " lowp vec4 textureColor = texture2D(inputImageTexture, textureCoordinate);\n" + 35 | " \n" + 36 | " gl_FragColor = vec4(textureColor.rgb, textureColor.a * opacity);\n" + 37 | " }\n"; 38 | 39 | private int mOpacityLocation; 40 | private float mOpacity; 41 | 42 | public GPUImageOpacityFilter() { 43 | this(1.0f); 44 | } 45 | 46 | public GPUImageOpacityFilter(final float opacity) { 47 | super(NO_FILTER_VERTEX_SHADER, OPACITY_FRAGMENT_SHADER); 48 | mOpacity = opacity; 49 | } 50 | 51 | @Override 52 | public void onInit() { 53 | super.onInit(); 54 | mOpacityLocation = GLES20.glGetUniformLocation(getProgram(), "opacity"); 55 | } 56 | 57 | @Override 58 | public void onInitialized() { 59 | super.onInitialized(); 60 | setOpacity(mOpacity); 61 | } 62 | 63 | public void setOpacity(final float opacity) { 64 | mOpacity = opacity; 65 | setFloat(mOpacityLocation, mOpacity); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /Gpu-Image/src/jp/co/cyberagent/android/gpuimage/GPUImagePixelationFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 CyberAgent 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package jp.co.cyberagent.android.gpuimage; 18 | 19 | import android.opengl.GLES20; 20 | /** 21 | * Applies a grayscale effect to the image. 22 | */ 23 | public class GPUImagePixelationFilter extends GPUImageFilter { 24 | public static final String PIXELATION_FRAGMENT_SHADER = "" + 25 | "precision highp float;\n" + 26 | 27 | "varying vec2 textureCoordinate;\n" + 28 | 29 | "uniform float imageWidthFactor;\n" + 30 | "uniform float imageHeightFactor;\n" + 31 | "uniform sampler2D inputImageTexture;\n" + 32 | "uniform float pixel;\n" + 33 | 34 | "void main()\n" + 35 | "{\n" + 36 | " vec2 uv = textureCoordinate.xy;\n" + 37 | " float dx = pixel * imageWidthFactor;\n" + 38 | " float dy = pixel * imageHeightFactor;\n" + 39 | " vec2 coord = vec2(dx * floor(uv.x / dx), dy * floor(uv.y / dy));\n" + 40 | " vec3 tc = texture2D(inputImageTexture, coord).xyz;\n" + 41 | " gl_FragColor = vec4(tc, 1.0);\n" + 42 | "}"; 43 | 44 | private int mImageWidthFactorLocation; 45 | private int mImageHeightFactorLocation; 46 | private float mPixel; 47 | private int mPixelLocation; 48 | 49 | public GPUImagePixelationFilter() { 50 | super(NO_FILTER_VERTEX_SHADER, PIXELATION_FRAGMENT_SHADER); 51 | mPixel = 1.0f; 52 | } 53 | 54 | @Override 55 | public void onInit() { 56 | super.onInit(); 57 | mImageWidthFactorLocation = GLES20.glGetUniformLocation(getProgram(), "imageWidthFactor"); 58 | mImageHeightFactorLocation = GLES20.glGetUniformLocation(getProgram(), "imageHeightFactor"); 59 | mPixelLocation = GLES20.glGetUniformLocation(getProgram(), "pixel"); 60 | setPixel(mPixel); 61 | } 62 | 63 | @Override 64 | public void onOutputSizeChanged(final int width, final int height) { 65 | super.onOutputSizeChanged(width, height); 66 | setFloat(mImageWidthFactorLocation, 1.0f / width); 67 | setFloat(mImageHeightFactorLocation, 1.0f / height); 68 | } 69 | 70 | public void setPixel(final float pixel) { 71 | mPixel = pixel; 72 | setFloat(mPixelLocation, mPixel); 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /Gpu-Image/src/jp/co/cyberagent/android/gpuimage/GPUImagePosterizeFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 CyberAgent 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package jp.co.cyberagent.android.gpuimage; 18 | 19 | import android.opengl.GLES20; 20 | 21 | /** 22 | * Reduces the color range of the image.
23 | *
24 | * colorLevels: ranges from 1 to 256, with a default of 10 25 | */ 26 | public class GPUImagePosterizeFilter extends GPUImageFilter { 27 | public static final String POSTERIZE_FRAGMENT_SHADER = "" + 28 | "varying highp vec2 textureCoordinate;\n" + 29 | "\n" + 30 | "uniform sampler2D inputImageTexture;\n" + 31 | "uniform highp float colorLevels;\n" + 32 | "\n" + 33 | "void main()\n" + 34 | "{\n" + 35 | " highp vec4 textureColor = texture2D(inputImageTexture, textureCoordinate);\n" + 36 | " \n" + 37 | " gl_FragColor = floor((textureColor * colorLevels) + vec4(0.5)) / colorLevels;\n" + 38 | "}"; 39 | 40 | private int mGLUniformColorLevels; 41 | private int mColorLevels; 42 | 43 | public GPUImagePosterizeFilter() { 44 | this(10); 45 | } 46 | 47 | public GPUImagePosterizeFilter(final int colorLevels) { 48 | super(GPUImageFilter.NO_FILTER_VERTEX_SHADER, POSTERIZE_FRAGMENT_SHADER); 49 | mColorLevels = colorLevels; 50 | } 51 | 52 | @Override 53 | public void onInit() { 54 | super.onInit(); 55 | mGLUniformColorLevels = GLES20.glGetUniformLocation(getProgram(), "colorLevels"); 56 | setColorLevels(mColorLevels); 57 | } 58 | 59 | public void setColorLevels(final int colorLevels) { 60 | mColorLevels = colorLevels; 61 | setFloat(mGLUniformColorLevels, colorLevels); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /Gpu-Image/src/jp/co/cyberagent/android/gpuimage/GPUImageSaturationFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 CyberAgent 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package jp.co.cyberagent.android.gpuimage; 18 | 19 | import android.opengl.GLES20; 20 | 21 | /** 22 | * saturation: The degree of saturation or desaturation to apply to the image (0.0 - 2.0, with 1.0 as the default) 23 | */ 24 | public class GPUImageSaturationFilter extends GPUImageFilter { 25 | public static final String SATURATION_FRAGMENT_SHADER = "" + 26 | " varying highp vec2 textureCoordinate;\n" + 27 | " \n" + 28 | " uniform sampler2D inputImageTexture;\n" + 29 | " uniform lowp float saturation;\n" + 30 | " \n" + 31 | " // Values from \"Graphics Shaders: Theory and Practice\" by Bailey and Cunningham\n" + 32 | " const mediump vec3 luminanceWeighting = vec3(0.2125, 0.7154, 0.0721);\n" + 33 | " \n" + 34 | " void main()\n" + 35 | " {\n" + 36 | " lowp vec4 textureColor = texture2D(inputImageTexture, textureCoordinate);\n" + 37 | " lowp float luminance = dot(textureColor.rgb, luminanceWeighting);\n" + 38 | " lowp vec3 greyScaleColor = vec3(luminance);\n" + 39 | " \n" + 40 | " gl_FragColor = vec4(mix(greyScaleColor, textureColor.rgb, saturation), textureColor.w);\n" + 41 | " \n" + 42 | " }"; 43 | 44 | private int mSaturationLocation; 45 | private float mSaturation; 46 | 47 | public GPUImageSaturationFilter() { 48 | this(1.0f); 49 | } 50 | 51 | public GPUImageSaturationFilter(final float saturation) { 52 | super(NO_FILTER_VERTEX_SHADER, SATURATION_FRAGMENT_SHADER); 53 | mSaturation = saturation; 54 | } 55 | 56 | @Override 57 | public void onInit() { 58 | super.onInit(); 59 | mSaturationLocation = GLES20.glGetUniformLocation(getProgram(), "saturation"); 60 | } 61 | 62 | @Override 63 | public void onInitialized() { 64 | super.onInitialized(); 65 | setSaturation(mSaturation); 66 | } 67 | 68 | public void setSaturation(final float saturation) { 69 | mSaturation = saturation; 70 | setFloat(mSaturationLocation, mSaturation); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /Gpu-Image/src/jp/co/cyberagent/android/gpuimage/GPUImageScreenBlendFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 CyberAgent 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package jp.co.cyberagent.android.gpuimage; 18 | 19 | public class GPUImageScreenBlendFilter extends GPUImageTwoInputFilter { 20 | public static final String SCREEN_BLEND_FRAGMENT_SHADER = "varying highp vec2 textureCoordinate;\n" + 21 | " varying highp vec2 textureCoordinate2;\n" + 22 | "\n" + 23 | " uniform sampler2D inputImageTexture;\n" + 24 | " uniform sampler2D inputImageTexture2;\n" + 25 | " \n" + 26 | " void main()\n" + 27 | " {\n" + 28 | " mediump vec4 textureColor = texture2D(inputImageTexture, textureCoordinate);\n" + 29 | " mediump vec4 textureColor2 = texture2D(inputImageTexture2, textureCoordinate2);\n" + 30 | " mediump vec4 whiteColor = vec4(1.0);\n" + 31 | " gl_FragColor = whiteColor - ((whiteColor - textureColor2) * (whiteColor - textureColor));\n" + 32 | " }"; 33 | 34 | public GPUImageScreenBlendFilter() { 35 | super(SCREEN_BLEND_FRAGMENT_SHADER); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Gpu-Image/src/jp/co/cyberagent/android/gpuimage/GPUImageSepiaFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 CyberAgent 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package jp.co.cyberagent.android.gpuimage; 18 | 19 | /** 20 | * Applies a simple sepia effect. 21 | */ 22 | public class GPUImageSepiaFilter extends GPUImageColorMatrixFilter { 23 | 24 | public GPUImageSepiaFilter() { 25 | this(1.0f); 26 | } 27 | 28 | public GPUImageSepiaFilter(final float intensity) { 29 | super(intensity, new float[] { 30 | 0.3588f, 0.7044f, 0.1368f, 0.0f, 31 | 0.2990f, 0.5870f, 0.1140f, 0.0f, 32 | 0.2392f, 0.4696f, 0.0912f, 0.0f, 33 | 0f, 0f, 0f, 1.0f 34 | }); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Gpu-Image/src/jp/co/cyberagent/android/gpuimage/GPUImageSmoothToonFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 CyberAgent 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package jp.co.cyberagent.android.gpuimage; 18 | 19 | import android.opengl.GLES20; 20 | 21 | /** 22 | * This uses a similar process as the GPUImageToonFilter, only it precedes the toon effect 23 | * with a Gaussian blur to smooth out noise. 24 | */ 25 | public class GPUImageSmoothToonFilter extends GPUImageFilterGroup { 26 | GPUImageGaussianBlurFilter blurFilter; 27 | GPUImageToonFilter toonFilter; 28 | 29 | /** 30 | * Setup and Tear down 31 | */ 32 | public GPUImageSmoothToonFilter() { 33 | // First pass: apply a variable Gaussian blur 34 | blurFilter = new GPUImageGaussianBlurFilter(); 35 | addFilter(blurFilter); 36 | 37 | // Second pass: run the Sobel edge detection on this blurred image, along with a posterization effect 38 | toonFilter = new GPUImageToonFilter(); 39 | addFilter(toonFilter); 40 | 41 | getFilters().add(blurFilter); 42 | 43 | setBlurSize(0.5f); 44 | setThreshold(0.2f); 45 | setQuantizationLevels(10.0f); 46 | } 47 | 48 | /** 49 | * Accessors 50 | */ 51 | public void setTexelWidth(float value) { 52 | toonFilter.setTexelWidth(value); 53 | } 54 | 55 | public void setTexelHeight(float value) { 56 | toonFilter.setTexelHeight(value); 57 | } 58 | 59 | public void setBlurSize(float value) { 60 | blurFilter.setBlurSize(value); 61 | } 62 | 63 | public void setThreshold(float value) { 64 | toonFilter.setThreshold(value); 65 | } 66 | 67 | public void setQuantizationLevels(float value) { 68 | toonFilter.setQuantizationLevels(value); 69 | } 70 | 71 | } 72 | -------------------------------------------------------------------------------- /Gpu-Image/src/jp/co/cyberagent/android/gpuimage/GPUImageSoftLightBlendFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 CyberAgent 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package jp.co.cyberagent.android.gpuimage; 18 | 19 | public class GPUImageSoftLightBlendFilter extends GPUImageTwoInputFilter { 20 | public static final String SOFT_LIGHT_BLEND_FRAGMENT_SHADER = "varying highp vec2 textureCoordinate;\n" + 21 | " varying highp vec2 textureCoordinate2;\n" + 22 | "\n" + 23 | " uniform sampler2D inputImageTexture;\n" + 24 | " uniform sampler2D inputImageTexture2;\n" + 25 | " \n" + 26 | " void main()\n" + 27 | " {\n" + 28 | " mediump vec4 base = texture2D(inputImageTexture, textureCoordinate);\n" + 29 | " mediump vec4 overlay = texture2D(inputImageTexture2, textureCoordinate2);\n" + 30 | " \n" + 31 | " gl_FragColor = base * (overlay.a * (base / base.a) + (2.0 * overlay * (1.0 - (base / base.a)))) + overlay * (1.0 - base.a) + base * (1.0 - overlay.a);\n" + 32 | " }"; 33 | 34 | public GPUImageSoftLightBlendFilter() { 35 | super(SOFT_LIGHT_BLEND_FRAGMENT_SHADER); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Gpu-Image/src/jp/co/cyberagent/android/gpuimage/GPUImageSourceOverBlendFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 CyberAgent 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package jp.co.cyberagent.android.gpuimage; 18 | 19 | public class GPUImageSourceOverBlendFilter extends GPUImageTwoInputFilter { 20 | public static final String SOURCE_OVER_BLEND_FRAGMENT_SHADER = "varying highp vec2 textureCoordinate;\n" + 21 | " varying highp vec2 textureCoordinate2;\n" + 22 | " \n" + 23 | " uniform sampler2D inputImageTexture;\n" + 24 | " uniform sampler2D inputImageTexture2;\n" + 25 | " \n" + 26 | " void main()\n" + 27 | " {\n" + 28 | " lowp vec4 textureColor = texture2D(inputImageTexture, textureCoordinate);\n" + 29 | " lowp vec4 textureColor2 = texture2D(inputImageTexture2, textureCoordinate2);\n" + 30 | " \n" + 31 | " gl_FragColor = mix(textureColor, textureColor2, textureColor2.a);\n" + 32 | " }"; 33 | 34 | public GPUImageSourceOverBlendFilter() { 35 | super(SOURCE_OVER_BLEND_FRAGMENT_SHADER); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Gpu-Image/src/jp/co/cyberagent/android/gpuimage/GPUImageSubtractBlendFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 CyberAgent 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package jp.co.cyberagent.android.gpuimage; 18 | 19 | public class GPUImageSubtractBlendFilter extends GPUImageTwoInputFilter { 20 | public static final String SUBTRACT_BLEND_FRAGMENT_SHADER = "varying highp vec2 textureCoordinate;\n" + 21 | " varying highp vec2 textureCoordinate2;\n" + 22 | "\n" + 23 | " uniform sampler2D inputImageTexture;\n" + 24 | " uniform sampler2D inputImageTexture2;\n" + 25 | " \n" + 26 | " void main()\n" + 27 | " {\n" + 28 | " lowp vec4 textureColor = texture2D(inputImageTexture, textureCoordinate);\n" + 29 | " lowp vec4 textureColor2 = texture2D(inputImageTexture2, textureCoordinate2);\n" + 30 | "\n" + 31 | " gl_FragColor = vec4(textureColor.rgb - textureColor2.rgb, textureColor.a);\n" + 32 | " }"; 33 | 34 | public GPUImageSubtractBlendFilter() { 35 | super(SUBTRACT_BLEND_FRAGMENT_SHADER); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Gpu-Image/src/jp/co/cyberagent/android/gpuimage/GPUImageThresholdEdgeDetection.java: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.android.gpuimage; 2 | 3 | /** 4 | * Applies sobel edge detection on the image. 5 | */ 6 | public class GPUImageThresholdEdgeDetection extends GPUImageFilterGroup { 7 | public GPUImageThresholdEdgeDetection() { 8 | super(); 9 | addFilter(new GPUImageGrayscaleFilter()); 10 | addFilter(new GPUImageSobelThresholdFilter()); 11 | } 12 | 13 | public void setLineSize(final float size) { 14 | ((GPUImage3x3TextureSamplingFilter) getFilters().get(1)).setLineSize(size); 15 | } 16 | 17 | public void setThreshold(final float threshold) { 18 | ((GPUImageSobelThresholdFilter) getFilters().get(1)).setThreshold(threshold); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Gpu-Image/src/jp/co/cyberagent/android/gpuimage/GPUImageTwoPassFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 CyberAgent 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package jp.co.cyberagent.android.gpuimage; 18 | 19 | public class GPUImageTwoPassFilter extends GPUImageFilterGroup { 20 | public GPUImageTwoPassFilter(String firstVertexShader, String firstFragmentShader, 21 | String secondVertexShader, String secondFragmentShader) { 22 | super(null); 23 | addFilter(new GPUImageFilter(firstVertexShader, firstFragmentShader)); 24 | addFilter(new GPUImageFilter(secondVertexShader, secondFragmentShader)); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Gpu-Image/src/jp/co/cyberagent/android/gpuimage/GPUImageTwoPassTextureSamplingFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 CyberAgent 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package jp.co.cyberagent.android.gpuimage; 18 | 19 | import android.opengl.GLES20; 20 | 21 | public class GPUImageTwoPassTextureSamplingFilter extends GPUImageTwoPassFilter { 22 | public GPUImageTwoPassTextureSamplingFilter(String firstVertexShader, String firstFragmentShader, 23 | String secondVertexShader, String secondFragmentShader) { 24 | super(firstVertexShader, firstFragmentShader, 25 | secondVertexShader, secondFragmentShader); 26 | } 27 | 28 | @Override 29 | public void onInit() { 30 | super.onInit(); 31 | initTexelOffsets(); 32 | } 33 | 34 | protected void initTexelOffsets() { 35 | float ratio = getHorizontalTexelOffsetRatio(); 36 | GPUImageFilter filter = mFilters.get(0); 37 | int texelWidthOffsetLocation = GLES20.glGetUniformLocation(filter.getProgram(), "texelWidthOffset"); 38 | int texelHeightOffsetLocation = GLES20.glGetUniformLocation(filter.getProgram(), "texelHeightOffset"); 39 | filter.setFloat(texelWidthOffsetLocation, ratio / mOutputWidth); 40 | filter.setFloat(texelHeightOffsetLocation, 0); 41 | 42 | ratio = getVerticalTexelOffsetRatio(); 43 | filter = mFilters.get(1); 44 | texelWidthOffsetLocation = GLES20.glGetUniformLocation(filter.getProgram(), "texelWidthOffset"); 45 | texelHeightOffsetLocation = GLES20.glGetUniformLocation(filter.getProgram(), "texelHeightOffset"); 46 | filter.setFloat(texelWidthOffsetLocation, 0); 47 | filter.setFloat(texelHeightOffsetLocation, ratio / mOutputHeight); 48 | } 49 | 50 | @Override 51 | public void onOutputSizeChanged(int width, int height) { 52 | super.onOutputSizeChanged(width, height); 53 | initTexelOffsets(); 54 | } 55 | 56 | public float getVerticalTexelOffsetRatio() { 57 | return 1f; 58 | } 59 | 60 | public float getHorizontalTexelOffsetRatio() { 61 | return 1f; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /Gpu-Image/src/jp/co/cyberagent/android/gpuimage/Rotation.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 CyberAgent 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package jp.co.cyberagent.android.gpuimage; 18 | 19 | public enum Rotation { 20 | NORMAL, ROTATION_90, ROTATION_180, ROTATION_270; 21 | 22 | /** 23 | * Retrieves the int representation of the Rotation. 24 | * 25 | * @return 0, 90, 180 or 270 26 | */ 27 | public int asInt() { 28 | switch (this) { 29 | case NORMAL: return 0; 30 | case ROTATION_90: return 90; 31 | case ROTATION_180: return 180; 32 | case ROTATION_270: return 270; 33 | default: throw new IllegalStateException("Unknown Rotation!"); 34 | } 35 | } 36 | 37 | /** 38 | * Create a Rotation from an integer. Needs to be either 0, 90, 180 or 270. 39 | * 40 | * @param rotation 0, 90, 180 or 270 41 | * @return Rotation object 42 | */ 43 | public static Rotation fromInt(int rotation) { 44 | switch (rotation) { 45 | case 0: return NORMAL; 46 | case 90: return ROTATION_90; 47 | case 180: return ROTATION_180; 48 | case 270: return ROTATION_270; 49 | case 360: return NORMAL; 50 | default: throw new IllegalStateException( 51 | rotation + " is an unknown rotation. Needs to be either 0, 90, 180 or 270!"); 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /ImageViewTouch/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /ImageViewTouch/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | compileSdkVersion 22 5 | buildToolsVersion "22.0.1" 6 | 7 | defaultConfig { 8 | minSdkVersion 15 9 | targetSdkVersion 22 10 | versionCode 1 11 | versionName "1.0" 12 | } 13 | buildTypes { 14 | release { 15 | minifyEnabled false 16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 17 | } 18 | } 19 | } 20 | 21 | dependencies { 22 | compile fileTree(dir: 'libs', include: ['*.jar']) 23 | compile 'com.android.support:appcompat-v7:22.2.0' 24 | } 25 | -------------------------------------------------------------------------------- /ImageViewTouch/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/sky/Library/Android/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /ImageViewTouch/src/androidTest/java/com/imagezoom/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.imagezoom; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /ImageViewTouch/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ImageViewTouch/src/main/java/com/imagezoom/easing/Back.java: -------------------------------------------------------------------------------- 1 | package com.imagezoom.easing; 2 | 3 | public class Back implements Easing { 4 | 5 | @Override 6 | public double easeOut( double time, double start, double end, double duration ) { 7 | return easeOut( time, start, end, duration, 0 ); 8 | } 9 | 10 | @Override 11 | public double easeIn( double time, double start, double end, double duration ) { 12 | return easeIn( time, start, end, duration, 0 ); 13 | } 14 | 15 | @Override 16 | public double easeInOut( double time, double start, double end, double duration ) { 17 | return easeInOut( time, start, end, duration, 0.9 ); 18 | } 19 | 20 | public double easeIn( double t, double b, double c, double d, double s ) { 21 | if ( s == 0 ) s = 1.70158; 22 | return c * ( t /= d ) * t * ( ( s + 1 ) * t - s ) + b; 23 | } 24 | 25 | public double easeOut( double t, double b, double c, double d, double s ) { 26 | if ( s == 0 ) s = 1.70158; 27 | return c * ( ( t = t / d - 1 ) * t * ( ( s + 1 ) * t + s ) + 1 ) + b; 28 | } 29 | 30 | public double easeInOut( double t, double b, double c, double d, double s ) { 31 | if ( s == 0 ) s = 1.70158; 32 | if ( ( t /= d / 2 ) < 1 ) return c / 2 * ( t * t * ( ( ( s *= ( 1.525 ) ) + 1 ) * t - s ) ) + b; 33 | return c / 2 * ( ( t -= 2 ) * t * ( ( ( s *= ( 1.525 ) ) + 1 ) * t + s ) + 2 ) + b; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /ImageViewTouch/src/main/java/com/imagezoom/easing/Bounce.java: -------------------------------------------------------------------------------- 1 | package com.imagezoom.easing; 2 | 3 | public class Bounce implements Easing { 4 | 5 | @Override 6 | public double easeOut( double t, double b, double c, double d ) { 7 | if ( ( t /= d ) < ( 1.0 / 2.75 ) ) { 8 | return c * ( 7.5625 * t * t ) + b; 9 | } else if ( t < ( 2.0 / 2.75 ) ) { 10 | return c * ( 7.5625 * ( t -= ( 1.5 / 2.75 ) ) * t + .75 ) + b; 11 | } else if ( t < ( 2.5 / 2.75 ) ) { 12 | return c * ( 7.5625 * ( t -= ( 2.25 / 2.75 ) ) * t + .9375 ) + b; 13 | } else { 14 | return c * ( 7.5625 * ( t -= ( 2.625 / 2.75 ) ) * t + .984375 ) + b; 15 | } 16 | } 17 | 18 | @Override 19 | public double easeIn( double t, double b, double c, double d ) { 20 | return c - easeOut( d - t, 0, c, d ) + b; 21 | } 22 | 23 | @Override 24 | public double easeInOut( double t, double b, double c, double d ) { 25 | if ( t < d / 2.0 ) 26 | return easeIn( t * 2.0, 0, c, d ) * .5 + b; 27 | else 28 | return easeOut( t * 2.0 - d, 0, c, d ) * .5 + c * .5 + b; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /ImageViewTouch/src/main/java/com/imagezoom/easing/Circ.java: -------------------------------------------------------------------------------- 1 | package com.imagezoom.easing; 2 | 3 | public class Circ implements Easing { 4 | 5 | @Override 6 | public double easeOut( double time, double start, double end, double duration ) { 7 | return end * Math.sqrt( 1.0 - ( time = time / duration - 1.0 ) * time ) + start; 8 | } 9 | 10 | @Override 11 | public double easeIn( double time, double start, double end, double duration ) { 12 | return -end * ( Math.sqrt( 1.0 - ( time /= duration ) * time ) - 1.0 ) + start; 13 | } 14 | 15 | @Override 16 | public double easeInOut( double time, double start, double end, double duration ) { 17 | if ( ( time /= duration / 2 ) < 1 ) return -end / 2.0 * ( Math.sqrt( 1.0 - time * time ) - 1.0 ) + start; 18 | return end / 2.0 * ( Math.sqrt( 1.0 - ( time -= 2.0 ) * time ) + 1.0 ) + start; 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /ImageViewTouch/src/main/java/com/imagezoom/easing/Cubic.java: -------------------------------------------------------------------------------- 1 | package com.imagezoom.easing; 2 | 3 | public class Cubic implements Easing { 4 | 5 | @Override 6 | public double easeOut( double time, double start, double end, double duration ) { 7 | return end * ( ( time = time / duration - 1.0 ) * time * time + 1.0 ) + start; 8 | } 9 | 10 | @Override 11 | public double easeIn( double time, double start, double end, double duration ) { 12 | return end * ( time /= duration ) * time * time + start; 13 | } 14 | 15 | @Override 16 | public double easeInOut( double time, double start, double end, double duration ) { 17 | if ( ( time /= duration / 2.0 ) < 1.0 ) return end / 2.0 * time * time * time + start; 18 | return end / 2.0 * ( ( time -= 2.0 ) * time * time + 2.0 ) + start; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /ImageViewTouch/src/main/java/com/imagezoom/easing/Easing.java: -------------------------------------------------------------------------------- 1 | package com.imagezoom.easing; 2 | 3 | public interface Easing { 4 | 5 | double easeOut(double time, double start, double end, double duration); 6 | 7 | double easeIn(double time, double start, double end, double duration); 8 | 9 | double easeInOut(double time, double start, double end, double duration); 10 | } 11 | -------------------------------------------------------------------------------- /ImageViewTouch/src/main/java/com/imagezoom/easing/Elastic.java: -------------------------------------------------------------------------------- 1 | package com.imagezoom.easing; 2 | 3 | public class Elastic implements Easing { 4 | 5 | @Override 6 | public double easeIn( double time, double start, double end, double duration ) { 7 | return easeIn( time, start, end, duration, start + end, duration ); 8 | } 9 | 10 | public double easeIn( double t, double b, double c, double d, double a, double p ) { 11 | double s; 12 | if ( t == 0 ) return b; 13 | if ( ( t /= d ) == 1 ) return b + c; 14 | if ( !( p > 0 ) ) p = d * .3; 15 | if ( !( a > 0 ) || a < Math.abs( c ) ) { 16 | a = c; 17 | s = p / 4; 18 | } else 19 | s = p / ( 2 * Math.PI ) * Math.asin( c / a ); 20 | return -( a * Math.pow( 2, 10 * ( t -= 1 ) ) * Math.sin( ( t * d - s ) * ( 2 * Math.PI ) / p ) ) + b; 21 | } 22 | 23 | @Override 24 | public double easeOut( double time, double start, double end, double duration ) { 25 | return easeOut( time, start, end, duration, start + end, duration ); 26 | } 27 | 28 | public double easeOut( double t, double b, double c, double d, double a, double p ) { 29 | double s; 30 | if ( t == 0 ) return b; 31 | if ( ( t /= d ) == 1 ) return b + c; 32 | if ( !( p > 0 ) ) p = d * .3; 33 | if ( !( a > 0 ) || a < Math.abs( c ) ) { 34 | a = c; 35 | s = p / 4; 36 | } else 37 | s = p / ( 2 * Math.PI ) * Math.asin( c / a ); 38 | return ( a * Math.pow( 2, -10 * t ) * Math.sin( ( t * d - s ) * ( 2 * Math.PI ) / p ) + c + b ); 39 | } 40 | 41 | @Override 42 | public double easeInOut( double t, double b, double c, double d ) { 43 | return easeInOut( t, b, c, d, b + c, d ); 44 | } 45 | 46 | public double easeInOut( double t, double b, double c, double d, double a, double p ) { 47 | double s; 48 | 49 | if ( t == 0 ) return b; 50 | if ( ( t /= d / 2 ) == 2 ) return b + c; 51 | if ( !( p > 0 ) ) p = d * ( .3 * 1.5 ); 52 | if ( !( a > 0 ) || a < Math.abs( c ) ) { 53 | a = c; 54 | s = p / 4; 55 | } else 56 | s = p / ( 2 * Math.PI ) * Math.asin( c / a ); 57 | if ( t < 1 ) return -.5 * ( a * Math.pow( 2, 10 * ( t -= 1 ) ) * Math.sin( ( t * d - s ) * ( 2 * Math.PI ) / p ) ) + b; 58 | return a * Math.pow( 2, -10 * ( t -= 1 ) ) * Math.sin( ( t * d - s ) * ( 2 * Math.PI ) / p ) * .5 + c + b; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /ImageViewTouch/src/main/java/com/imagezoom/easing/Expo.java: -------------------------------------------------------------------------------- 1 | package com.imagezoom.easing; 2 | 3 | public class Expo implements Easing { 4 | 5 | @Override 6 | public double easeOut( double time, double start, double end, double duration ) { 7 | return ( time == duration ) ? start + end : end * ( -Math.pow( 2.0, -10.0 * time / duration ) + 1 ) + start; 8 | } 9 | 10 | @Override 11 | public double easeIn( double time, double start, double end, double duration ) { 12 | return ( time == 0 ) ? start : end * Math.pow( 2.0, 10.0 * ( time / duration - 1.0 ) ) + start; 13 | } 14 | 15 | @Override 16 | public double easeInOut( double time, double start, double end, double duration ) { 17 | if ( time == 0 ) return start; 18 | if ( time == duration ) return start + end; 19 | if ( ( time /= duration / 2.0 ) < 1.0 ) return end / 2.0 * Math.pow( 2.0, 10.0 * ( time - 1.0 ) ) + start; 20 | return end / 2.0 * ( -Math.pow( 2.0, -10.0 * --time ) + 2.0 ) + start; 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /ImageViewTouch/src/main/java/com/imagezoom/easing/Linear.java: -------------------------------------------------------------------------------- 1 | package com.imagezoom.easing; 2 | 3 | public class Linear implements Easing { 4 | 5 | public double easeNone( double time, double start, double end, double duration ) { 6 | return end * time / duration + start; 7 | } 8 | 9 | @Override 10 | public double easeOut( double time, double start, double end, double duration ) { 11 | return end * time / duration + start; 12 | } 13 | 14 | @Override 15 | public double easeIn( double time, double start, double end, double duration ) { 16 | return end * time / duration + start; 17 | } 18 | 19 | @Override 20 | public double easeInOut( double time, double start, double end, double duration ) { 21 | return end * time / duration + start; 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /ImageViewTouch/src/main/java/com/imagezoom/easing/Quad.java: -------------------------------------------------------------------------------- 1 | package com.imagezoom.easing; 2 | 3 | public class Quad implements Easing { 4 | 5 | @Override 6 | public double easeOut( double t, double b, double c, double d ) { 7 | return -c * ( t /= d ) * ( t - 2 ) + b; 8 | } 9 | 10 | @Override 11 | public double easeIn( double t, double b, double c, double d ) { 12 | return c * ( t /= d ) * t + b; 13 | } 14 | 15 | @Override 16 | public double easeInOut( double t, double b, double c, double d ) { 17 | if ( ( t /= d / 2 ) < 1 ) return c / 2 * t * t + b; 18 | return -c / 2 * ( ( --t ) * ( t - 2 ) - 1 ) + b; 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /ImageViewTouch/src/main/java/com/imagezoom/easing/Quart.java: -------------------------------------------------------------------------------- 1 | package com.imagezoom.easing; 2 | 3 | public class Quart implements Easing { 4 | 5 | @Override 6 | public double easeOut( double t, double b, double c, double d ) { 7 | return -c * ( ( t = t / d - 1 ) * t * t * t - 1 ) + b; 8 | } 9 | 10 | @Override 11 | public double easeIn( double t, double b, double c, double d ) { 12 | return c * ( t /= d ) * t * t * t + b; 13 | } 14 | 15 | @Override 16 | public double easeInOut( double t, double b, double c, double d ) { 17 | if ( ( t /= d / 2 ) < 1 ) return c / 2 * t * t * t * t + b; 18 | return -c / 2 * ( ( t -= 2 ) * t * t * t - 2 ) + b; 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /ImageViewTouch/src/main/java/com/imagezoom/easing/Quint.java: -------------------------------------------------------------------------------- 1 | package com.imagezoom.easing; 2 | 3 | public class Quint implements Easing { 4 | 5 | @Override 6 | public double easeOut( double t, double b, double c, double d ) { 7 | return c * ( ( t = t / d - 1 ) * t * t * t * t + 1 ) + b; 8 | } 9 | 10 | @Override 11 | public double easeIn( double t, double b, double c, double d ) { 12 | return c * ( t /= d ) * t * t * t * t + b; 13 | } 14 | 15 | @Override 16 | public double easeInOut( double t, double b, double c, double d ) { 17 | if ( ( t /= d / 2 ) < 1 ) return c / 2 * t * t * t * t * t + b; 18 | return c / 2 * ( ( t -= 2 ) * t * t * t * t + 2 ) + b; 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /ImageViewTouch/src/main/java/com/imagezoom/easing/Sine.java: -------------------------------------------------------------------------------- 1 | package com.imagezoom.easing; 2 | 3 | public class Sine implements Easing { 4 | 5 | @Override 6 | public double easeOut( double t, double b, double c, double d ) { 7 | return c * Math.sin( t / d * ( Math.PI / 2 ) ) + b; 8 | } 9 | 10 | @Override 11 | public double easeIn( double t, double b, double c, double d ) { 12 | return -c * Math.cos( t / d * ( Math.PI / 2 ) ) + c + b; 13 | } 14 | 15 | @Override 16 | public double easeInOut( double t, double b, double c, double d ) { 17 | return -c / 2 * ( Math.cos( Math.PI * t / d ) - 1 ) + b; 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /ImageViewTouch/src/main/java/com/imagezoom/graphics/FastBitmapDrawable.java: -------------------------------------------------------------------------------- 1 | package com.imagezoom.graphics; 2 | 3 | import android.content.res.Resources; 4 | import android.graphics.Bitmap; 5 | import android.graphics.BitmapFactory; 6 | import android.graphics.Canvas; 7 | import android.graphics.ColorFilter; 8 | import android.graphics.Paint; 9 | import android.graphics.PixelFormat; 10 | import android.graphics.drawable.Drawable; 11 | 12 | import java.io.InputStream; 13 | 14 | /** 15 | * Fast bitmap drawable. Does not support states. it only 16 | * support alpha and colormatrix 17 | * @author alessandro 18 | * 19 | */ 20 | public class FastBitmapDrawable extends Drawable implements IBitmapDrawable { 21 | 22 | protected Bitmap mBitmap; 23 | protected Paint mPaint; 24 | 25 | public FastBitmapDrawable( Bitmap b ) { 26 | mBitmap = b; 27 | mPaint = new Paint(); 28 | mPaint.setDither( true ); 29 | mPaint.setFilterBitmap( true ); 30 | } 31 | 32 | public FastBitmapDrawable( Resources res, InputStream is ){ 33 | this(BitmapFactory.decodeStream(is)); 34 | } 35 | 36 | @Override 37 | public void draw( Canvas canvas ) { 38 | canvas.drawBitmap( mBitmap, 0.0f, 0.0f, mPaint ); 39 | } 40 | 41 | @Override 42 | public int getOpacity() { 43 | return PixelFormat.TRANSLUCENT; 44 | } 45 | 46 | @Override 47 | public void setAlpha( int alpha ) { 48 | mPaint.setAlpha( alpha ); 49 | } 50 | 51 | @Override 52 | public void setColorFilter( ColorFilter cf ) { 53 | mPaint.setColorFilter( cf ); 54 | } 55 | 56 | @Override 57 | public int getIntrinsicWidth() { 58 | return mBitmap.getWidth(); 59 | } 60 | 61 | @Override 62 | public int getIntrinsicHeight() { 63 | return mBitmap.getHeight(); 64 | } 65 | 66 | @Override 67 | public int getMinimumWidth() { 68 | return mBitmap.getWidth(); 69 | } 70 | 71 | @Override 72 | public int getMinimumHeight() { 73 | return mBitmap.getHeight(); 74 | } 75 | 76 | public void setAntiAlias( boolean value ){ 77 | mPaint.setAntiAlias( value ); 78 | invalidateSelf(); 79 | } 80 | 81 | @Override 82 | public Bitmap getBitmap() { 83 | return mBitmap; 84 | } 85 | } -------------------------------------------------------------------------------- /ImageViewTouch/src/main/java/com/imagezoom/graphics/IBitmapDrawable.java: -------------------------------------------------------------------------------- 1 | package com.imagezoom.graphics; 2 | 3 | import android.graphics.Bitmap; 4 | 5 | import com.imagezoom.ImageViewTouchBase; 6 | 7 | /** 8 | * Base interface used in the {@link ImageViewTouchBase} view 9 | * @author alessandro 10 | * 11 | */ 12 | public interface IBitmapDrawable { 13 | 14 | Bitmap getBitmap(); 15 | } 16 | -------------------------------------------------------------------------------- /ImageViewTouch/src/main/java/com/imagezoom/utils/IDisposable.java: -------------------------------------------------------------------------------- 1 | package com.imagezoom.utils; 2 | 3 | public interface IDisposable { 4 | 5 | void dispose(); 6 | } 7 | -------------------------------------------------------------------------------- /ImageViewTouch/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | ImageViewTouch 3 | 4 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | apply plugin: 'me.tatarka.retrolambda' 3 | 4 | android { 5 | compileSdkVersion 22 6 | buildToolsVersion "22.0.1" 7 | 8 | defaultConfig { 9 | applicationId "com.github.skykai.stickercamera" 10 | minSdkVersion 15 11 | targetSdkVersion 22 12 | versionCode 1 13 | versionName "1.0" 14 | } 15 | buildTypes { 16 | release { 17 | minifyEnabled false 18 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 19 | } 20 | } 21 | 22 | compileOptions { 23 | sourceCompatibility JavaVersion.VERSION_1_8 24 | targetCompatibility JavaVersion.VERSION_1_8 25 | } 26 | } 27 | 28 | dependencies { 29 | compile fileTree(dir: 'libs', include: ['*.jar']) 30 | compile 'com.android.support:appcompat-v7:22.2.0' 31 | compile 'com.android.support:recyclerview-v7:22.2.0' 32 | compile 'com.android.support:cardview-v7:22.2.0' 33 | compile 'com.jakewharton:butterknife:6.1.0' 34 | compile 'com.readystatesoftware.systembartint:systembartint:1.0.3' 35 | compile 'com.melnykov:floatingactionbutton:1.3.0' 36 | compile 'com.rengwuxian.materialedittext:library:2.1.3' 37 | compile files('libs/fastjson-1.2.5.jar') 38 | compile files('universal-image-loader-1.9.4.jar') 39 | compile 'it.sephiroth.android.library.horizontallistview:hlistview:1.2.2' 40 | compile project(":Gpu-Image") 41 | compile project(":ImageViewTouch") 42 | compile 'de.greenrobot:eventbus:2.4.0' 43 | } 44 | -------------------------------------------------------------------------------- /app/libs/fastjson-1.2.5.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skykai521/StickerCamera/d0a9c4d3f0ea1acfe339128624ddcb28c4bf85df/app/libs/fastjson-1.2.5.jar -------------------------------------------------------------------------------- /app/libs/universal-image-loader-1.9.4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skykai521/StickerCamera/d0a9c4d3f0ea1acfe339128624ddcb28c4bf85df/app/libs/universal-image-loader-1.9.4.jar -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/sky/Library/Android/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/github/skykai/stickercamera/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.github.skykai.stickercamera; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 20 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 34 | 38 | 42 | 46 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /app/src/main/java/com/common/util/AppUtils.java: -------------------------------------------------------------------------------- 1 | package com.common.util; 2 | 3 | import java.util.List; 4 | 5 | import android.app.ActivityManager; 6 | import android.app.ActivityManager.RunningAppProcessInfo; 7 | import android.app.ActivityManager.RunningTaskInfo; 8 | import android.content.ComponentName; 9 | import android.content.Context; 10 | 11 | /** 12 | * AppUtils 13 | * 16 | * 17 | * @author Trinea 2014-5-07 18 | */ 19 | public class AppUtils { 20 | 21 | private AppUtils() { 22 | throw new AssertionError(); 23 | } 24 | 25 | /** 26 | * whether this process is named with processName 27 | * 28 | * @param context 29 | * @param processName 30 | * @return 37 | */ 38 | public static boolean isNamedProcess(Context context, String processName) { 39 | if (context == null) { 40 | return false; 41 | } 42 | 43 | int pid = android.os.Process.myPid(); 44 | ActivityManager manager = (ActivityManager)context.getSystemService(Context.ACTIVITY_SERVICE); 45 | List processInfoList = manager.getRunningAppProcesses(); 46 | if (ListUtils.isEmpty(processInfoList)) { 47 | return false; 48 | } 49 | 50 | for (RunningAppProcessInfo processInfo : processInfoList) { 51 | if (processInfo != null && processInfo.pid == pid 52 | && ObjectUtils.isEquals(processName, processInfo.processName)) { 53 | return true; 54 | } 55 | } 56 | return false; 57 | } 58 | 59 | /** 60 | * whether application is in background 61 | *
    62 | *
  • need use permission android.permission.GET_TASKS in Manifest.xml
  • 63 | *
64 | * 65 | * @param context 66 | * @return if application is in background return true, otherwise return false 67 | */ 68 | public static boolean isApplicationInBackground(Context context) { 69 | ActivityManager am = (ActivityManager)context.getSystemService(Context.ACTIVITY_SERVICE); 70 | List taskList = am.getRunningTasks(1); 71 | if (taskList != null && !taskList.isEmpty()) { 72 | ComponentName topActivity = taskList.get(0).topActivity; 73 | if (topActivity != null && !topActivity.getPackageName().equals(context.getPackageName())) { 74 | return true; 75 | } 76 | } 77 | return false; 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /app/src/main/java/com/common/util/CollectionUtils.java: -------------------------------------------------------------------------------- 1 | package com.common.util; 2 | 3 | import java.util.Collection; 4 | 5 | import android.text.TextUtils; 6 | 7 | /** 8 | * CollectionUtils 9 | * 10 | * @author Trinea 2012-7-22 11 | */ 12 | public class CollectionUtils { 13 | 14 | /** default join separator **/ 15 | public static final CharSequence DEFAULT_JOIN_SEPARATOR = ","; 16 | 17 | private CollectionUtils() { 18 | throw new AssertionError(); 19 | } 20 | 21 | /** 22 | * is null or its size is 0 23 | * 24 | *
25 |      * isEmpty(null)   =   true;
26 |      * isEmpty({})     =   true;
27 |      * isEmpty({1})    =   false;
28 |      * 
29 | * 30 | * @param 31 | * @param c 32 | * @return if collection is null or its size is 0, return true, else return false. 33 | */ 34 | public static boolean isEmpty(Collection c) { 35 | return (c == null || c.size() == 0); 36 | } 37 | 38 | /** 39 | * join collection to string, separator is {@link #DEFAULT_JOIN_SEPARATOR} 40 | * 41 | *
42 |      * join(null)      =   "";
43 |      * join({})        =   "";
44 |      * join({a,b})     =   "a,b";
45 |      * 
46 | * 47 | * @param collection 48 | * @return join collection to string, separator is {@link #DEFAULT_JOIN_SEPARATOR}. if collection is empty, return 49 | * "" 50 | */ 51 | public static String join(Iterable collection) { 52 | return collection == null ? "" : TextUtils.join(DEFAULT_JOIN_SEPARATOR, collection); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /app/src/main/java/com/common/util/DistanceUtil.java: -------------------------------------------------------------------------------- 1 | package com.common.util; 2 | 3 | import com.stickercamera.App; 4 | 5 | public class DistanceUtil { 6 | 7 | public static int getCameraAlbumWidth() { 8 | return (App.getApp().getScreenWidth() - App.getApp().dp2px(10)) / 4 - App.getApp().dp2px(4); 9 | } 10 | 11 | // 相机照片列表高度计算 12 | public static int getCameraPhotoAreaHeight() { 13 | return getCameraPhotoWidth() + App.getApp().dp2px(4); 14 | } 15 | 16 | public static int getCameraPhotoWidth() { 17 | return App.getApp().getScreenWidth() / 4 - App.getApp().dp2px(2); 18 | } 19 | 20 | //活动标签页grid图片高度 21 | public static int getActivityHeight() { 22 | return (App.getApp().getScreenWidth() - App.getApp().dp2px(24)) / 3; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /app/src/main/java/com/common/util/IOUtil.java: -------------------------------------------------------------------------------- 1 | package com.common.util; 2 | 3 | import java.io.BufferedReader; 4 | import java.io.ByteArrayOutputStream; 5 | import java.io.Closeable; 6 | import java.io.IOException; 7 | import java.io.InputStream; 8 | import java.io.InputStreamReader; 9 | 10 | /** 11 | * IO工具 12 | */ 13 | public class IOUtil { 14 | /** 15 | * 把流读成字符串 16 | * 17 | * @param is 18 | * 输入流 19 | * @return 字符串 20 | */ 21 | public static String convertStreamToString(InputStream is) { 22 | BufferedReader reader = new BufferedReader(new InputStreamReader(is)); 23 | StringBuilder sb = new StringBuilder(); 24 | String line = null; 25 | try { 26 | while ((line = reader.readLine()) != null) { 27 | sb.append(line); 28 | } 29 | } catch (IOException e) { 30 | 31 | } finally { 32 | try { 33 | is.close(); 34 | } catch (IOException e) { 35 | 36 | } 37 | } 38 | return sb.toString(); 39 | } 40 | 41 | /** 42 | * 关闭流 43 | * 44 | * @param stream 45 | * 可关闭的流 46 | */ 47 | public static void closeStream(Closeable stream) { 48 | try { 49 | if (stream != null) 50 | stream.close(); 51 | } catch (IOException e) { 52 | 53 | } 54 | } 55 | 56 | public static byte[] InputStreamToByte(InputStream is) throws IOException { 57 | 58 | ByteArrayOutputStream bytestream = new ByteArrayOutputStream(); 59 | int ch; 60 | while ((ch = is.read()) != -1) { 61 | bytestream.write(ch); 62 | } 63 | byte byteData[] = bytestream.toByteArray(); 64 | bytestream.close(); 65 | return byteData; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /app/src/main/java/com/common/util/ImageLoaderUtils.java: -------------------------------------------------------------------------------- 1 | package com.common.util; 2 | 3 | import android.widget.ImageView; 4 | 5 | import com.nostra13.universalimageloader.core.DisplayImageOptions; 6 | import com.nostra13.universalimageloader.core.ImageLoader; 7 | import com.nostra13.universalimageloader.core.imageaware.ImageViewAware; 8 | 9 | /** 10 | * UIL 工具类 11 | * Created by sky on 15/7/26. 12 | */ 13 | public class ImageLoaderUtils { 14 | 15 | /** 16 | * display local image 17 | * @param uri 18 | * @param imageView 19 | * @param options 20 | */ 21 | public static void displayLocalImage(String uri, ImageView imageView, DisplayImageOptions options) { 22 | ImageLoader.getInstance().displayImage("file://" + uri, new ImageViewAware(imageView), options, null, null); 23 | } 24 | 25 | /** 26 | * display Drawable image 27 | * @param uri 28 | * @param imageView 29 | * @param options 30 | */ 31 | public static void displayDrawableImage(String uri, ImageView imageView, DisplayImageOptions options) { 32 | ImageLoader.getInstance().displayImage("drawable://" + uri, new ImageViewAware(imageView), options, null, null); 33 | } 34 | 35 | 36 | 37 | } 38 | -------------------------------------------------------------------------------- /app/src/main/java/com/common/util/MD5Util.java: -------------------------------------------------------------------------------- 1 | 2 | package com.common.util; 3 | 4 | import java.security.MessageDigest; 5 | import java.security.NoSuchAlgorithmException; 6 | 7 | public class MD5Util { 8 | 9 | /** 10 | * MD5加密 11 | * 12 | * @param val 13 | * @return 14 | * @throws NoSuchAlgorithmException 15 | */ 16 | public static String getMD5(String val) { 17 | MessageDigest md5; 18 | try { 19 | md5 = MessageDigest.getInstance("MD5"); 20 | md5.update(val.getBytes()); 21 | byte[] m = md5.digest();// 加密 22 | return getString(m); 23 | } catch (NoSuchAlgorithmException e) { 24 | return val; 25 | } 26 | 27 | } 28 | 29 | private static String getString(byte[] b) { 30 | StringBuffer sb = new StringBuffer(); 31 | for (int i = 0; i < b.length; i++) { 32 | sb.append(b[i]); 33 | } 34 | return sb.toString(); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /app/src/main/java/com/common/util/SystemUtils.java: -------------------------------------------------------------------------------- 1 | package com.common.util; 2 | 3 | /** 4 | * SystemUtils 5 | * 6 | * @author Trinea 2013-5-15 7 | */ 8 | public class SystemUtils { 9 | 10 | /** recommend default thread pool size according to system available processors, {@link #getDefaultThreadPoolSize()} **/ 11 | public static final int DEFAULT_THREAD_POOL_SIZE = getDefaultThreadPoolSize(); 12 | 13 | private SystemUtils() { 14 | throw new AssertionError(); 15 | } 16 | 17 | /** 18 | * get recommend default thread pool size 19 | * 20 | * @return if 2 * availableProcessors + 1 less than 8, return it, else return 8; 21 | * @see {@link #getDefaultThreadPoolSize(int)} max is 8 22 | */ 23 | public static int getDefaultThreadPoolSize() { 24 | return getDefaultThreadPoolSize(8); 25 | } 26 | 27 | /** 28 | * get recommend default thread pool size 29 | * 30 | * @param max 31 | * @return if 2 * availableProcessors + 1 less than max, return it, else return max; 32 | */ 33 | public static int getDefaultThreadPoolSize(int max) { 34 | int availableProcessors = 2 * Runtime.getRuntime().availableProcessors() + 1; 35 | return availableProcessors > max ? max : availableProcessors; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /app/src/main/java/com/common/util/TimeUtils.java: -------------------------------------------------------------------------------- 1 | package com.common.util; 2 | 3 | import java.text.DateFormat; 4 | import java.text.SimpleDateFormat; 5 | import java.util.Date; 6 | 7 | /** 8 | * TimeUtils 9 | * 10 | * @author Trinea 2013-8-24 11 | */ 12 | public class TimeUtils { 13 | 14 | public static final SimpleDateFormat DEFAULT_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 15 | public static final SimpleDateFormat DATE_FORMAT_DATE = new SimpleDateFormat("yyyy-MM-dd"); 16 | 17 | private TimeUtils() { 18 | throw new AssertionError(); 19 | } 20 | 21 | /** 22 | * long time to string 23 | * 24 | * @param timeInMillis 25 | * @param dateFormat 26 | * @return 27 | */ 28 | public static String getTime(long timeInMillis, SimpleDateFormat dateFormat) { 29 | return dateFormat.format(new Date(timeInMillis)); 30 | } 31 | 32 | public static String dtFormat(Date date, String dateFormat){ 33 | return getFormat(dateFormat).format(date); 34 | } 35 | 36 | private static final DateFormat getFormat(String format) { 37 | return new SimpleDateFormat(format); 38 | } 39 | 40 | /** 41 | * long time to string, format is {@link #DEFAULT_DATE_FORMAT} 42 | * 43 | * @param timeInMillis 44 | * @return 45 | */ 46 | public static String getTime(long timeInMillis) { 47 | return getTime(timeInMillis, DEFAULT_DATE_FORMAT); 48 | } 49 | 50 | /** 51 | * get current time in milliseconds 52 | * 53 | * @return 54 | */ 55 | public static long getCurrentTimeInLong() { 56 | return System.currentTimeMillis(); 57 | } 58 | 59 | /** 60 | * get current time in milliseconds, format is {@link #DEFAULT_DATE_FORMAT} 61 | * 62 | * @return 63 | */ 64 | public static String getCurrentTimeInString() { 65 | return getTime(getCurrentTimeInLong()); 66 | } 67 | 68 | /** 69 | * get current time in milliseconds 70 | * 71 | * @return 72 | */ 73 | public static String getCurrentTimeInString(SimpleDateFormat dateFormat) { 74 | return getTime(getCurrentTimeInLong(), dateFormat); 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /app/src/main/java/com/customview/CameraGrid.java: -------------------------------------------------------------------------------- 1 | package com.customview; 2 | 3 | import android.content.Context; 4 | import android.graphics.Canvas; 5 | import android.graphics.Color; 6 | import android.graphics.Paint; 7 | import android.util.AttributeSet; 8 | import android.view.View; 9 | 10 | /** 11 | * 照相机井字线 12 | * Created by sky on 2015/7/7. 13 | */ 14 | public class CameraGrid extends View { 15 | 16 | private int topBannerWidth = 0; 17 | private Paint mPaint; 18 | 19 | public CameraGrid(Context context) { 20 | this(context,null); 21 | } 22 | 23 | public CameraGrid(Context context, AttributeSet attrs) { 24 | super(context, attrs); 25 | init(); 26 | } 27 | 28 | private void init(){ 29 | mPaint = new Paint(); 30 | mPaint.setColor(Color.WHITE); 31 | mPaint.setAlpha(120); 32 | mPaint.setStrokeWidth(1f); 33 | } 34 | 35 | 36 | //画一个井字,上下画两条灰边,中间为正方形 37 | @Override 38 | protected void onDraw(Canvas canvas) { 39 | super.onDraw(canvas); 40 | int width = this.getWidth(); 41 | int height = this.getHeight(); 42 | if (width < height) { 43 | topBannerWidth = height - width; 44 | } 45 | if (showGrid) { 46 | canvas.drawLine(width / 3, 0, width / 3, height, mPaint); 47 | canvas.drawLine(width * 2 / 3, 0, width * 2 / 3, height, mPaint); 48 | canvas.drawLine(0, height / 3, width, height / 3, mPaint); 49 | canvas.drawLine(0, height * 2 / 3, width, height * 2 / 3, mPaint); 50 | } 51 | } 52 | 53 | private boolean showGrid = true; 54 | 55 | public boolean isShowGrid() { 56 | return showGrid; 57 | } 58 | 59 | public void setShowGrid(boolean showGrid) { 60 | this.showGrid = showGrid; 61 | } 62 | 63 | public int getTopWidth() { 64 | return topBannerWidth; 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /app/src/main/java/com/customview/GlobalLimitClickOnClickListener.java: -------------------------------------------------------------------------------- 1 | package com.customview; 2 | 3 | import android.view.View; 4 | import android.view.View.OnClickListener; 5 | 6 | 7 | /** 8 | * 全局拒绝频繁点击代理Listener 9 | * 10 | * @author tongqian.ni 11 | */ 12 | public class GlobalLimitClickOnClickListener implements OnClickListener { 13 | 14 | // 全局防频繁点击 15 | private static long lastClick; 16 | 17 | private OnClickListener listener; 18 | 19 | private long intervalClick; 20 | 21 | public GlobalLimitClickOnClickListener(OnClickListener listener, long intervalClick) { 22 | this.intervalClick = intervalClick; 23 | this.listener = listener; 24 | } 25 | 26 | @Override 27 | public void onClick(View v) { 28 | if (System.currentTimeMillis() > lastClick 29 | && System.currentTimeMillis() - lastClick <= intervalClick) { 30 | return; 31 | } 32 | listener.onClick(v); 33 | lastClick = System.currentTimeMillis(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /app/src/main/java/com/customview/LabelSelector.java: -------------------------------------------------------------------------------- 1 | package com.customview; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | import android.view.LayoutInflater; 6 | import android.view.MotionEvent; 7 | import android.view.View; 8 | import android.widget.ImageView; 9 | import android.widget.LinearLayout; 10 | 11 | import com.github.skykai.stickercamera.R; 12 | 13 | 14 | /** 15 | * @author tongqian.ni 16 | * 17 | */ 18 | public class LabelSelector extends LinearLayout { 19 | 20 | private ImageView txtLabelBtn; 21 | private ImageView addrLabelBtn; 22 | 23 | public LabelSelector(Context context) { 24 | this(context,null); 25 | } 26 | 27 | public LabelSelector(Context context, AttributeSet attr) { 28 | super(context, attr); 29 | LayoutInflater.from(context).inflate(R.layout.view_label_layout, this); 30 | txtLabelBtn = (ImageView) findViewById(R.id.iv_tag_tip); 31 | addrLabelBtn = (ImageView) findViewById(R.id.iv_tag_address); 32 | } 33 | 34 | public void setTxtClicked(OnClickListener listener) { 35 | txtLabelBtn.setOnClickListener(listener); 36 | } 37 | 38 | public void setAddrClicked(OnClickListener listener) { 39 | addrLabelBtn.setOnClickListener(listener); 40 | } 41 | 42 | public float getmLastTouchX() { 43 | return mLastTouchX; 44 | } 45 | 46 | public float getmLastTouchY() { 47 | return mLastTouchY; 48 | } 49 | 50 | private float mLastTouchX = -1; 51 | private float mLastTouchY = -1; 52 | 53 | @Override 54 | public boolean onTouchEvent(MotionEvent event) { 55 | switch (event.getAction()) { 56 | case MotionEvent.ACTION_UP:// 手指离开时 57 | case MotionEvent.ACTION_CANCEL: 58 | mLastTouchX = event.getX(); 59 | mLastTouchY = event.getY(); 60 | break; 61 | default: 62 | break; 63 | } 64 | return super.onTouchEvent(event); 65 | } 66 | 67 | public void showToTop() { 68 | setVisibility(View.VISIBLE); 69 | bringToFront(); 70 | } 71 | 72 | public void hide() { 73 | setVisibility(View.GONE); 74 | } 75 | 76 | } 77 | -------------------------------------------------------------------------------- /app/src/main/java/com/customview/drawable/EditableDrawable.java: -------------------------------------------------------------------------------- 1 | package com.customview.drawable; 2 | 3 | import android.graphics.Paint; 4 | 5 | public interface EditableDrawable { 6 | public static final int CURSOR_BLINK_TIME = 400; 7 | 8 | public void setOnSizeChangeListener(OnSizeChange paramOnSizeChange); 9 | 10 | public void beginEdit(); 11 | 12 | public void endEdit(); 13 | 14 | public boolean isEditing(); 15 | 16 | public CharSequence getText(); 17 | 18 | public void setText(CharSequence paramCharSequence); 19 | 20 | public void setText(String paramString); 21 | 22 | public void setTextHint(CharSequence paramCharSequence); 23 | 24 | public void setTextHint(String paramString); 25 | 26 | public boolean isTextHint(); 27 | 28 | public void setBounds(float paramFloat1, float paramFloat2, float paramFloat3, float paramFloat4); 29 | 30 | public void setTextColor(int paramInt); 31 | 32 | public int getTextColor(); 33 | 34 | public float getTextSize(); 35 | 36 | public float getFontMetrics(Paint.FontMetrics paramFontMetrics); 37 | 38 | public void setTextStrokeColor(int paramInt); 39 | 40 | public int getTextStrokeColor(); 41 | 42 | public void setStrokeEnabled(boolean paramBoolean); 43 | 44 | public boolean getStrokeEnabled(); 45 | 46 | public int getNumLines(); 47 | 48 | public static interface OnSizeChange { 49 | public void onSizeChanged(EditableDrawable paramEditableDrawable, float paramFloat1, 50 | float paramFloat2, float paramFloat3, float paramFloat4); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /app/src/main/java/com/customview/drawable/FeatherDrawable.java: -------------------------------------------------------------------------------- 1 | package com.customview.drawable; 2 | 3 | import android.graphics.Canvas; 4 | import android.graphics.ColorFilter; 5 | import android.graphics.PorterDuff; 6 | import android.graphics.Rect; 7 | import android.graphics.RectF; 8 | import android.graphics.Region; 9 | import android.graphics.drawable.Drawable; 10 | 11 | public interface FeatherDrawable { 12 | public void setMinSize(float paramFloat1, float paramFloat2); 13 | 14 | public float getMinWidth(); 15 | 16 | public float getMinHeight(); 17 | 18 | public boolean validateSize(RectF paramRectF); 19 | 20 | public void draw(Canvas paramCanvas); 21 | 22 | public void setBounds(int paramInt1, int paramInt2, int paramInt3, int paramInt4); 23 | 24 | public void setBounds(Rect paramRect); 25 | 26 | public void copyBounds(Rect paramRect); 27 | 28 | public Rect copyBounds(); 29 | 30 | public Rect getBounds(); 31 | 32 | public void setChangingConfigurations(int paramInt); 33 | 34 | public int getChangingConfigurations(); 35 | 36 | public void setDither(boolean paramBoolean); 37 | 38 | public void setFilterBitmap(boolean paramBoolean); 39 | 40 | public void setCallback(Drawable.Callback paramCallback); 41 | 42 | public void invalidateSelf(); 43 | 44 | public void scheduleSelf(Runnable paramRunnable, long paramLong); 45 | 46 | public void unscheduleSelf(Runnable paramRunnable); 47 | 48 | public void setAlpha(int paramInt); 49 | 50 | public void setColorFilter(ColorFilter paramColorFilter); 51 | 52 | public void setColorFilter(int paramInt, PorterDuff.Mode paramMode); 53 | 54 | public void clearColorFilter(); 55 | 56 | public boolean isStateful(); 57 | 58 | public boolean setState(int[] paramArrayOfInt); 59 | 60 | public int[] getState(); 61 | 62 | public Drawable getCurrent(); 63 | 64 | public boolean setLevel(int paramInt); 65 | 66 | public int getLevel(); 67 | 68 | public boolean setVisible(boolean paramBoolean1, boolean paramBoolean2); 69 | 70 | public boolean isVisible(); 71 | 72 | public int getOpacity(); 73 | 74 | public Region getTransparentRegion(); 75 | 76 | public float getCurrentWidth(); 77 | 78 | public float getCurrentHeight(); 79 | 80 | public int getMinimumWidth(); 81 | 82 | public int getMinimumHeight(); 83 | 84 | public boolean getPadding(Rect paramRect); 85 | 86 | public Drawable mutate(); 87 | } -------------------------------------------------------------------------------- /app/src/main/java/com/customview/drawable/StickerDrawable.java: -------------------------------------------------------------------------------- 1 | package com.customview.drawable; 2 | 3 | import android.content.res.Resources; 4 | import android.graphics.Bitmap; 5 | import android.graphics.BlurMaskFilter; 6 | import android.graphics.Canvas; 7 | import android.graphics.Paint; 8 | import android.graphics.Rect; 9 | import android.graphics.RectF; 10 | import android.graphics.drawable.BitmapDrawable; 11 | 12 | public class StickerDrawable extends BitmapDrawable implements FeatherDrawable { 13 | private float minWidth = 0.0F; 14 | private float minHeight = 0.0F; 15 | BlurMaskFilter mBlurFilter; 16 | Paint mShadowPaint; 17 | Bitmap mShadowBitmap; 18 | boolean mDrawShadow = true; 19 | Rect mTempRect = new Rect(); 20 | 21 | public StickerDrawable(Resources resources, Bitmap bitmap) { 22 | super(resources, bitmap); 23 | 24 | this.mBlurFilter = new BlurMaskFilter(5.0F, BlurMaskFilter.Blur.OUTER); 25 | this.mShadowPaint = new Paint(1); 26 | this.mShadowPaint.setMaskFilter(this.mBlurFilter); 27 | 28 | int[] offsetXY = new int[2]; 29 | this.mShadowBitmap = getBitmap().extractAlpha(this.mShadowPaint, offsetXY); 30 | } 31 | 32 | public int getBitmapWidth() { 33 | return getBitmap().getWidth(); 34 | } 35 | 36 | public int getBitmapHeight() { 37 | return getBitmap().getHeight(); 38 | } 39 | 40 | public void draw(Canvas canvas) { 41 | if (this.mDrawShadow) { 42 | copyBounds(this.mTempRect); 43 | canvas.drawBitmap(this.mShadowBitmap, null, this.mTempRect, null); 44 | } 45 | super.draw(canvas); 46 | } 47 | 48 | public void setDropShadow(boolean value) { 49 | this.mDrawShadow = value; 50 | invalidateSelf(); 51 | } 52 | 53 | public boolean validateSize(RectF rect) { 54 | return (rect.width() >= this.minWidth) && (rect.height() >= this.minHeight); 55 | } 56 | 57 | public void setMinSize(float w, float h) { 58 | this.minWidth = w; 59 | this.minHeight = h; 60 | } 61 | 62 | public float getMinWidth() { 63 | return this.minWidth; 64 | } 65 | 66 | public float getMinHeight() { 67 | return this.minHeight; 68 | } 69 | 70 | public float getCurrentWidth() { 71 | return getIntrinsicWidth(); 72 | } 73 | 74 | public float getCurrentHeight() { 75 | return getIntrinsicHeight(); 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /app/src/main/java/com/stickercamera/AppConstants.java: -------------------------------------------------------------------------------- 1 | package com.stickercamera; 2 | 3 | import android.os.Environment; 4 | 5 | /** 6 | * Created by sky on 2015/7/6. 7 | */ 8 | public class AppConstants { 9 | 10 | public static final String APP_DIR = Environment.getExternalStorageDirectory() + "/StickerCamera"; 11 | public static final String APP_TEMP = APP_DIR + "/temp"; 12 | public static final String APP_IMAGE = APP_DIR + "/image"; 13 | 14 | public static final int POST_TYPE_POI = 1; 15 | public static final int POST_TYPE_TAG = 0; 16 | public static final int POST_TYPE_DEFAULT = 0; 17 | 18 | 19 | public static final float DEFAULT_PIXEL = 1242; //按iphone6设置 20 | public static final String PARAM_MAX_SIZE = "PARAM_MAX_SIZE"; 21 | public static final String PARAM_EDIT_TEXT = "PARAM_EDIT_TEXT"; 22 | public static final int ACTION_EDIT_LABEL = 8080; 23 | public static final int ACTION_EDIT_LABEL_POI = 9090; 24 | 25 | public static final String FEED_INFO = "FEED_INFO"; 26 | 27 | 28 | public static final int REQUEST_CROP = 6709; 29 | public static final int REQUEST_PICK = 9162; 30 | public static final int RESULT_ERROR = 404; 31 | 32 | } 33 | -------------------------------------------------------------------------------- /app/src/main/java/com/stickercamera/app/camera/CameraBaseActivity.java: -------------------------------------------------------------------------------- 1 | package com.stickercamera.app.camera; 2 | 3 | import android.os.Bundle; 4 | 5 | import com.stickercamera.base.BaseActivity; 6 | 7 | 8 | public class CameraBaseActivity extends BaseActivity { 9 | 10 | @Override 11 | protected void onCreate(Bundle savedInstanceState) { 12 | super.onCreate(savedInstanceState); 13 | CameraManager.getInst().addActivity(this); 14 | } 15 | 16 | @Override 17 | protected void onDestroy() { 18 | super.onDestroy(); 19 | CameraManager.getInst().removeActivity(this); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /app/src/main/java/com/stickercamera/app/camera/CameraBaseFragmentActivity.java: -------------------------------------------------------------------------------- 1 | package com.stickercamera.app.camera; 2 | 3 | import android.os.Bundle; 4 | 5 | import com.stickercamera.base.BaseFragmentActivity; 6 | 7 | 8 | public class CameraBaseFragmentActivity extends BaseFragmentActivity { 9 | 10 | @Override 11 | protected void onCreate(Bundle savedInstanceState) { 12 | super.onCreate(savedInstanceState); 13 | CameraManager.getInst().addActivity(this); 14 | } 15 | 16 | @Override 17 | protected void onDestroy() { 18 | super.onDestroy(); 19 | CameraManager.getInst().removeActivity(this); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /app/src/main/java/com/stickercamera/app/camera/CameraManager.java: -------------------------------------------------------------------------------- 1 | package com.stickercamera.app.camera; 2 | 3 | import android.app.Activity; 4 | import android.content.Context; 5 | import android.content.Intent; 6 | import android.net.Uri; 7 | 8 | import com.common.util.ImageUtils; 9 | import com.stickercamera.AppConstants; 10 | import com.stickercamera.app.camera.ui.CameraActivity; 11 | import com.stickercamera.app.camera.ui.CropPhotoActivity; 12 | import com.stickercamera.app.camera.ui.PhotoProcessActivity; 13 | import com.stickercamera.app.model.PhotoItem; 14 | 15 | import java.util.Stack; 16 | 17 | /** 18 | * 相机管理类 19 | * Created by sky on 15/7/6. 20 | * Weibo: http://weibo.com/2030683111 21 | * Email: 1132234509@qq.com 22 | */ 23 | public class CameraManager { 24 | 25 | private static CameraManager mInstance; 26 | private Stack cameras = new Stack(); 27 | 28 | public static CameraManager getInst() { 29 | if (mInstance == null) { 30 | synchronized (CameraManager.class) { 31 | if (mInstance == null) 32 | mInstance = new CameraManager(); 33 | } 34 | } 35 | return mInstance; 36 | } 37 | 38 | //打开照相界面 39 | public void openCamera(Context context) { 40 | Intent intent = new Intent(context, CameraActivity.class); 41 | context.startActivity(intent); 42 | } 43 | 44 | //判断图片是否需要裁剪 45 | public void processPhotoItem(Activity activity, PhotoItem photo) { 46 | Uri uri = photo.getImageUri().startsWith("file:") ? Uri.parse(photo 47 | .getImageUri()) : Uri.parse("file://" + photo.getImageUri()); 48 | if (ImageUtils.isSquare(photo.getImageUri())) { 49 | Intent newIntent = new Intent(activity, PhotoProcessActivity.class); 50 | newIntent.setData(uri); 51 | activity.startActivity(newIntent); 52 | } else { 53 | Intent i = new Intent(activity, CropPhotoActivity.class); 54 | i.setData(uri); 55 | //TODO稍后添加 56 | activity.startActivityForResult(i, AppConstants.REQUEST_CROP); 57 | } 58 | } 59 | 60 | public void close() { 61 | for (Activity act : cameras) { 62 | try { 63 | act.finish(); 64 | } catch (Exception e) { 65 | 66 | } 67 | } 68 | cameras.clear(); 69 | } 70 | 71 | public void addActivity(Activity act) { 72 | cameras.add(act); 73 | } 74 | 75 | public void removeActivity(Activity act) { 76 | cameras.remove(act); 77 | } 78 | 79 | 80 | 81 | } 82 | -------------------------------------------------------------------------------- /app/src/main/java/com/stickercamera/app/camera/EffectService.java: -------------------------------------------------------------------------------- 1 | package com.stickercamera.app.camera; 2 | 3 | import com.stickercamera.app.camera.effect.FilterEffect; 4 | import com.stickercamera.app.camera.util.GPUImageFilterTools; 5 | 6 | import java.util.ArrayList; 7 | import java.util.List; 8 | 9 | 10 | public class EffectService { 11 | 12 | private static EffectService mInstance; 13 | 14 | public static EffectService getInst() { 15 | if (mInstance == null) { 16 | synchronized (EffectService.class) { 17 | if (mInstance == null) 18 | mInstance = new EffectService(); 19 | } 20 | } 21 | return mInstance; 22 | } 23 | 24 | private EffectService() { 25 | } 26 | 27 | public List getLocalFilters() { 28 | List filters = new ArrayList(); 29 | filters.add(new FilterEffect("原始", GPUImageFilterTools.FilterType.NORMAL, 0)); 30 | 31 | filters.add(new FilterEffect("暧昧", GPUImageFilterTools.FilterType.ACV_AIMEI, 0)); 32 | filters.add(new FilterEffect("淡蓝", GPUImageFilterTools.FilterType.ACV_DANLAN, 0)); 33 | filters.add(new FilterEffect("蛋黄", GPUImageFilterTools.FilterType.ACV_DANHUANG, 0)); 34 | filters.add(new FilterEffect("复古", GPUImageFilterTools.FilterType.ACV_FUGU, 0)); 35 | filters.add(new FilterEffect("高冷", GPUImageFilterTools.FilterType.ACV_GAOLENG, 0)); 36 | filters.add(new FilterEffect("怀旧", GPUImageFilterTools.FilterType.ACV_HUAIJIU, 0)); 37 | filters.add(new FilterEffect("胶片", GPUImageFilterTools.FilterType.ACV_JIAOPIAN, 0)); 38 | filters.add(new FilterEffect("可爱", GPUImageFilterTools.FilterType.ACV_KEAI, 0)); 39 | filters.add(new FilterEffect("落寞", GPUImageFilterTools.FilterType.ACV_LOMO, 0)); 40 | filters.add(new FilterEffect("加强", GPUImageFilterTools.FilterType.ACV_MORENJIAQIANG, 0)); 41 | filters.add(new FilterEffect("暖心", GPUImageFilterTools.FilterType.ACV_NUANXIN, 0)); 42 | filters.add(new FilterEffect("清新", GPUImageFilterTools.FilterType.ACV_QINGXIN, 0)); 43 | filters.add(new FilterEffect("日系", GPUImageFilterTools.FilterType.ACV_RIXI, 0)); 44 | filters.add(new FilterEffect("温暖", GPUImageFilterTools.FilterType.ACV_WENNUAN, 0)); 45 | 46 | return filters; 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /app/src/main/java/com/stickercamera/app/camera/adapter/FilterAdapter.java: -------------------------------------------------------------------------------- 1 | package com.stickercamera.app.camera.adapter; 2 | 3 | import android.content.Context; 4 | import android.graphics.Bitmap; 5 | import android.view.LayoutInflater; 6 | import android.view.View; 7 | import android.view.ViewGroup; 8 | import android.widget.BaseAdapter; 9 | import android.widget.TextView; 10 | 11 | 12 | import com.github.skykai.stickercamera.R; 13 | import com.stickercamera.app.camera.effect.FilterEffect; 14 | import com.stickercamera.app.camera.util.GPUImageFilterTools; 15 | 16 | import java.util.List; 17 | 18 | import jp.co.cyberagent.android.gpuimage.GPUImageFilter; 19 | import jp.co.cyberagent.android.gpuimage.GPUImageView; 20 | 21 | /** 22 | * @author tongqian.ni 23 | * 24 | */ 25 | public class FilterAdapter extends BaseAdapter { 26 | 27 | List filterUris; 28 | Context mContext; 29 | private Bitmap background; 30 | 31 | private int selectFilter = 0; 32 | 33 | public void setSelectFilter(int selectFilter) { 34 | this.selectFilter = selectFilter; 35 | } 36 | 37 | public int getSelectFilter() { 38 | return selectFilter; 39 | } 40 | 41 | public FilterAdapter(Context context, List effects, Bitmap backgroud) { 42 | filterUris = effects; 43 | mContext = context; 44 | this.background = backgroud; 45 | } 46 | 47 | @Override 48 | public int getCount() { 49 | return filterUris.size(); 50 | } 51 | 52 | @Override 53 | public Object getItem(int position) { 54 | return filterUris.get(position); 55 | } 56 | 57 | @Override 58 | public long getItemId(int position) { 59 | return position; 60 | } 61 | 62 | @Override 63 | public View getView(int position, View convertView, ViewGroup parent) { 64 | EffectHolder holder = null; 65 | if (convertView == null) { 66 | LayoutInflater layoutInflater = LayoutInflater.from(mContext); 67 | convertView = layoutInflater.inflate(R.layout.item_bottom_filter, null); 68 | holder = new EffectHolder(); 69 | holder.filteredImg = (GPUImageView) convertView.findViewById(R.id.small_filter); 70 | holder.filterName = (TextView) convertView.findViewById(R.id.filter_name); 71 | convertView.setTag(holder); 72 | } else { 73 | holder = (EffectHolder) convertView.getTag(); 74 | } 75 | 76 | final FilterEffect effect = (FilterEffect) getItem(position); 77 | 78 | holder.filteredImg.setImage(background); 79 | holder.filterName.setText(effect.getTitle()); 80 | //if (!effect.isOri() && effect.getType() != null) { 81 | GPUImageFilter filter = GPUImageFilterTools.createFilterForType(mContext, effect.getType()); 82 | holder.filteredImg.setFilter(filter); 83 | 84 | return convertView; 85 | } 86 | 87 | class EffectHolder { 88 | GPUImageView filteredImg; 89 | TextView filterName; 90 | } 91 | 92 | } 93 | -------------------------------------------------------------------------------- /app/src/main/java/com/stickercamera/app/camera/adapter/GalleryAdapter.java: -------------------------------------------------------------------------------- 1 | package com.stickercamera.app.camera.adapter; 2 | 3 | import android.content.Context; 4 | import android.view.LayoutInflater; 5 | import android.view.View; 6 | import android.view.ViewGroup; 7 | import android.widget.AbsListView; 8 | import android.widget.BaseAdapter; 9 | import android.widget.ImageView; 10 | 11 | import com.common.util.DistanceUtil; 12 | import com.common.util.ImageLoaderUtils; 13 | import com.github.skykai.stickercamera.R; 14 | import com.nostra13.universalimageloader.core.ImageLoader; 15 | import com.stickercamera.app.model.PhotoItem; 16 | 17 | import java.util.List; 18 | 19 | /** 20 | * @author tongqian.ni 21 | * 22 | */ 23 | public class GalleryAdapter extends BaseAdapter { 24 | 25 | private Context mContext; 26 | private List values; 27 | public static GalleryHolder holder; 28 | 29 | /** 30 | * @param albumActivity 31 | * @param values 32 | */ 33 | public GalleryAdapter(Context context, List values) { 34 | this.mContext = context; 35 | this.values = values; 36 | } 37 | 38 | @Override 39 | public int getCount() { 40 | return values.size(); 41 | } 42 | 43 | @Override 44 | public Object getItem(int position) { 45 | return values.get(position); 46 | } 47 | 48 | @Override 49 | public long getItemId(int position) { 50 | return position; 51 | } 52 | 53 | @Override 54 | public View getView(int position, View convertView, ViewGroup parent) { 55 | final GalleryHolder holder; 56 | int width = DistanceUtil.getCameraAlbumWidth(); 57 | if (convertView == null) { 58 | LayoutInflater layoutInflater = LayoutInflater.from(mContext); 59 | convertView = layoutInflater.inflate(R.layout.item_gallery, null); 60 | holder = new GalleryHolder(); 61 | holder.sample = (ImageView) convertView.findViewById(R.id.gallery_sample_image); 62 | holder.sample.setLayoutParams(new AbsListView.LayoutParams(width, width)); 63 | convertView.setTag(holder); 64 | } else { 65 | holder = (GalleryHolder) convertView.getTag(); 66 | } 67 | final PhotoItem gallery = (PhotoItem) getItem(position); 68 | 69 | ImageLoaderUtils.displayLocalImage(gallery.getImageUri(), holder.sample,null); 70 | 71 | return convertView; 72 | } 73 | 74 | class GalleryHolder { 75 | ImageView sample; 76 | } 77 | 78 | } 79 | -------------------------------------------------------------------------------- /app/src/main/java/com/stickercamera/app/camera/adapter/StickerToolAdapter.java: -------------------------------------------------------------------------------- 1 | package com.stickercamera.app.camera.adapter; 2 | 3 | import android.content.Context; 4 | import android.view.LayoutInflater; 5 | import android.view.View; 6 | import android.view.ViewGroup; 7 | import android.widget.BaseAdapter; 8 | import android.widget.ImageView; 9 | 10 | 11 | import com.common.util.ImageLoaderUtils; 12 | import com.github.skykai.stickercamera.R; 13 | import com.nostra13.universalimageloader.core.ImageLoader; 14 | import com.stickercamera.app.model.Addon; 15 | 16 | import java.util.List; 17 | 18 | /** 19 | * 20 | * 贴纸适配器 21 | * @author tongqian.ni 22 | */ 23 | public class StickerToolAdapter extends BaseAdapter { 24 | 25 | List filterUris; 26 | Context mContext; 27 | 28 | public StickerToolAdapter(Context context, List effects) { 29 | filterUris = effects; 30 | mContext = context; 31 | } 32 | 33 | @Override 34 | public int getCount() { 35 | return filterUris.size(); 36 | } 37 | 38 | @Override 39 | public Object getItem(int position) { 40 | return filterUris.get(position); 41 | } 42 | 43 | @Override 44 | public long getItemId(int position) { 45 | return position; 46 | } 47 | 48 | @Override 49 | public View getView(int position, View convertView, ViewGroup parent) { 50 | EffectHolder holder = null; 51 | if (convertView == null) { 52 | LayoutInflater layoutInflater = LayoutInflater.from(mContext); 53 | convertView = layoutInflater.inflate(R.layout.item_bottom_tool, null); 54 | holder = new EffectHolder(); 55 | holder.logo = (ImageView) convertView.findViewById(R.id.effect_image); 56 | holder.container = (ImageView) convertView.findViewById(R.id.effect_background); 57 | //holder.navImage.setOnClickListener(holder.clickListener); 58 | convertView.setTag(holder); 59 | } else { 60 | holder = (EffectHolder) convertView.getTag(); 61 | } 62 | 63 | final Addon effect = (Addon) getItem(position); 64 | 65 | return showItem(convertView, holder, effect); 66 | } 67 | 68 | private View showItem(View convertView, EffectHolder holder, final Addon sticker) { 69 | 70 | holder.container.setVisibility(View.GONE); 71 | ImageLoaderUtils.displayDrawableImage(sticker.getId() + "", holder.logo, null); 72 | 73 | return convertView; 74 | } 75 | 76 | class EffectHolder { 77 | ImageView logo; 78 | ImageView container; 79 | } 80 | 81 | } 82 | -------------------------------------------------------------------------------- /app/src/main/java/com/stickercamera/app/camera/effect/FilterEffect.java: -------------------------------------------------------------------------------- 1 | package com.stickercamera.app.camera.effect; 2 | 3 | 4 | import com.stickercamera.app.camera.util.GPUImageFilterTools; 5 | 6 | /** 7 | * @author tongqian.ni 8 | * 9 | */ 10 | public class FilterEffect { 11 | 12 | private String title; 13 | private GPUImageFilterTools.FilterType type; 14 | private int degree; 15 | 16 | /** 17 | * @param title 18 | * @param uri 19 | */ 20 | public FilterEffect(String title, GPUImageFilterTools.FilterType type, int degree) { 21 | this.type = type; 22 | this.degree = degree; 23 | this.title = title; 24 | } 25 | 26 | 27 | public GPUImageFilterTools.FilterType getType() { 28 | return type; 29 | } 30 | 31 | public String getTitle() { 32 | return title; 33 | } 34 | 35 | public int getDegree() { 36 | return degree; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /app/src/main/java/com/stickercamera/app/camera/fragment/AlbumFragment.java: -------------------------------------------------------------------------------- 1 | package com.stickercamera.app.camera.fragment; 2 | 3 | import android.os.Bundle; 4 | import android.support.v4.app.Fragment; 5 | import android.view.LayoutInflater; 6 | import android.view.View; 7 | import android.view.ViewGroup; 8 | import android.widget.AdapterView; 9 | import android.widget.AdapterView.OnItemClickListener; 10 | import android.widget.GridView; 11 | 12 | 13 | import com.github.skykai.stickercamera.R; 14 | import com.stickercamera.app.camera.CameraManager; 15 | import com.stickercamera.app.camera.adapter.GalleryAdapter; 16 | import com.stickercamera.app.model.PhotoItem; 17 | 18 | import java.util.ArrayList; 19 | 20 | /** 21 | * @author tongqian.ni 22 | */ 23 | public class AlbumFragment extends Fragment { 24 | private ArrayList photos = new ArrayList(); 25 | 26 | public AlbumFragment() { 27 | super(); 28 | } 29 | 30 | @Override 31 | public void onSaveInstanceState(Bundle outState) { 32 | super.onSaveInstanceState(outState); 33 | } 34 | 35 | public static Fragment newInstance(ArrayList photos) { 36 | Fragment fragment = new AlbumFragment(); 37 | Bundle args = new Bundle(); 38 | args.putSerializable("photos", photos); 39 | fragment.setArguments(args); 40 | return fragment; 41 | } 42 | 43 | @Override 44 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 45 | super.onCreateView(inflater, container, savedInstanceState); 46 | View root = inflater.inflate(R.layout.fragment_album, null); 47 | photos = (ArrayList) getArguments().getSerializable("photos"); 48 | albums = (GridView) root.findViewById(R.id.albums); 49 | albums.setOnItemClickListener(new OnItemClickListener() { 50 | 51 | @Override 52 | public void onItemClick(AdapterView arg0, View arg1, int arg2, long arg3) { 53 | PhotoItem photo = photos.get(arg2); 54 | CameraManager.getInst().processPhotoItem(getActivity(), photo); 55 | } 56 | }); 57 | return root; 58 | } 59 | 60 | @Override 61 | public void onResume() { 62 | super.onResume(); 63 | albums.setAdapter(new GalleryAdapter(getActivity(), photos)); 64 | } 65 | 66 | private GridView albums; 67 | } 68 | -------------------------------------------------------------------------------- /app/src/main/java/com/stickercamera/app/camera/util/CameraHelperBase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 CyberAgent 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.stickercamera.app.camera.util; 18 | 19 | import android.content.Context; 20 | import android.content.pm.PackageManager; 21 | import android.hardware.Camera; 22 | import android.hardware.Camera.CameraInfo; 23 | 24 | import com.stickercamera.app.camera.util.CameraHelper.CameraHelperImpl; 25 | import com.stickercamera.app.camera.util.CameraHelper.CameraInfo2; 26 | 27 | public class CameraHelperBase implements CameraHelperImpl { 28 | 29 | private final Context mContext; 30 | 31 | public CameraHelperBase(final Context context) { 32 | mContext = context; 33 | } 34 | 35 | @Override 36 | public int getNumberOfCameras() { 37 | return hasCameraSupport() ? 1 : 0; 38 | } 39 | 40 | @Override 41 | public Camera openCamera(final int id) { 42 | return Camera.open(); 43 | } 44 | 45 | @Override 46 | public Camera openDefaultCamera() { 47 | return Camera.open(); 48 | } 49 | 50 | @Override 51 | public boolean hasCamera(final int facing) { 52 | if (facing == CameraInfo.CAMERA_FACING_BACK) { 53 | return hasCameraSupport(); 54 | } 55 | return false; 56 | } 57 | 58 | @Override 59 | public Camera openCameraFacing(final int facing) { 60 | if (facing == CameraInfo.CAMERA_FACING_BACK) { 61 | return Camera.open(); 62 | } 63 | return null; 64 | } 65 | 66 | @Override 67 | public void getCameraInfo(final int cameraId, final CameraInfo2 cameraInfo) { 68 | cameraInfo.facing = CameraInfo.CAMERA_FACING_BACK; 69 | cameraInfo.orientation = 90; 70 | } 71 | 72 | private boolean hasCameraSupport() { 73 | return mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA); 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /app/src/main/java/com/stickercamera/app/camera/util/CameraHelperGB.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 CyberAgent 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.stickercamera.app.camera.util; 18 | 19 | import android.annotation.TargetApi; 20 | import android.hardware.Camera; 21 | import android.hardware.Camera.CameraInfo; 22 | 23 | import com.stickercamera.app.camera.util.CameraHelper.CameraHelperImpl; 24 | import com.stickercamera.app.camera.util.CameraHelper.CameraInfo2; 25 | 26 | @TargetApi(9) 27 | public class CameraHelperGB implements CameraHelperImpl { 28 | 29 | @Override 30 | public int getNumberOfCameras() { 31 | return Camera.getNumberOfCameras(); 32 | } 33 | 34 | @Override 35 | public Camera openCamera(final int id) { 36 | return Camera.open(id); 37 | } 38 | 39 | @Override 40 | public Camera openDefaultCamera() { 41 | return Camera.open(0); 42 | } 43 | 44 | @Override 45 | public boolean hasCamera(final int facing) { 46 | return getCameraId(facing) != -1; 47 | } 48 | 49 | @Override 50 | public Camera openCameraFacing(final int facing) { 51 | return Camera.open(getCameraId(facing)); 52 | } 53 | 54 | @Override 55 | public void getCameraInfo(final int cameraId, final CameraInfo2 cameraInfo) { 56 | CameraInfo info = new CameraInfo(); 57 | Camera.getCameraInfo(cameraId, info); 58 | cameraInfo.facing = info.facing; 59 | cameraInfo.orientation = info.orientation; 60 | } 61 | 62 | private int getCameraId(final int facing) { 63 | int numberOfCameras = Camera.getNumberOfCameras(); 64 | CameraInfo info = new CameraInfo(); 65 | for (int id = 0; id < numberOfCameras; id++) { 66 | Camera.getCameraInfo(id, info); 67 | if (info.facing == facing) { 68 | return id; 69 | } 70 | } 71 | return -1; 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /app/src/main/java/com/stickercamera/app/camera/util/MatrixUtils.java: -------------------------------------------------------------------------------- 1 | package com.stickercamera.app.camera.util; 2 | 3 | import android.graphics.Matrix; 4 | 5 | public class MatrixUtils 6 | { 7 | public static void mapPoints(Matrix matrix, float[] points) 8 | { 9 | float[] m = { 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F }; 10 | matrix.getValues(m); 11 | 12 | points[0] = (points[0] * m[0] + m[2]); 13 | points[1] = (points[1] * m[4] + m[5]); 14 | 15 | if (points.length == 4) { 16 | points[2] = (points[2] * m[0] + m[2]); 17 | points[3] = (points[3] * m[4] + m[5]); 18 | } 19 | } 20 | 21 | public static float[] getScale(Matrix matrix) 22 | { 23 | float[] points = new float[9]; 24 | matrix.getValues(points); 25 | return new float[] { points[0], points[4] }; 26 | } 27 | 28 | public static float[] getValues(Matrix m) 29 | { 30 | float[] values = new float[9]; 31 | m.getValues(values); 32 | return values; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /app/src/main/java/com/stickercamera/app/camera/util/UIUtils.java: -------------------------------------------------------------------------------- 1 | package com.stickercamera.app.camera.util; 2 | 3 | import android.content.Context; 4 | import android.view.Gravity; 5 | import android.view.LayoutInflater; 6 | import android.view.View; 7 | import android.widget.Toast; 8 | 9 | public class UIUtils { 10 | 11 | public static final int HIGHLIGHT_MODE_PRESSED = 2; 12 | public static final int HIGHLIGHT_MODE_CHECKED = 4; 13 | public static final int HIGHLIGHT_MODE_SELECTED = 8; 14 | 15 | public static final int GLOW_MODE_PRESSED = 2; 16 | public static final int GLOW_MODE_CHECKED = 4; 17 | public static final int GLOW_MODE_SELECTED = 8; 18 | 19 | public static boolean checkBits(int status, int checkBit) { 20 | return (status & checkBit) == checkBit; 21 | } 22 | 23 | /** 24 | * Creates a custom {@link Toast} with a custom layout View 25 | * 26 | * @param context 27 | * the context 28 | * @param resId 29 | * the custom view 30 | * @return the created {@link Toast} 31 | */ 32 | public static Toast makeCustomToast(Context context, int resId) { 33 | View view = LayoutInflater.from(context).inflate(resId, null); 34 | Toast t = new Toast(context); 35 | t.setDuration(Toast.LENGTH_SHORT); 36 | t.setView(view); 37 | t.setGravity(Gravity.CENTER, 0, 0); 38 | return t; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /app/src/main/java/com/stickercamera/app/model/Addon.java: -------------------------------------------------------------------------------- 1 | package com.stickercamera.app.model; 2 | 3 | import com.alibaba.fastjson.JSON; 4 | import com.common.util.StringUtils; 5 | 6 | import java.util.List; 7 | 8 | 9 | /** 10 | * 本地简单使用,实际项目中与贴纸相关的属性可以添加到此类中 11 | */ 12 | public class Addon { 13 | private int id; 14 | 15 | //JSON用到 16 | public Addon() { 17 | 18 | } 19 | 20 | public Addon(int id) { 21 | this.id = id; 22 | } 23 | 24 | public int getId() { 25 | return id; 26 | } 27 | 28 | public void setId(int id) { 29 | this.id = id; 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /app/src/main/java/com/stickercamera/app/model/Album.java: -------------------------------------------------------------------------------- 1 | package com.stickercamera.app.model; 2 | 3 | 4 | import com.common.util.StringUtils; 5 | 6 | import java.io.Serializable; 7 | import java.util.ArrayList; 8 | 9 | /** 10 | * @author tongqian.ni 11 | * 12 | */ 13 | public class Album implements Serializable { 14 | 15 | private static final long serialVersionUID = 5702699517846159671L; 16 | private String albumUri; 17 | private String title; 18 | private ArrayList photos; 19 | 20 | public Album(String title, String uri, ArrayList photos) { 21 | this.title = title; 22 | this.albumUri = uri; 23 | this.photos = photos; 24 | } 25 | 26 | public String getAlbumUri() { 27 | return albumUri; 28 | } 29 | 30 | public void setAlbumUri(String albumUri) { 31 | this.albumUri = albumUri; 32 | } 33 | 34 | public String getTitle() { 35 | return title; 36 | } 37 | 38 | public void setTitle(String title) { 39 | this.title = title; 40 | } 41 | 42 | public ArrayList getPhotos() { 43 | return photos; 44 | } 45 | 46 | public void setPhotos(ArrayList photos) { 47 | this.photos = photos; 48 | } 49 | 50 | @Override 51 | public int hashCode() { 52 | if (albumUri == null) { 53 | return super.hashCode(); 54 | } else { 55 | return albumUri.hashCode(); 56 | } 57 | } 58 | 59 | @Override 60 | public boolean equals(Object o) { 61 | if (o != null && (o instanceof Album)) { 62 | return StringUtils.equals(albumUri, ((Album) o).getAlbumUri()); 63 | } 64 | return false; 65 | } 66 | 67 | } 68 | -------------------------------------------------------------------------------- /app/src/main/java/com/stickercamera/app/model/FeedItem.java: -------------------------------------------------------------------------------- 1 | package com.stickercamera.app.model; 2 | 3 | import java.util.List; 4 | 5 | /** 6 | * 图片Module 7 | * Created by sky on 15/7/18. 8 | */ 9 | public class FeedItem { 10 | 11 | private String imgPath; 12 | private List tagList; 13 | 14 | public FeedItem(){ 15 | 16 | } 17 | 18 | public FeedItem(List tagList,String imgPath){ 19 | this.imgPath = imgPath; 20 | this.tagList = tagList; 21 | } 22 | 23 | public List getTagList() { 24 | return tagList; 25 | } 26 | 27 | public void setTagList(List tagList) { 28 | this.tagList = tagList; 29 | } 30 | 31 | public String getImgPath() { 32 | return imgPath; 33 | } 34 | 35 | public void setImgPath(String imgPath) { 36 | this.imgPath = imgPath; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /app/src/main/java/com/stickercamera/app/model/TagItem.java: -------------------------------------------------------------------------------- 1 | package com.stickercamera.app.model; 2 | 3 | 4 | 5 | import java.io.Serializable; 6 | 7 | public class TagItem implements Serializable { 8 | private static final long serialVersionUID = 2685507991821634905L; 9 | private long id; 10 | private int type; 11 | private String name; 12 | private double x = -1; 13 | private double y = -1; 14 | 15 | private int recordCount; 16 | private boolean left = true; 17 | 18 | 19 | public boolean isLeft() { 20 | return left; 21 | } 22 | public void setLeft(boolean left) { 23 | this.left = left; 24 | } 25 | public int getRecordCount() { 26 | return recordCount; 27 | } 28 | 29 | public void setRecordCount(int recordCount) { 30 | this.recordCount = recordCount; 31 | } 32 | 33 | public TagItem() { 34 | 35 | } 36 | 37 | public TagItem(int type, String label) { 38 | this.type = type; 39 | this.name = label; 40 | } 41 | 42 | public long getId() { 43 | return id; 44 | } 45 | 46 | public void setId(long id) { 47 | this.id = id; 48 | } 49 | 50 | public int getType() { 51 | return type; 52 | } 53 | 54 | public void setType(int type) { 55 | this.type = type; 56 | } 57 | 58 | public String getName() { 59 | return name; 60 | } 61 | 62 | public void setName(String name) { 63 | this.name = name; 64 | } 65 | 66 | public double getX() { 67 | return x; 68 | } 69 | 70 | public void setX(double x) { 71 | this.x = x; 72 | } 73 | 74 | public double getY() { 75 | return y; 76 | } 77 | 78 | public void setY(double y) { 79 | this.y = y; 80 | } 81 | 82 | } 83 | -------------------------------------------------------------------------------- /app/src/main/java/com/stickercamera/base/ActivityResponsable.java: -------------------------------------------------------------------------------- 1 | package com.stickercamera.base; 2 | 3 | import android.content.DialogInterface; 4 | import android.content.DialogInterface.OnCancelListener; 5 | 6 | public interface ActivityResponsable { 7 | /** 8 | * 弹对话框 9 | * 10 | * @param title 11 | * 标题 12 | * @param msg 13 | * 消息 14 | * @param positive 15 | * 确定 16 | * @param positiveListener 17 | * 确定回调 18 | * @param negative 19 | * 否定 20 | * @param negativeListener 21 | * 否定回调 22 | */ 23 | public void alert(final String title, final String msg, final String positive, 24 | final DialogInterface.OnClickListener positiveListener, 25 | final String negative, final DialogInterface.OnClickListener negativeListener); 26 | 27 | /** 28 | * 弹对话框 29 | * 30 | * @param title 31 | * 标题 32 | * @param msg 33 | * 消息 34 | * @param positive 35 | * 确定 36 | * @param positiveListener 37 | * 确定回调 38 | * @param negative 39 | * 否定 40 | * @param negativeListener 41 | * 否定回调 42 | * @param isCanceledOnTouchOutside 43 | * 是否外部点击取消 44 | */ 45 | public void alert(final String title, final String msg, final String positive, 46 | final DialogInterface.OnClickListener positiveListener, 47 | final String negative, 48 | final DialogInterface.OnClickListener negativeListener, 49 | Boolean isCanceledOnTouchOutside); 50 | 51 | /** 52 | * TOAST 53 | * 54 | * @param msg 55 | * 消息 56 | * @param period 57 | * 时长 58 | */ 59 | public void toast(final String msg, final int period); 60 | 61 | /** 62 | * 显示进度对话框 63 | * 64 | * @param msg 65 | * 消息 66 | */ 67 | public void showProgressDialog(final String msg); 68 | 69 | /** 70 | * 显示可取消的进度对话框 71 | * 72 | * @param msg 73 | * 消息 74 | */ 75 | public void showProgressDialog(final String msg, final boolean cancelable, 76 | final OnCancelListener cancelListener); 77 | 78 | /** 79 | * 取消进度对话框 80 | * 81 | */ 82 | public void dismissProgressDialog(); 83 | 84 | } 85 | -------------------------------------------------------------------------------- /app/src/main/java/com/stickercamera/base/BaseFragmentActivity.java: -------------------------------------------------------------------------------- 1 | package com.stickercamera.base; 2 | 3 | import android.support.v4.app.FragmentActivity; 4 | import android.view.View; 5 | 6 | import com.customview.CommonTitleBar; 7 | import com.github.skykai.stickercamera.R; 8 | 9 | /** 10 | * Created by sky on 15/7/6. 11 | */ 12 | public class BaseFragmentActivity extends FragmentActivity { 13 | 14 | protected CommonTitleBar titleBar; 15 | 16 | @Override 17 | public void setContentView(int layoutResID) { 18 | super.setContentView(layoutResID); 19 | //titleBar = (CommonTitleBar) findViewById(R.id.title_layout); 20 | if (titleBar != null) 21 | titleBar.setLeftBtnOnclickListener(new View.OnClickListener() { 22 | @Override 23 | public void onClick(View v) { 24 | finish(); 25 | } 26 | }); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /app/src/main/java/com/stickercamera/base/util/GenericProgressDialog.java: -------------------------------------------------------------------------------- 1 | package com.stickercamera.base.util; 2 | 3 | import android.app.AlertDialog; 4 | import android.content.Context; 5 | import android.os.Bundle; 6 | import android.view.View; 7 | import android.widget.ProgressBar; 8 | import android.widget.TextView; 9 | 10 | import com.github.skykai.stickercamera.R; 11 | 12 | 13 | public class GenericProgressDialog extends AlertDialog { 14 | private ProgressBar mProgress; 15 | private TextView mMessageView; 16 | private CharSequence mMessage; 17 | private boolean mIndeterminate; 18 | private boolean mProgressVisiable; 19 | 20 | public GenericProgressDialog(Context context) { 21 | super(context/*,R.style.Float*/); 22 | } 23 | 24 | public GenericProgressDialog(Context context, int theme) { 25 | super(context,/*, R.style.Float*/theme); 26 | } 27 | 28 | @Override 29 | protected void onCreate(Bundle savedInstanceState) { 30 | super.onCreate(savedInstanceState); 31 | setContentView(R.layout.view_progress_dialog); 32 | mProgress = (ProgressBar) findViewById(android.R.id.progress); 33 | mMessageView = (TextView) findViewById(R.id.message); 34 | 35 | setMessageAndView(); 36 | setIndeterminate(mIndeterminate); 37 | } 38 | 39 | private void setMessageAndView() { 40 | mMessageView.setText(mMessage); 41 | 42 | if (mMessage == null || "".equals(mMessage)) { 43 | mMessageView.setVisibility(View.GONE); 44 | } 45 | 46 | mProgress.setVisibility(mProgressVisiable ? View.VISIBLE : View.GONE); 47 | } 48 | 49 | @Override 50 | public void setMessage(CharSequence message) { 51 | mMessage = message; 52 | } 53 | 54 | /** 55 | * 圈圈可见性设置 56 | * @param progressVisiable 是否显示圈圈 57 | */ 58 | public void setProgressVisiable(boolean progressVisiable) { 59 | mProgressVisiable = progressVisiable; 60 | } 61 | 62 | public void setIndeterminate(boolean indeterminate) { 63 | if (mProgress != null) { 64 | mProgress.setIndeterminate(indeterminate); 65 | } else { 66 | mIndeterminate = indeterminate; 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/aviary_delete_knob.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skykai521/StickerCamera/d0a9c4d3f0ea1acfe339128624ddcb28c4bf85df/app/src/main/res/drawable-hdpi/aviary_delete_knob.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/aviary_resize_knob.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skykai521/StickerCamera/d0a9c4d3f0ea1acfe339128624ddcb28c4bf85df/app/src/main/res/drawable-hdpi/aviary_resize_knob.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skykai521/StickerCamera/d0a9c4d3f0ea1acfe339128624ddcb28c4bf85df/app/src/main/res/drawable-hdpi/back.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/camera_back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skykai521/StickerCamera/d0a9c4d3f0ea1acfe339128624ddcb28c4bf85df/app/src/main/res/drawable-hdpi/camera_back.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/camera_flash_auto.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skykai521/StickerCamera/d0a9c4d3f0ea1acfe339128624ddcb28c4bf85df/app/src/main/res/drawable-hdpi/camera_flash_auto.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/camera_flash_off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skykai521/StickerCamera/d0a9c4d3f0ea1acfe339128624ddcb28c4bf85df/app/src/main/res/drawable-hdpi/camera_flash_off.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/camera_flash_on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skykai521/StickerCamera/d0a9c4d3f0ea1acfe339128624ddcb28c4bf85df/app/src/main/res/drawable-hdpi/camera_flash_on.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/camera_flip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skykai521/StickerCamera/d0a9c4d3f0ea1acfe339128624ddcb28c4bf85df/app/src/main/res/drawable-hdpi/camera_flip.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/camera_library.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skykai521/StickerCamera/d0a9c4d3f0ea1acfe339128624ddcb28c4bf85df/app/src/main/res/drawable-hdpi/camera_library.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/default_img.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skykai521/StickerCamera/d0a9c4d3f0ea1acfe339128624ddcb28c4bf85df/app/src/main/res/drawable-hdpi/default_img.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/dot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skykai521/StickerCamera/d0a9c4d3f0ea1acfe339128624ddcb28c4bf85df/app/src/main/res/drawable-hdpi/dot.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_camera_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skykai521/StickerCamera/d0a9c4d3f0ea1acfe339128624ddcb28c4bf85df/app/src/main/res/drawable-hdpi/ic_camera_white.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skykai521/StickerCamera/d0a9c4d3f0ea1acfe339128624ddcb28c4bf85df/app/src/main/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/icon_biaoqian.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skykai521/StickerCamera/d0a9c4d3f0ea1acfe339128624ddcb28c4bf85df/app/src/main/res/drawable-hdpi/icon_biaoqian.9.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/icon_biaoqian_i.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skykai521/StickerCamera/d0a9c4d3f0ea1acfe339128624ddcb28c4bf85df/app/src/main/res/drawable-hdpi/icon_biaoqian_i.9.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/lookup_amatorka.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skykai521/StickerCamera/d0a9c4d3f0ea1acfe339128624ddcb28c4bf85df/app/src/main/res/drawable-hdpi/lookup_amatorka.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/next.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skykai521/StickerCamera/d0a9c4d3f0ea1acfe339128624ddcb28c4bf85df/app/src/main/res/drawable-hdpi/next.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/point_poi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skykai521/StickerCamera/d0a9c4d3f0ea1acfe339128624ddcb28c4bf85df/app/src/main/res/drawable-hdpi/point_poi.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/position.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skykai521/StickerCamera/d0a9c4d3f0ea1acfe339128624ddcb28c4bf85df/app/src/main/res/drawable-hdpi/position.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/select_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skykai521/StickerCamera/d0a9c4d3f0ea1acfe339128624ddcb28c4bf85df/app/src/main/res/drawable-hdpi/select_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/simple_toast_bg.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skykai521/StickerCamera/d0a9c4d3f0ea1acfe339128624ddcb28c4bf85df/app/src/main/res/drawable-hdpi/simple_toast_bg.9.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/sticker1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skykai521/StickerCamera/d0a9c4d3f0ea1acfe339128624ddcb28c4bf85df/app/src/main/res/drawable-hdpi/sticker1.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/sticker2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skykai521/StickerCamera/d0a9c4d3f0ea1acfe339128624ddcb28c4bf85df/app/src/main/res/drawable-hdpi/sticker2.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/sticker3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skykai521/StickerCamera/d0a9c4d3f0ea1acfe339128624ddcb28c4bf85df/app/src/main/res/drawable-hdpi/sticker3.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/sticker4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skykai521/StickerCamera/d0a9c4d3f0ea1acfe339128624ddcb28c4bf85df/app/src/main/res/drawable-hdpi/sticker4.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/sticker5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skykai521/StickerCamera/d0a9c4d3f0ea1acfe339128624ddcb28c4bf85df/app/src/main/res/drawable-hdpi/sticker5.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/sticker6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skykai521/StickerCamera/d0a9c4d3f0ea1acfe339128624ddcb28c4bf85df/app/src/main/res/drawable-hdpi/sticker6.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/sticker7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skykai521/StickerCamera/d0a9c4d3f0ea1acfe339128624ddcb28c4bf85df/app/src/main/res/drawable-hdpi/sticker7.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/sticker8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skykai521/StickerCamera/d0a9c4d3f0ea1acfe339128624ddcb28c4bf85df/app/src/main/res/drawable-hdpi/sticker8.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/tip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skykai521/StickerCamera/d0a9c4d3f0ea1acfe339128624ddcb28c4bf85df/app/src/main/res/drawable-hdpi/tip.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/vertical_shaped_button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skykai521/StickerCamera/d0a9c4d3f0ea1acfe339128624ddcb28c4bf85df/app/src/main/res/drawable-hdpi/vertical_shaped_button.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/vertical_shaped_button_click.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skykai521/StickerCamera/d0a9c4d3f0ea1acfe339128624ddcb28c4bf85df/app/src/main/res/drawable-hdpi/vertical_shaped_button_click.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/aviary_delete_knob.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skykai521/StickerCamera/d0a9c4d3f0ea1acfe339128624ddcb28c4bf85df/app/src/main/res/drawable-mdpi/aviary_delete_knob.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/aviary_resize_knob.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skykai521/StickerCamera/d0a9c4d3f0ea1acfe339128624ddcb28c4bf85df/app/src/main/res/drawable-mdpi/aviary_resize_knob.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skykai521/StickerCamera/d0a9c4d3f0ea1acfe339128624ddcb28c4bf85df/app/src/main/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/aviary_delete_knob.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skykai521/StickerCamera/d0a9c4d3f0ea1acfe339128624ddcb28c4bf85df/app/src/main/res/drawable-xhdpi/aviary_delete_knob.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/aviary_resize_knob.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skykai521/StickerCamera/d0a9c4d3f0ea1acfe339128624ddcb28c4bf85df/app/src/main/res/drawable-xhdpi/aviary_resize_knob.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skykai521/StickerCamera/d0a9c4d3f0ea1acfe339128624ddcb28c4bf85df/app/src/main/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skykai521/StickerCamera/d0a9c4d3f0ea1acfe339128624ddcb28c4bf85df/app/src/main/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/background_tab.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/black_white_selector.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/bottom_tool.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/btn_crop_selector.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/btn_take_photo.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/cam_focus.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/corners_bg_white_2r_borderd.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/toolbar_shadow.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_album.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 13 | 14 | 21 | 22 | 27 | 28 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_edit_text.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 15 | 16 | 17 | 18 | 28 | 29 | 35 | 36 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 10 | 11 | 12 | 18 | 19 | 20 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_album.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 24 | 25 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_bottom_filter.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 14 | 15 | 22 | 23 | 24 | 34 | 35 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_bottom_tool.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 14 | 15 | 22 | 23 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_gallery.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_picture.xml: -------------------------------------------------------------------------------- 1 | 2 | 13 | 14 | 18 | 19 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /app/src/main/res/layout/toolbar_shadow_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/src/main/res/layout/view_drawable_overlay.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/layout/view_label.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 22 | 23 | 32 | 33 | 48 | 49 | -------------------------------------------------------------------------------- /app/src/main/res/layout/view_label_bottom.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 17 | 18 | 24 | 25 | 29 | 30 | 33 | 34 | 37 | 38 | 41 | 42 | 45 | 46 | 49 | 50 | 53 | 54 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /app/src/main/res/layout/view_label_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 15 | 16 | 23 | 24 | -------------------------------------------------------------------------------- /app/src/main/res/layout/view_progress_dialog.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 17 | 18 | 22 | 23 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /app/src/main/res/layout/view_transient_notification.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 19 | -------------------------------------------------------------------------------- /app/src/main/res/menu/menu_main.xml: -------------------------------------------------------------------------------- 1 | 4 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/raw/aimei.acv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skykai521/StickerCamera/d0a9c4d3f0ea1acfe339128624ddcb28c4bf85df/app/src/main/res/raw/aimei.acv -------------------------------------------------------------------------------- /app/src/main/res/raw/danhuang.acv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skykai521/StickerCamera/d0a9c4d3f0ea1acfe339128624ddcb28c4bf85df/app/src/main/res/raw/danhuang.acv -------------------------------------------------------------------------------- /app/src/main/res/raw/danlan.acv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skykai521/StickerCamera/d0a9c4d3f0ea1acfe339128624ddcb28c4bf85df/app/src/main/res/raw/danlan.acv -------------------------------------------------------------------------------- /app/src/main/res/raw/fugu.acv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skykai521/StickerCamera/d0a9c4d3f0ea1acfe339128624ddcb28c4bf85df/app/src/main/res/raw/fugu.acv -------------------------------------------------------------------------------- /app/src/main/res/raw/gaoleng.acv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skykai521/StickerCamera/d0a9c4d3f0ea1acfe339128624ddcb28c4bf85df/app/src/main/res/raw/gaoleng.acv -------------------------------------------------------------------------------- /app/src/main/res/raw/huaijiu.acv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skykai521/StickerCamera/d0a9c4d3f0ea1acfe339128624ddcb28c4bf85df/app/src/main/res/raw/huaijiu.acv -------------------------------------------------------------------------------- /app/src/main/res/raw/jiaopian.acv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skykai521/StickerCamera/d0a9c4d3f0ea1acfe339128624ddcb28c4bf85df/app/src/main/res/raw/jiaopian.acv -------------------------------------------------------------------------------- /app/src/main/res/raw/keai.acv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skykai521/StickerCamera/d0a9c4d3f0ea1acfe339128624ddcb28c4bf85df/app/src/main/res/raw/keai.acv -------------------------------------------------------------------------------- /app/src/main/res/raw/lomo.acv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skykai521/StickerCamera/d0a9c4d3f0ea1acfe339128624ddcb28c4bf85df/app/src/main/res/raw/lomo.acv -------------------------------------------------------------------------------- /app/src/main/res/raw/morenjiaqiang.acv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skykai521/StickerCamera/d0a9c4d3f0ea1acfe339128624ddcb28c4bf85df/app/src/main/res/raw/morenjiaqiang.acv -------------------------------------------------------------------------------- /app/src/main/res/raw/nuanxin.acv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skykai521/StickerCamera/d0a9c4d3f0ea1acfe339128624ddcb28c4bf85df/app/src/main/res/raw/nuanxin.acv -------------------------------------------------------------------------------- /app/src/main/res/raw/qingxin.acv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skykai521/StickerCamera/d0a9c4d3f0ea1acfe339128624ddcb28c4bf85df/app/src/main/res/raw/qingxin.acv -------------------------------------------------------------------------------- /app/src/main/res/raw/rixi.acv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skykai521/StickerCamera/d0a9c4d3f0ea1acfe339128624ddcb28c4bf85df/app/src/main/res/raw/rixi.acv -------------------------------------------------------------------------------- /app/src/main/res/raw/tone_cuver_sample.acv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skykai521/StickerCamera/d0a9c4d3f0ea1acfe339128624ddcb28c4bf85df/app/src/main/res/raw/tone_cuver_sample.acv -------------------------------------------------------------------------------- /app/src/main/res/raw/wennuan.acv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skykai521/StickerCamera/d0a9c4d3f0ea1acfe339128624ddcb28c4bf85df/app/src/main/res/raw/wennuan.acv -------------------------------------------------------------------------------- /app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | #00000000 5 | #ff000000 6 | #ffffffff 7 | #666666 8 | #ffff0000 9 | #f5f3f0 10 | #cbc4c6 11 | #ff5d65 12 | #cccccc 13 | #cbc4c6 14 | #e8e3e3 15 | #6e686a 16 | 17 | 18 | #D5D5D5 19 | 20 | #f3f3f3 21 | #666666 22 | #1a000000 23 | #77000000 24 | 25 | 26 | 27 | #FF6347 28 | #F4511E 29 | #FF5722 30 | 31 | 32 | #2196F3 33 | #1976D2 34 | #448AFF 35 | 36 | #6633B5E5 37 | #ffbebebe 38 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | StickerCamera 3 | 4 | Hello world! 5 | Settings 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 18 | 19 | 20 | 25 | 26 | 31 | 32 | 33 | 37 | 38 | 43 | 44 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | jcenter() 6 | 7 | } 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:1.2.3' 10 | classpath 'me.tatarka:gradle-retrolambda:3.1.0' 11 | 12 | // NOTE: Do not place your application dependencies here; they belong 13 | // in the individual module build.gradle files 14 | } 15 | 16 | 17 | } 18 | 19 | allprojects { 20 | repositories { 21 | jcenter() 22 | maven { url("https://oss.sonatype.org/content/repositories/snapshots/") } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skykai521/StickerCamera/d0a9c4d3f0ea1acfe339128624ddcb28c4bf85df/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Sun Jul 05 22:10:29 CST 2015 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip 7 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /screenshot/Screenshot_01.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skykai521/StickerCamera/d0a9c4d3f0ea1acfe339128624ddcb28c4bf85df/screenshot/Screenshot_01.gif -------------------------------------------------------------------------------- /screenshot/Screenshot_2015-07-19-11-21-39.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skykai521/StickerCamera/d0a9c4d3f0ea1acfe339128624ddcb28c4bf85df/screenshot/Screenshot_2015-07-19-11-21-39.png -------------------------------------------------------------------------------- /screenshot/Screenshot_2015-07-19-11-22-05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skykai521/StickerCamera/d0a9c4d3f0ea1acfe339128624ddcb28c4bf85df/screenshot/Screenshot_2015-07-19-11-22-05.png -------------------------------------------------------------------------------- /screenshot/Screenshot_2015-07-19-11-23-00.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skykai521/StickerCamera/d0a9c4d3f0ea1acfe339128624ddcb28c4bf85df/screenshot/Screenshot_2015-07-19-11-23-00.png -------------------------------------------------------------------------------- /screenshot/Screenshot_2015-07-19-11-23-04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skykai521/StickerCamera/d0a9c4d3f0ea1acfe339128624ddcb28c4bf85df/screenshot/Screenshot_2015-07-19-11-23-04.png -------------------------------------------------------------------------------- /screenshot/Screenshot_2015-07-19-11-23-22.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skykai521/StickerCamera/d0a9c4d3f0ea1acfe339128624ddcb28c4bf85df/screenshot/Screenshot_2015-07-19-11-23-22.png -------------------------------------------------------------------------------- /screenshot/StickerCamera.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skykai521/StickerCamera/d0a9c4d3f0ea1acfe339128624ddcb28c4bf85df/screenshot/StickerCamera.zip -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app', ':Gpu-Image', ':ImageViewTouch' 2 | --------------------------------------------------------------------------------