3

I want to use WarpFilter of jhlabs in my android application.For that i used jar provided by jhlabs but in that , there is no definition of WarpFilter class. I reffered WarpFilter and this link.I tried to use that class by copying it in my application. But the problem is that, it uses some classes which are not supported by android sdk. I also reffered Google code link, but it also doesn't provide any implementation for that.Please anyone can suggest me some solution ? is there any other librabry/jar which provide warping image facility ? Please help me to solve this issue.

Thanks.

Zankhna
  • 4,570
  • 9
  • 62
  • 103

1 Answers1

0

Use a filter like this:

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);
Moinuddin Quadri
  • 46,825
  • 13
  • 96
  • 126