RadaeePDF.com :: Topic: AddAnnotBitmap is annotating a captured image (1/1)
Welcome, Guest
Username: Password: Remember me

Signin/Signup with:

Questions about Android development and PDF

TOPIC: AddAnnotBitmap is annotating a captured image

AddAnnotBitmap is annotating a captured image 3 years 2 months ago #7084

AddAnnotBitmap is annotating a user captured signature on the document with a WHITE background.
I need help to make this background transparent. Only the signature should be opaque.
Is this possible?

has_alpha, true/false still I'm unable to remove the white background
Last Edit: 3 years 2 months ago by manfcas.
The administrator has disabled public write access.

AddAnnotBitmap is annotating a captured image 3 years 2 months ago #7092

  • radaee
  • radaee's Avatar
  • OFFLINE
  • Moderator
  • Posts: 825
  • Thank you received: 10
  • Karma: 43
has alpha only works on bitmap has some transparent color value.
white background has alpha value 255.
The administrator has disabled public write access.

AddAnnotBitmap is annotating a captured image 3 years 2 months ago #7103

String imagePath = ..............................................
BitmapFactory.Options opt = new BitmapFactory.Options();
opt.inDither = false;
opt.inPreferredConfig = Bitmap.Config.ARGB_8888;
bitmap = BitmapFactory.decodeFile(imagePath, opt);
bitmap.setHasAlpha(true);
signAdded = page.AddAnnotBitmap(bitmap, true, rect);
This is not working, is there another way I can annot signature without white background


DocGState dgs = m_doc.NewGState();
dgs.SetFillAlpha(0);// set alpha value to 1
dgs.SetStrokeAlpha(255);// set alpha value to 1

I have tried this too. :-(
Last Edit: 3 years 2 months ago by manfcas.
The administrator has disabled public write access.

transparent annotation to capture handwriting... 3 years 2 months ago #7109

public void addRemarksSignature(String imagePath, float[] rect) {
//setCache is set before call to this method
PDFPos pos = m_view.vGetPos((int) rect[0], (int) rect[1]);
PDFVPage vpage = m_view.vGetPage(pos.pageno);
m_view.vRender(vpage);
Page page = vpage.GetPage();
PageContent content = new PageContent();
content.Create();
content.GSSave();
DocGState dgs = m_doc.NewGState();
dgs.SetFillAlpha(255);// set alpha value to 1
dgs.SetStrokeAlpha(255);// set alpha value to 1
Page.ResGState rgs = page.AddResGState(dgs);
content.GSSet(rgs);
BitmapFactory.Options opt = new BitmapFactory.Options();
opt.inDither = false;
opt.inPreferredConfig = Bitmap.Config.ARGB_8888;
Bitmap bitmap = BitmapFactory.decodeFile(imagePath, opt);
DocImage dimg = m_doc.NewImage(bitmap, true);
ResImage rimg = page.AddResImage(dimg);
Matrix mat = new Matrix(80, 80, 80, 400);
content.GSSetMatrix(mat);
mat.Destroy();
content.DrawImage(rimg);
content.GSRestore();
page.AddContent(content, true);
bitmap.recycle();
content.Destroy();
m_view.vRender(vpage);
}


This is still generating a white backgound rather than a tranparent background. Please help.
The administrator has disabled public write access.

transparent annotation to capture handwriting... 3 years 2 months ago #7115

  • radaee
  • radaee's Avatar
  • OFFLINE
  • Moderator
  • Posts: 825
  • Thank you received: 10
  • Karma: 43
plz try a bitmap object loading from a transprent background PNG file, with RGBA color pace.
The administrator has disabled public write access.

transparent annotation to capture handwriting... 3 years 2 months ago #7116

finally, it worked. Thanks a ton.
The administrator has disabled public write access.
Powered by Kunena Forum