1

How can we replicate the Android behaviour of this code snippet from SharpView library in Harmony OS?

private PorterDuffXfermode mPorterDuffXfermode = new PorterDuffXfermode(PorterDuff.Mode.SRC_IN);

mPaint.setXfermode(mPorterDuffXfermode);
mOutCanvas.drawBitmap(mSoftBitmap.get(), rect, rect, mPaint);
zhangxaochen
  • 32,744
  • 15
  • 77
  • 108

2 Answers2

0

BlendMode API is the Harmony alternative for PorterDuffXfermode.

you can achieve same functionality using,

mPaint.setBlendMode(BlendMode.SRC_IN);
Gowtham GS
  • 478
  • 2
  • 5
0

You may use the setBlendMode method.

enter image description here

For more details, you can check this Docs.

zhangxaochen
  • 32,744
  • 15
  • 77
  • 108