[英]How to crop a rectangle from an image in android
我發現可以使用內置的Android裁剪處理程序裁剪矩形。(com.android.camera.action.CROP)。 要裁剪矩形,您需要刪除我之前傳遞的示例的以下參數:
intent.putExtra("outputX", 200); //Set this to define the max size of the output bitmap
intent.putExtra("outputY", 200); //Set this to define the max size of the output bitmap
intent.putExtra("aspectX", 1); //Set this to define the X aspect ratio of the shape
intent.putExtra("aspectY", 1); //Set this to define the Y aspect ratio of the shape
設置aspectX和aspectY將強制android在移動其中一個時移動形狀的兩側。 注釋這些線條,你就可以隨意移動形狀了。
使用內置的Android裁剪處理(com.android.camera.action.CROP)無法裁剪為方形以外的任何內容。
您必須從頭開始構建自己的裁剪活動。 您可能希望將自己的實現基於SDK (需要GIT)實現。
在Stack Overflow等問答網站上簡單回答這個復雜的任務細節是不可能的。 如果您有特殊問題,請不要猶豫,發布另一個問題。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.