实现的基本功能如下:
1,图片编辑(图片添加,文字添加),实现图片编辑中的图片添加,旋转,缩放,删除;文字的添加,大小缩放,字体更换,颜色更换,删除;
2,基本滤镜实现与接口封装; 涂鸦(画笔的样式,粗细,颜色,橡皮擦,贴图); 相框(简单相框,酷炫相框); 马赛就克(基本马赛克,酷炫马赛克,橡皮擦)及其接口封装
3,接下来, 图像剪切,旋转等功能实现测试接口封装; GIF与MP
4,图片互转实现测试与接口封装;
package com.jarlen.picturetest;
import com.js.photosdk.mosaic.DrawMosaicView;
import com.js.photosdk.mosaic.MosaicUtil;
import com.js.photosdk.mosaic.MosaicUtil.MosaicType;
import com.js.photosdk.utils.FileUtils;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageButton;
public class MosaicActivity extends Activity implements OnClickListener
{
private DrawMosaicView mosaic;
String mPath;
private int mWidth, mHeight;
Bitmap srcBitmap = null;
private ImageButton cancelBtn, okBtn;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.layout_mosaic);
initView();
Intent intent = getIntent();
mPath = intent.getStringExtra("camera_path");
mosaic.setMosaicBackgroundResource(mPath);
srcBitmap = BitmapFactory.decodeFile(mPath);
mWidth = srcBitmap.getWidth();
mHeight = srcBitmap.getHeight();
Bitmap bit = MosaicUtil.getMosaic(srcBitmap);
mosaic.setMosaicResource(bit);
mosaic.setMosaicBrushWidth(10);
}
private void initView()
{
mosaic = (DrawMosaicView) findViewById(R.id.mosaic);
cancelBtn = (ImageButton) findViewById(R.id.btn_cancel);
cancelBtn.setOnClickListener(this);
okBtn = (ImageButton) findViewById(R.id.btn_ok);
okBtn.setOnClickListener(this);
}
@Override
public boolean onCreateOptionsMenu(Menu menu)
{
menu.add(0, 1, 1, "花色").setIcon(R.drawable.flower);
menu.add(0, 2, 2, "马赛克");
menu.add(0, 3, 3, "毛玻璃");
menu.add(0, 4, 4, "大小");
menu.add(0, 5, 5, "橡皮");
return super.onCreateOptionsMenu(menu);
}
int size = 5;
@Override
public boolean onOptionsItemSelected(MenuItem item)
{
switch (item.getItemId())
{
case 1 :
Bitmap bit = BitmapFactory.decodeResource(this.getResources(),
R.drawable.hi4);
bit = FileUtils.ResizeBitmap(bit, mWidth, mHeight);
mosaic.setMosaicResource(bit);
break;
case 2 :
Bitmap bitmapMosaic = MosaicUtil.getMosaic(srcBitmap);
mosaic.setMosaicResource(bitmapMosaic);
break;
case 3 :
Bitmap bitmapBlur = MosaicUtil.getBlur(srcBitmap);
mosaic.setMosaicResource(bitmapBlur);
break;
case 4 :
if (size >= 30)
{
size = 5;
} else
{
size = 5;
}
mosaic.setMosaicBrushWidth(size);
break;
case 5 :
mosaic.setMosaicType(MosaicType.ERASER);
break;
default :
break;
}
return super.onOptionsItemSelected(item);
}
@Override
public void onClick(View view)
{
switch (view.getId())
{
case R.id.btn_cancel :
Intent cancelData = new Intent();
setResult(RESULT_CANCELED, cancelData);
recycle();
this.finish();
break;
case R.id.btn_ok :
Bitmap bit = mosaic.getMosaicBitmap();
FileUtils.writeImage(bit, mPath, 100);
Intent okData = new Intent();
okData.putExtra("camera_path", mPath);
setResult(RESULT_OK, okData);
recycle();
MosaicActivity.this.finish();
break;
default :
break;
}
}
private void recycle()
{
if (srcBitmap != null)
{
srcBitmap.recycle();
srcBitmap = null;
}
}
}
资源文件列表
PhotoEditDemo-master/.gitignore , 300
PhotoEditDemo-master/Photo_Demo/.classpath , 466
PhotoEditDemo-master/Photo_Demo/.project , 815
PhotoEditDemo-master/Photo_Demo/.settings/org.eclipse.core.resources.prefs , 55
PhotoEditDemo-master/Photo_Demo/.settings/org.eclipse.jdt.core.prefs , 173
PhotoEditDemo-master/Photo_Demo/AndroidManifest.xml , 3483
PhotoEditDemo-master/Photo_Demo/assets/bigpaper00.jpg , 28435
PhotoEditDemo-master/Photo_Demo/assets/fonts/by3500.ttf , 2631880
PhotoEditDemo-master/Photo_Demo/assets/fonts/bygf3500.ttf , 2652788
PhotoEditDemo-master/Photo_Demo/build.gradle , 1133
PhotoEditDemo-master/Photo_Demo/ic_launcher-web.png , 51394
PhotoEditDemo-master/Photo_Demo/libs/android-support-v4.jar , 758727
PhotoEditDemo-master/Photo_Demo/libs/armeabi-v7a/libframefilters.so , 13476
PhotoEditDemo-master/Photo_Demo/libs/armeabi/libframefilters.so , 17564
PhotoEditDemo-master/Photo_Demo/lint.xml , 53
PhotoEditDemo-master/Photo_Demo/proguard-project.txt , 781
PhotoEditDemo-master/Photo_Demo/project.properties , 608
PhotoEditDemo-master/Photo_Demo/res/color/select_color.xml , 1823
PhotoEditDemo-master/Photo_Demo/res/color/tab_btn_text.xml , 395
PhotoEditDemo-master/Photo_Demo/res/drawable-hdpi/crayon.png , 1160
PhotoEditDemo-master/Photo_Demo/res/drawable-hdpi/crop_button.png , 1450
PhotoEditDemo-master/Photo_Demo/res/drawable-hdpi/eraser.png , 1433
PhotoEditDemo-master/Photo_Demo/res/drawable-hdpi/frame_around1.png , 3792
PhotoEditDemo-master/Photo_Demo/res/drawable-hdpi/frame_around1_bottom.png , 3098
PhotoEditDemo-master/Photo_Demo/res/drawable-hdpi/frame_around1_left.png , 3071
PhotoEditDemo-master/Photo_Demo/res/drawable-hdpi/frame_around1_left_bottom.png , 3401
PhotoEditDemo-master/Photo_Demo/res/drawable-hdpi/frame_around1_left_top.png , 3412
PhotoEditDemo-master/Photo_Demo/res/drawable-hdpi/frame_around1_right.png , 3059
PhotoEditDemo-master/Photo_Demo/res/drawable-hdpi/frame_around1_right_bottom.png , 3368
PhotoEditDemo-master/Photo_Demo/res/drawable-hdpi/frame_around1_right_top.png , 3400
PhotoEditDemo-master/Photo_Demo/res/drawable-hdpi/frame_around1_top.png , 3095
PhotoEditDemo-master/Photo_Demo/res/drawable-hdpi/frame_around2.png , 3542
PhotoEditDemo-master/Photo_Demo/res/drawable-hdpi/frame_around2_bottom.png , 3110
PhotoEditDemo-master/Photo_Demo/res/drawable-hdpi/frame_around2_left.png , 3122
PhotoEditDemo-master/Photo_Demo/res/drawable-hdpi/frame_around2_left_bottom.png , 3045
PhotoEditDemo-master/Photo_Demo/res/drawable-hdpi/frame_around2_left_top.png , 3032
PhotoEditDemo-master/Photo_Demo/res/drawable-hdpi/frame_around2_right.png , 3094
PhotoEditDemo-master/Photo_Demo/res/drawable-hdpi/frame_around2_right_bottom.png , 3036
PhotoEditDemo-master/Photo_Demo/res/drawable-hdpi/frame_around2_right_top.png , 3026
PhotoEditDemo-master/Photo_Demo/res/drawable-hdpi/frame_around2_top.png , 3119
PhotoEditDemo-master/Photo_Demo/res/drawable-hdpi/frame_big1.png , 125451
PhotoEditDemo-master/Photo_Demo/res/drawable-hdpi/frame_small1.png , 8001
PhotoEditDemo-master/Photo_Demo/res/drawable-hdpi/ic_launcher.png , 7658
PhotoEditDemo-master/Photo_Demo/res/drawable-hdpi/marker.png , 777
PhotoEditDemo-master/Photo_Demo/res/drawable-hdpi/marker01.png , 9356
PhotoEditDemo-master/Photo_Demo/res/drawable-hdpi/marker1.png , 481
PhotoEditDemo-master/Photo_Demo/res/drawable-hdpi/paint.png , 1443
PhotoEditDemo-master/Photo_Demo/res/drawable-hdpi/stamp0star.png , 1102
PhotoEditDemo-master/Photo_Demo/res/drawable-hdpi/stamp1star.png , 748
PhotoEditDemo-master/Photo_Demo/res/drawable-hdpi/stamp2star.png , 721
PhotoEditDemo-master/Photo_Demo/res/drawable-hdpi/stamp3star.png , 851
PhotoEditDemo-master/Photo_Demo/res/drawable-hdpi/zui.png , 20887
PhotoEditDemo-master/Photo_Demo/res/drawable-mdpi/ic_launcher.png , 3777
PhotoEditDemo-master/Photo_Demo/res/drawable-xhdpi/btn_bg_highlight_white.9.png , 2636
PhotoEditDemo-master/Photo_Demo/res/drawable-xhdpi/btn_view_back.png , 940
PhotoEditDemo-master/Photo_Demo/res/drawable-xhdpi/btn_view_ok.png , 1047
PhotoEditDemo-master/Photo_Demo/res/drawable-xhdpi/flower.png , 8810
PhotoEditDemo-master/Photo_Demo/res/drawable-xhdpi/hi0.jpg , 228962
PhotoEditDemo-master/Photo_Demo/res/drawable-xhdpi/hi3.jpg , 8630
PhotoEditDemo-master/Photo_Demo/res/drawable-xhdpi/hi4.png , 262642
PhotoEditDemo-master/Photo_Demo/res/drawable-xhdpi/ic_launcher.png , 12516
PhotoEditDemo-master/Photo_Demo/res/drawable-xhdpi/icon_auto.png , 1882
PhotoEditDemo-master/Photo_Demo/res/drawable-xhdpi/river.png , 1248149
PhotoEditDemo-master/Photo_Demo/res/drawable-xhdpi/youhua.jpg , 100230
PhotoEditDemo-master/Photo_Demo/res/drawable-xxhdpi/ic_launcher.png , 24777
PhotoEditDemo-master/Photo_Demo/res/drawable/a1map.png , 63883
PhotoEditDemo-master/Photo_Demo/res/drawable/bg_touch_highlight_white.xml , 311
PhotoEditDemo-master/Photo_Demo/res/drawable/blackboard256.png , 88747
PhotoEditDemo-master/Photo_Demo/res/drawable/c1map.png , 3675
PhotoEditDemo-master/Photo_Demo/res/drawable/comment.png , 8233
PhotoEditDemo-master/Photo_Demo/res/drawable/gouda.png , 9070
PhotoEditDemo-master/Photo_Demo/res/drawable/guaishushu.png , 9830
PhotoEditDemo-master/Photo_Demo/res/drawable/h2map.png , 2008
PhotoEditDemo-master/Photo_Demo/res/drawable/h4map.png , 20830
PhotoEditDemo-master/Photo_Demo/res/drawable/haoxingzuop.png , 26749
PhotoEditDemo-master/Photo_Demo/res/drawable/louguang.jpg , 77555
PhotoEditDemo-master/Photo_Demo/res/drawable/riguang.jpg , 35780
PhotoEditDemo-master/Photo_Demo/res/drawable/song2map.png , 8212
PhotoEditDemo-master/Photo_Demo/res/drawable/sucai10.jpg , 36231
PhotoEditDemo-master/Photo_Demo/res/drawable/sucai12.jpg , 31250
PhotoEditDemo-master/Photo_Demo/res/drawable/sucai16.jpg , 37367
PhotoEditDemo-master/Photo_Demo/res/drawable/sucai18.jpg , 61329
PhotoEditDemo-master/Photo_Demo/res/drawable/sucai24.jpg , 71113
PhotoEditDemo-master/Photo_Demo/res/drawable/sucai25.jpg , 96272
PhotoEditDemo-master/Photo_Demo/res/drawable/wanhuaile.png , 15688
PhotoEditDemo-master/Photo_Demo/res/drawable/watermark_chunvzuo.png , 16136
PhotoEditDemo-master/Photo_Demo/res/drawable/xiangsi.png , 22877
PhotoEditDemo-master/Photo_Demo/res/drawable/xingzuokong.png , 8144
PhotoEditDemo-master/Photo_Demo/res/drawable/xinnian.png , 16584
PhotoEditDemo-master/Photo_Demo/res/drawable/youhua.jpg , 100230
PhotoEditDemo-master/Photo_Demo/res/drawable/zaoan.png , 5764
PhotoEditDemo-master/Photo_Demo/res/drawable/zuile.png , 5253
PhotoEditDemo-master/Photo_Demo/res/drawable/zuo.png , 8651
PhotoEditDemo-master/Photo_Demo/res/layout/activity_main.xml , 2027
PhotoEditDemo-master/Photo_Demo/res/layout/addtext.xml , 3289
PhotoEditDemo-master/Photo_Demo/res/layout/addwatermark.xml , 6019
PhotoEditDemo-master/Photo_Demo/res/layout/crop_image.xml , 950
PhotoEditDemo-master/Photo_Demo/res/layout/duibidu.xml , 2930
PhotoEditDemo-master/Photo_Demo/res/layout/frame_filter.xml , 1878
PhotoEditDemo-master/Photo_Demo/res/layout/layout_common_top_bar.xml , 1144
PhotoEditDemo-master/Photo_Demo/res/layout/layout_draw.xml , 932
PhotoEditDemo-master/Photo_Demo/res/layout/layout_enhance.xml , 3543
PhotoEditDemo-master/Photo_Demo/res/layout/layout_filter.xml , 8972
PhotoEditDemo-master/Photo_Demo/res/layout/layout_mosaic.xml , 888
PhotoEditDemo-master/Photo_Demo/res/layout/layout_revolve.xml , 1989
PhotoEditDemo-master/Photo_Demo/res/layout/layout_warp.xml , 781
PhotoEditDemo-master/Photo_Demo/res/layout/photo_frame.xml , 2294
PhotoEditDemo-master/Photo_Demo/res/layout/preview.xml , 444
PhotoEditDemo-master/Photo_Demo/res/layout/select_color.xml , 1823
PhotoEditDemo-master/Photo_Demo/res/layout/test.xml , 890
PhotoEditDemo-master/Photo_Demo/res/menu/main.xml , 361
PhotoEditDemo-master/Photo_Demo/res/values-v11/styles.xml , 324
PhotoEditDemo-master/Photo_Demo/res/values-v14/styles.xml , 381
PhotoEditDemo-master/Photo_Demo/res/values-w820dp/dimens.xml , 373
PhotoEditDemo-master/Photo_Demo/res/values/attrs.xml , 897
PhotoEditDemo-master/Photo_Demo/res/values/colors.xml , 403
PhotoEditDemo-master/Photo_Demo/res/values/dimens.xml , 771
PhotoEditDemo-master/Photo_Demo/res/values/strings.xml , 920
PhotoEditDemo-master/Photo_Demo/res/values/styles.xml , 3947
PhotoEditDemo-master/Photo_Demo/src/com/jarlen/picturetest/AddTextActivity.java , 8039
PhotoEditDemo-master/Photo_Demo/src/com/jarlen/picturetest/AddWatermarkActivity.java , 6952
PhotoEditDemo-master/Photo_Demo/src/com/jarlen/picturetest/DrawBaseActivity.java , 5677
PhotoEditDemo-master/Photo_Demo/src/com/jarlen/picturetest/EnhanceActivity.java , 3554
PhotoEditDemo-master/Photo_Demo/src/com/jarlen/picturetest/ImageCropActivity.java , 3851
PhotoEditDemo-master/Photo_Demo/src/com/jarlen/picturetest/ImageFilterActivity.java , 11034
PhotoEditDemo-master/Photo_Demo/src/com/jarlen/picturetest/MainActivity.java , 10113
PhotoEditDemo-master/Photo_Demo/src/com/jarlen/picturetest/MosaicActivity.java , 3372
PhotoEditDemo-master/Photo_Demo/src/com/jarlen/picturetest/PhotoFrameActivity.java , 4013
PhotoEditDemo-master/Photo_Demo/src/com/jarlen/picturetest/PreviewActivity.java , 627
PhotoEditDemo-master/Photo_Demo/src/com/jarlen/picturetest/RevolveActivity.java , 2944
PhotoEditDemo-master/Photo_Demo/src/com/jarlen/picturetest/WarpActivity.java , 3820
PhotoEditDemo-master/Photo_Demo/src/com/jarlen/temptest/EnhanceActivity.java , 1553
PhotoEditDemo-master/Photo_Demo/src/com/jarlen/temptest/FrameFilterActivity.java , 4189
PhotoEditDemo-master/Photo_Demo/src/com/jarlen/temptest/GPUImageBrightnessFilter.java , 2097
PhotoEditDemo-master/Photo_Demo/src/com/jarlen/temptest/GPUImageContrastFilter.java , 2128
PhotoEditDemo-master/Photo_Demo/src/com/jarlen/temptest/GPUImageFilter.java , 8545
PhotoEditDemo-master/Photo_Demo/src/com/jarlen/temptest/GPUImageSaturationFilter.java , 2536
PhotoEditDemo-master/Photo_Demo/src/com/jarlen/temptest/ImgeditActivity.java , 6159
PhotoEditDemo-master/Photo_Demo/src/com/jarlen/temptest/OpenGlUtils.java , 5530
PhotoEditDemo-master/Photo_Demo/src/com/jarlen/temptest/PhotoRotate.java , 1506
PhotoEditDemo-master/Photo_Demo/src/com/jarlen/utils/Constants.java , 186
PhotoEditDemo-master/Photo_Demo/src/com/jarlen/utils/FrameFilterUtils.java , 5816
PhotoEditDemo-master/Photo_Demo/src/com/jarlen/view/VerticalSeekBar.java , 3105
PhotoEditDemo-master/Photo_Demo/src/com/js/photosdk/filter/NativeFrameFilters.java , 320
PhotoEditDemo-master/Photo_Demo/src/com/larswerkman/holocolorpicker/ColorPicker.java , 25283
PhotoEditDemo-master/Photo_Demo/src/com/larswerkman/holocolorpicker/OpacityBar.java , 14753
PhotoEditDemo-master/Photo_Demo/src/com/larswerkman/holocolorpicker/SVBar.java , 15102
PhotoEditDemo-master/Photo_Demo/src/com/larswerkman/holocolorpicker/SaturationBar.java , 14814
PhotoEditDemo-master/Photo_Demo/src/com/larswerkman/holocolorpicker/SelectColorPopup.java , 3136
PhotoEditDemo-master/Photo_Demo/src/com/larswerkman/holocolorpicker/ValueBar.java , 14435
PhotoEditDemo-master/Photo_Library/.classpath , 466
最多只能显示150条信息!
