当前位置:   article > 正文

Android画板(三):WhiteBoard画板开源库_android 画板 开源

android 画板 开源

SketchBoard项目简介

SketchBoard是一个可涂鸦、绘图、添加文字、图像(可旋转缩放)、背景的Fragment,其中主要由SketchView利用matrix完成所有图形绘制操作。

tips:图像旋转缩放高仿美图APP的操作方式
tips: 感谢?绮怀先生对图片选取功能的代码贡献

一、效果演示

1.1 画笔演示.gif

画笔演示.gif

1.2 图像操作演示.gif

图像操作演示.gif

1.3 画板切换演示.gif

画板切换演示.gif

二、使用说明

2.1 已上传Bintray,build.gradle加入即可:

compile 'com.yinghe:whiteboardlib:1.0.9'

2.2 在activity中直接使用:

  1. public class MainActivity extends AppCompatActivity {
  2. @Override
  3. protected void onCreate(Bundle savedInstanceState) {
  4. super.onCreate(savedInstanceState);
  5. setContentView(R.layout.activity_main);
  6. //获取Fragment管理器
  7. FragmentTransaction ts = getSupportFragmentManager().beginTransaction();
  8. //获取WhiteBoardFragment实例
  9. WhiteBoardFragment whiteBoardFragment = WhiteBoardFragment.newInstance();
  10. //添加到界面中
  11. ts.add(R.id.fl_main, whiteBoardFragment, "wb").commit();
  12. }

2.3 WhiteBoardFragment的API说明:

  1. /**
  2. * show 默认新建一个学生端功能
  3. * @author TangentLu
  4. * create at 16/6/17 上午9:59
  5. */
  6. public static WhiteBoardFragment newInstance() {
  7. }
  8. /**
  9. * show 新建一个教师端的画板碎片,有推送按钮
  10. * @param callback 推送按钮监听器,接受返回的图片文件路径可用于显示文件
  11. * @author TangentLu
  12. * create at 16/6/17 上午9:57
  13. */
  14. public static WhiteBoardFragment newInstance(SendBtnCallback callback) {
  15. }
  16. /**
  17. * @param imgPath 添加的背景图片文件路径
  18. * @author TangentLu
  19. * create at 16/6/21 下午3:39
  20. * show 设置当前白板的背景图片
  21. */
  22. public void setCurBackgroundByPath(String imgPath) {
  23. }
  24. /**
  25. * show 新增白板并设置白板的背景图片
  26. * @param imgPath 添加的背景图片文件路径
  27. * @author TangentLu
  28. * create at 16/6/21 下午3:39
  29. */
  30. public void setNewBackgroundByPath(String imgPath) {
  31. }
  32. /**
  33. * show 新增图片到当前白板
  34. * @param imgPath 新增的图片路径
  35. * @author TangentLu
  36. * create at 16/6/21 下午3:42
  37. */
  38. public void addPhotoByPath(String imgPath) {
  39. }
  40. /**
  41. * show 获取当前白板的BitMap
  42. * @author TangentLu
  43. * create at 16/6/21 下午3:44
  44. */
  45. public Bitmap getResultBitmap() {
  46. }
  47. /**
  48. * show 手动保存当前画板到文件,耗时操作
  49. *
  50. * @param filePath 保存的文件路径
  51. * @param imgName 保存的文件名
  52. * @return 返回保存后的文件路径
  53. * @author TangentLu
  54. * create at 16/6/21 下午3:46
  55. */
  56. public File saveInOI(String filePath, String imgName) {
  57. }

三、技术博客

主要技术难点可参考以下技术博客:

Android画板(一):软键盘遮挡输入焦点的完美解决方案

Android画板(二):Matrix实现美图APP的旋转缩放

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Cpp五条/article/detail/598660
推荐阅读
相关标签
  

闽ICP备14008679号