korilakkuma / canvasview Goto Github PK
View Code? Open in Web Editor NEWAndroid Application Library
License: Other
Android Application Library
License: Other
When i select canvasview textmode i am not able to write any text
Eraser not working if alpha 1.0, must do alpha 0.99 or less to make it work...
<com.bla.bla.bla.utils.CanvasView
android:id="@+id/canvas"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:alpha="0.99"/>
I found a bug when drawing with rectangle and move upside
This bug found in method: onActionMove class CanvasView
You can fix this by:
from
case RECTANGLE :
path.reset();
path.addRect(this.startX, this.startY, x, y, Path.Direction.CCW);
break;
to
case RECTANGLE :
path.reset();
float sX = this.startX;
float sY = this.startY;
float eX = x;
float eY = y;
if(sX > eX){
sX = x;
eX = this.startX;
}
if(sY > eY){
sY = y;
eY = this.startY;
}
path.addRect(sX, sY, eX, eY, Path.Direction.CCW);
hi,how i can change brush color?? for example 'red,white,blue'
I can't erase canvas with PorterDuffXfermode(PorterDuff.Mode.CLEAR)
Do you know if it's possible ?
Selected Images are not zoom in/out with pitch or pan zooming. @Korilakkuma How can I give zooming with CanvasView.
I'm making drawing tools these days.
I added a method because I needed a way to set whether I could draw CanvasView.
Leave comments if you think you need someone else.
I'll look at your answers and request a "Pull requests".
Is it planned to add this library to maven ? It would be very useful and more developers would use it :) Thanks!
When I call getBitmap on the CanvasView it is not preserving my transparent background, instead it appears black. This is not the case if I set the BaseColor to be anything other than transparent.
Hi, Eraser is not done correctly what actually does is just paint with a white color.
Having a text on its own is useless, it has to be something the undo/redo functionality actually applies to.
How can i set different texts? it seems i can only put 1 text on canvas.
I used your code and i try to make eraser code which's i'm not able to did,so can you please help me how to make eraser
After clearing screen drawing becomes laggy..
Also eraser is not clearing the drawing its changing stoke color to white. It doesn't works on other background color.
Hi Friend,
I hope there is a answer of my Question. I want to change Mode, Drawer, PaintStrokeWidth on button click. Currently I wrote the code
btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { canvas.setMode(CanvasView.Mode.ERASER); } });
but it is not changing the mode to Eraser.
How can I get this Library dependencies?
How to Re-enable all settings disabled ,e.g., by disableSettings() method.
how to Draw a hollow rectangle
this.canvas.setMode(CanvasView.Mode.DRAW); // for drawing
this.canvas.setBaseColor(Color.BLUE);
this.canvas.setPaintStyle(Paint.Style.STROKE);
this.canvas.setPaintStrokeWidth(20F);
this.canvas.setPaintStrokeColor(Color.RED);
this.canvas.setDrawer(CanvasView.Drawer.RECTANGLE); // Draw Rectangle
this.canvas.setLineCap(Paint.Cap.SQUARE);
this.canvas.setBlur(5F);
I try this,but no used
I try to use your code but the eraser is not working,how can i use it
I have put
canvas.setBaseColor(Color.TRANSPARENT);
because I have an imageview below canvas, for my simple photo/image doodle editor.
But whenever I call canvas.clear(), the whole screens goes white. And if I using eraser on canvas the below image/photo appears. I figure out that the base color has change to white because of something inside clear void.
So I try removing or replacing paint.setColor(Color.WHITE) to paint.setColor(baseColor) inside clear() void. Testing the base color to regular color(red,blue,etc) will work. But if I put Color.TRANSPARENT will make it clear NOTHING at all.
drawText works fine when we are calling it on canvas but when we save the image the text takes up some weird font and changes it's orientation from horizontal to vertical.
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.