Closed andreasql closed 3 years ago
Hi Andrea,
Bitmap sampleBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.sample);
Bitmap mutableBitmap = sampleBitmap.copy(Bitmap.Config.ARGB_8888, true);
signatureView.setBitmap(mutableBitmap);
I used a sample image of 191kb of size 1024 x 576, and above code worked for me. If with this code your app still freeze, then you can do this on background thread. I think you will have to make some changes in library, as per your requirement.
I think, I can provide this feature properly (& also via xml using background attribute). Due to lack of time, it will take sometime.
hi Syed Zahid, thanks, it actually works :)
I'm trying now to "print" some text on the underlying bitmap accepting the signature... I'd like to do something like getting the Canvas(underlyingBmp) and use it to canvas.drawText(text, x, y, p); but it seems to me that the object's.getSignatureBitmap(); returns null until some stroke has been set on the container... am I missing something? the object is actually initialized like if (m_signImage == null){ m_signImage = (SignatureView) getView().findViewById(R.id.img2sign); } m_signImage.setEnableSignature(false); m_signImage.clearCanvas();
// some pre-work action, getting the underlying bitmap m_signImage.setBitmap(mutableBitmap); m_signImage.setEnableSignature(true);
// now here I'd like to draw some text/lines/shape as well.. .... what here??
do you have a workaround for that? TIA -- Andrea
dear All, dear Zahid Ali, first of all please excuse my poor english and my poor expertise in Android dev... I'm actually a Visual Studio develeper and I'm often in troubles the limited time I spend in Android Studio, even more as it changes every time I do start it :) I found reference to this piece of work of yours on stack overflow forum, as I'm required to capture "strokes and electronic signature" on some bitmaps/jpegs for later references.. your work has been strongly suggested and I downloaded it... again, working that little with Android Studio I was unable to reference your "jar" as you recommend in your "getting started" section, so I ended up copying your 2 base classes into my project and... of course, it works... as expected :)
but my need is to capture strokes/signature on a base jpeg I've to load from device storage... I've seen a method I thought were there for the purpose... having SignatureView m_signImage; I tried Bitmap bitmap = BitmapFactory.decodeFile( fileName ); m_signImage.setBitmap( bitmap );
(and bitmap is acttually correclty loaded from the file system with the desired jpg file, a 49,9 kb picture which is defined as 1024 x 576) to show the "underlying" bitmap into the canvas, but I do actually have no visual result of the loade jpeg and the running application freezes in
SignatureView . public void setBitmap(Bitmap bitmap) { if (bitmap != null) { bmp = bitmap; canvasBmp = new Canvas(bitmap); // <---- freeze postInvalidate(); } }
so I do assume I'm making something wrong, of course... can you please provide further info about what I'm doing wrong? TIA, Andrea