Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
Questions about Android development and PDF

TOPIC:

Eraser of PDF Ink 10 years 3 months ago #4865

  • el3ony
  • el3ony's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 16
  • Thank you received: 0
Hi,

Is there a way how to make an eraser? After I painted any color on PDF I don't know how to paint the transparency color to erase the ink that I painted before.

I already tried with these snippet code but it doesn't work

paint.setColor(Color.TRANSPARENT);
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));


any reply would be appreciate

Please Log in or Create an account to join the conversation.

Eraser of PDF Ink 10 years 3 months ago #4866

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 1123
  • Thank you received: 73
delete the Ink object.
if Ink object not added to page by Page.AddAnnotInk().
just invoke Ink.destroy(), and set Ink object to null.

if Ink objecy was added to page.
then invoke Annotation.RemoveFromPage() or Annotation.SetHide()

Please Log in or Create an account to join the conversation.

Eraser of PDF Ink 10 years 3 months ago #4867

  • el3ony
  • el3ony's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 16
  • Thank you received: 0
Thanks but this is not what I want

Ink.destroy(), and set Ink object to null
Annotation.RemoveFromPage(), Annotation.SetHide()

These code uses for remove all of the Ink object but I want to remove some part of the ink object,
in this case the rubber to rub some part of the Ink.

Please Log in or Create an account to join the conversation.

Eraser of PDF Ink 10 years 3 months ago #4868

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 1123
  • Thank you received: 73
i think, in this case.
you can create your owner Ink class to descript editable cache.

and the Ink class(you defined) can translate to Ink(com.radaee.pdf.Ink).
then add translated Ink object to Page, if needed.

Please Log in or Create an account to join the conversation.

Eraser of PDF Ink 10 years 3 months ago #4869

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 1123
  • Thank you received: 73
an other way is:
create a Bitmap object over page, when Ink drawn.
and eraser write transparent color to Bitmap object for coordinate(not draw, but set pixels value).

after all, then clip bonding box to all object, and get a smaller bitmap object.
then add the bitmap object to page by Page.AddAnnotBitmap or Page.AddContent

Please Log in or Create an account to join the conversation.

Eraser of PDF Ink 10 years 3 months ago #4870

  • el3ony
  • el3ony's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 16
  • Thank you received: 0
Thank I'll try and get back to you.

Please Log in or Create an account to join the conversation.

Powered by Kunena Forum