- Posts: 4
- Thank you received: 0
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
- lokeshgrkumar
- Topic Author
- Offline
- New Member
-
Less
More
IP: 192.168.0.71
11 years 6 months ago - 11 years 6 months ago #7084
by lokeshgrkumar
AddAnnotBitmap is annotating a captured image was created 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
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.
IP: 192.168.0.71
11 years 6 months ago #7092
by radaee
Replied by radaee on topic AddAnnotBitmap is annotating a captured image
has alpha only works on bitmap has some transparent color value.
white background has alpha value 255.
white background has alpha value 255.
- lokeshgrkumar
- Topic Author
- Offline
- New Member
-
Less
More
- Posts: 4
- Thank you received: 0
IP: 192.168.0.71
11 years 6 months ago - 11 years 6 months ago #7103
by lokeshgrkumar
Replied by lokeshgrkumar on topic AddAnnotBitmap is annotating a captured image
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.
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.
- lokeshgrkumar
- Topic Author
- Offline
- New Member
-
Less
More
- Posts: 4
- Thank you received: 0
IP: 192.168.0.71
11 years 6 months ago #7109
by lokeshgrkumar
Replied by lokeshgrkumar on topic transparent annotation to capture handwriting...
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.
//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.
IP: 192.168.0.71
11 years 6 months ago #7115
by radaee
Replied by radaee on topic transparent annotation to capture handwriting...
plz try a bitmap object loading from a transprent background PNG file, with RGBA color pace.
- lokeshgrkumar
- Topic Author
- Offline
- New Member
-
Less
More
- Posts: 4
- Thank you received: 0
IP: 192.168.0.71
11 years 6 months ago #7116
by lokeshgrkumar
Replied by lokeshgrkumar on topic transparent annotation to capture handwriting...
finally, it worked. Thanks a ton.
Time to create page: 0.431 seconds