2013-10-01 43 views
2

我想在我的android应用程序中使用jhlabsWarpFilter。为此,我使用jhlabs提供的jar,但在那里,没有WarpFilter类的定义。我试了WarpFilterthis link.I试图通过在我的应用程序中复制该类来使用该类。但问题是,它使用了一些不受android sdk支持的类。我也认为Google code链接,但它也没有提供任何的实现。请任何人都可以建议我一些解决方案?有没有其他的librabry/jar提供翘曲图像设施?请帮我解决这个问题。如何使用warp过滤器的jhlabs图像库在android

谢谢。

+0

你找到答案吗? – Arash

+0

不...我还没有找到任何解决方案 – zanky

+0

此刻的任何想法?我在这个时候有同样的情况.. –

回答

0

使用这样的过滤器:

final Bitmap bmporg = BitmapFactory.decodeByteArray(byteArrayorg, 0, byteArrayorg.length); 

Line line1 = new Line(0, 0, bmporg.getWidth(), 0); 
Line line2 = new Line(0, bmporg.getHeight()/2, bmporg.getWidth(), bmporg.getHeight()/2); 
Line line3 = new Line(0, bmporg.getHeight(), bmporg.getWidth(), bmporg.getHeight()); 

final Line[] lineArray = {line1, line2, line3 }; 

Line line4 = new Line(0, 0, bmporg.getWidth(), bmporg.getHeight()); 
Line line5 = new Line(0, 0, bmporg.getWidth(), bmporg.getHeight()); 
Line line6 = new Line(0, 0, bmporg.getWidth(), bmporg.getHeight()); 

final Line[] lineArray2 = {line4, line5, line6 }; 

FieldWarpFilter fieldWarpFilter = new FieldWarpFilter(); 
fieldWarpFilter.setAmount(amountFieldWarpFilter); 
fieldWarpFilter.setPower(powerFieldWarpFilter); 
fieldWarpFilter.setStrength(strengthFieldWarpFilter); 
fieldWarpFilter.setInLines(lineArray); 
fieldWarpFilter.setOutLines(lineArray2); 
int[] src22 = AndroidUtils.bitmapToIntArray(bmporg); 
int width22 = bmporg.getWidth(); 
int height22 = bmporg.getHeight(); 
int[] dest22 = fieldWarpFilter.filter(src22, width22, height22); 
Bitmap destBitmap = Bitmap.createBitmap(dest22, width22, height22, Bitmap.Config.ARGB_8888); 

imageView1.setImageBitmap(destBitmap); 
相关问题