2013-10-01 48 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); 
相關問題