riccardomoro / freedrawview Goto Github PK
View Code? Open in Web Editor NEWA View on which you can freely draw, customizing paint width, alpha and color, and take a screenshot of the content. Useful for note apps, signatures or free hand writing.
A View on which you can freely draw, customizing paint width, alpha and color, and take a screenshot of the content. Useful for note apps, signatures or free hand writing.
How can I set the bitmap as a background for DrawView? Suppose I drew something, saved somewhere bitmap or file. I transferred this file to another device and I want to continue drawing my drawing. If I could install a background from a bitmap or file, this would solve the problem, but at the moment it can only be installed from resources.
Read Bitmap from a file and load it to FreeDrawView.
Hi,
Is it possible to have a transparent background?
I want to put a TextView below the PaintView.
Thank you.
Could we perhaps make FreeDrawView an ImageView?
This could be useful when drawing on pictures.
I have tried making FreeDrawView extend ImageView rather than simple view but then setImageBitmap method of ImageView did not work - the background would not change.
Without calling setOnPathDrawnListener()
on the FreeDrawView
, I get an error:
java.lang.NullPointerException: Attempt to invoke interface method 'void com.rm.freedrawview.PathDrawnListener.onPathStart()' on a null object reference
Once I call the method, even while leaving the callbacks empty, everything is fine.
To be able to edit an old drawing.
How can we detect if the user has stopped drawing?
Hello RiccardoMoro!
FreeDrawSerializableState#getCurrentViewStateAsSerializable()
returns
new FreeDrawSerializableState(mCanceledPaths, mPaths, getPaintColor(),
getPaintAlpha(), getPaintWidth(), getResizeBehaviour(),
mLastDimensionW, mLastDimensionH);
with mCanceledPaths, mPaths as pointers to respective arraylists, such that changes are represented both on the original and the copy.
If thats not intended behaviour, i would suggest returning hard copies.
Thanks for the hard work! Much love.
Huy
If you want to disable/enable draw mode do something like this:
void disableDrawMode(){
mFreeDrawView.setFocusableInTouchMode(false);
mFreeDrawView.setFocusable(false);
mFreeDrawView.setClickable(false);
mFreeDrawView.setEnabled(false);
}
void enableDrawMode(){
mFreeDrawView.setFocusableInTouchMode(true);
mFreeDrawView.setFocusable(true);
mFreeDrawView.setClickable(true);
mFreeDrawView.setEnabled(true);
}
Thanks for this Awesome Work !
I found this two Listeners not working as it has to be !
removePathDrawnListener and setPathRedoUndoCountChangeListener either setting it null manually not making any change.
mFreeDrawView.setOnPathDrawnListener(null);
mFreeDrawView.setPathRedoUndoCountChangeListener(null);
i want to stop drawing when user done with it on button click event.
any ways to do it ?
This library is very useful hopefully you can include a shader so you can paint image tiles from a bitmap into the FreeDrawView. Like the example below.
val shader = BitmapShader(resource,Shader.TileMode.REPEAT,Shader.TileMode.REPEAT)
FreeDrawView.paint.setShader(shader)
is there any way to get bitmap of this FreeDrawView
as this listener is also always giving error
mSignatureView.getDrawScreenshot(new FreeDrawView.DrawCreatorListener() { @Override public void onDrawCreated(Bitmap draw) { // The draw Bitmap is the drawn content of the View } @Override public void onDrawCreationError() { // Something went wrong creating the bitmap, should never // happen unless the async task has been canceled } });
When i use getDrawScreenshot() method, i get this error "width and height must be > 0" in here
FreeDrawView.java:743
try {
mBitmap = Bitmap.createBitmap(
mWidth, mHeight, Bitmap.Config.ARGB_8888);
mCanvas = new Canvas(mBitmap);
} catch (Exception e) {
e.printStackTrace();
cancel(true);
}
return null;
can you help me?
I want to get the path points of lines (ex: [1,1],[2,2],[8,7]....).
It seems Lib doesn't have function like that.
I try to set setOnTouchListener to canvas.
It can return the path point, but canvas can't draw anymore.
I solved this issue by create a new class extent Lib, and modified the onTouch fucntion.
Hi, it is nice job. but wanna to know whether support eraser? If not, i feel free to implement it.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.