如何裁剪图像在Android上四个点之间 [英] How to crop an image in between four points on Android

查看:264
本文介绍了如何裁剪图像在Android上四个点之间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是新来的工作,在Android的位图,以及一时无法裁剪四点(显然它的形状不是矩形)。

Am new to work on bitmaps in android, and am unable to crop the image between four point ( clearly its not a rectangle in shape).

我将图像转换成位图,并设置为背景来布局。 现在我有四个不同的点(P0,P1,P2,P3)

I convert the image into bitmap and set as background to layout. now i have four different points(p0,p1,p2,p3)

我的这些点的值。 现在,它的时间来裁剪这些区域显示为矩形状的位图..之间的图像(即作为背景,另一个布局)。

I have the values of these points . Now its time to crop the image between these region and show as rectangle shaped bitmap..(ie, as background to another layout.).

上午再次明确说明,,裁剪只有这些点之间的图像.. 即,在该区域内唯一。 哪些办法可以解决这个问题,?我可以使用任何第三方工具。该建议我这比不上那些.........

Am again mention clearly ,, crop the image between only these points.. ie, inside the region only. Which way i can solve this problem,? can i use any third-party tool.. the suggest me which those ones.........

由于@All

推荐答案

首先选择具有<一个矩形区域href="http://developer.android.com/reference/android/graphics/Bitmap.html#getPixels%28int%5B%5D,%20int,%20int,%20int,%20int,%20int,%20int%29"相对=nofollow> Bitmap.getPixels
然后avaluate这必将你的造型线。
以像素为单位改变埃夫像素[]是outsidebounds并将其设置为0(或其它值,这将是图像的背景)
并重新创建您的图像新的数据集。

At first select rectangle region with Bitmap.getPixels
Then avaluate lines which bound your shape.
Change evry pixel in pixels[] which is outsidebounds and set it to 0 (or other value, it will be background of image)
And recreate you image from new dataset.

编辑:尝试使用裁剪工艺 HTTP ://www.zet$c$c.com/gfx/java2d/clipping/ 或的 http://www.roseind​​ia.net/java/example/java/swing/graphics2D/clip-area.shtml 在例如矩形被使用,但茨艾伦methodics允许任何区域

try to use clipping technics http://www.zetcode.com/gfx/java2d/clipping/ or http://www.roseindia.net/java/example/java/swing/graphics2D/clip-area.shtml in example rectangle was used but thos methodics allows any region

这篇关于如何裁剪图像在Android上四个点之间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆