0

I am using the pen SDK 4.0.7

I want to erase strokes programatically, pretty much the same thing a user will do with his finger or pen when the eraser is enabled.

I know that this code is used to draw pen strokes programatically:

SpenObjectStroke strokeObj = new SpenObjectStroke(penName, points, pressures, timestamps);

strokeObj.setPenSize(size);
strokeObj.setColor(color);
mSpenPageDoc.appendObject(strokeObj);
mSpenSurfaceView.update();

So my question is: how do I draw an Eraser stroke? (that cleans all the pen stokes it overlaps)

kc ochibili
  • 3,103
  • 2
  • 25
  • 25

1 Answers1

0

The solution I implemented was to use the MagicPen which has the capability of erasing a stroke when the intensity is set to the max value.

    String penName = SpenPenManager.SPEN_MAGIC_PEN;
    float  penSize =  eraserSettingView.getInfo().size;
    int penColor  = -16777216; // gotten from the max transparent color value of the Magic pen

    SpenObjectStroke strokeObj = new SpenObjectStroke(penName, points, pressures, timestamps);

    strokeObj.setPenSize(size);
    strokeObj.setColor(color);
    mSpenPageDoc.appendObject(strokeObj);
    mSpenSurfaceView.update();
kc ochibili
  • 3,103
  • 2
  • 25
  • 25