Microsoft Windows Phone 8.1 support ends (13 Jul 2017)

Microsoft has ended support for Windows Phone 8.1

Questions about Android development and PDF

AddAnnotBitmap is annotating a captured image

More
IP: 192.168.0.71 11 years 6 months ago - 11 years 6 months ago #7084 by lokeshgrkumar
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: 11 years 6 months ago by manfcas.
More
IP: 192.168.0.71 11 years 6 months ago #7092 by radaee
has alpha only works on bitmap has some transparent color value.
white background has alpha value 255.
More
IP: 192.168.0.71 11 years 6 months ago - 11 years 6 months ago #7103 by lokeshgrkumar
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: 11 years 6 months ago by manfcas.
More
IP: 192.168.0.71 11 years 6 months ago #7109 by lokeshgrkumar
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.
More
IP: 192.168.0.71 11 years 6 months ago #7115 by radaee
plz try a bitmap object loading from a transprent background PNG file, with RGBA color pace.
More
IP: 192.168.0.71 11 years 6 months ago #7116 by lokeshgrkumar
finally, it worked. Thanks a ton.
Time to create page: 0.431 seconds
Powered by Kunena Forum