code

protected NinePatchDrawable shadowLeft;
......
Bitmap image = BitmapFactory.decodeResource(context.getResources(),R.drawable.shadow_left); byte[] chunk= image.getNinePatchChunk(); shadowLeft=new NinePatchDrawable(context.getResources(), image, chunk, new Rect(), null);
shadowLeft.setBounds(sx, sy, ex, ey);
shadowLeft.draw(canvas);

 

Make sure that your ninepatch image has strech area in top and left edge,Or you'll get the following error:

Fatal signal 11 (SIGSEGV) at 0xdeadd00d (code=1), thread 9184 (om.ai.imagemask) 

JNI WARNING: received null array           
in Landroid/graphics/NinePatch;.validateNinePatchChunk:(I[B)V (GetArrayLength)

相关文章:

  • 2022-12-23
  • 2021-08-17
  • 2021-09-02
  • 2022-12-23
  • 2021-06-22
  • 2022-12-23
  • 2022-12-23
  • 2021-12-04
猜你喜欢
  • 2022-12-23
  • 2021-12-30
  • 2021-07-20
  • 2021-09-17
  • 2021-12-06
  • 2021-12-02
  • 2022-12-23
相关资源
相似解决方案