How to draw a line based on mouse move using Raphael.JS - raphael

I am trying to draw a line along with mouse move on a paper. I just know how to draw a line using path. But wanted to know if anyone have ideas to make drawing a line along with mousemove. Please help me on this.

Here a link to such example using raphael
Drawing with Raphael.(Credit:Jonas). (click view->source to see how its done...)
And a jsfiddle that I did just in case(just for back up)
It uses the drag and mousemove events of raphael over a rectangle element...

Related

How to draw a line that shows the border of QGraphicsScene?

I am trying to find draw a thick line around a QGraphicsScene in order to show the borders of it clearly but i could not find any function that does that for me. can you please tell me how i do this?

How to draw multiple circle shape in SFML

i really want to know how to create a multiple circle shapes in SFML.
I know we can create the circle shape with sf::CircleShape
I want to create a circle shape with the same radius everytime i click on my screen and i have no idea how to do that, please help me.
You need to use an event loop to capture mouse events and any other event for that matter. See https://www.sfml-dev.org/tutorials/2.0/window-events.php for details.
Read the documentation or search via Google for more.

How do you make a clickable sprite in SFML?

I've been looking through the SFML documentation for making clickable sprites, but so far I haven't found anything.
Do you guys think you could help me out?
There is nothing like sf::ClickableSprite in SFML so far, and probably there will never be. (Current list of classes in SFML)
However, you can obtain this behavior with the sf::Sprite object and the events. The idea is simple - as soon as you get the sf::Mouse::isButtonPressed(sf::Mouse::Left) event, check if the mouse is in the sprite. If it is, perform the action. You can perform another action (maybe undo) when button is released.
There is sf::Sprite::getGlobalBounds() function which returns you the position and the dimensions of the sprite. There's also sf::Mouse::getPosition() function, which returns the current position of the mouse. You can use sprite.getGlobalBounds().contains(mousePos) to check whether the mouse is in the sprite.
If you're using views, you'll need to add the view's position to sf::Mouse::getPosition(window), since it gets the mouse position relative to window coordinates.
(thanks to Chaosed0 for additional notes.)

Hide mouse cursor in OpenCV

I need to hide the cross-shaped cursor that OpenCV shows when moving the mouse over an image window. Does anybody know if it is possible?
I wanted to add a screenshot, but unfortunately the mouse cursor is not shown in screenshots.
Thanks!
I don't think it's possible with only OpenCV, you have to use OS API or eventually you may use QT(http://www.codeprogress.com/cpp/libraries/qt/QtHideMouseCursor.php#.UjGpZD-rGoE) - it's quite easy to use it with OpenCV.

gtk+ Image draw over image in c++

I would like to draw a simple (red) line over an image with gtkmm (in c++).
I have the image : Gtk::Image *image which is displayed in my window.
But I would like the line to change of position (I mean : draw another line) when a function is called. I need your help because I didn't find how to draw over an existing image...
Thank you for your help !
EDIT : A solution for me would be to overlay the image by an image with alpha channel... but I don't know how to to that :-/
You should not actually draw in the image, instead you draw in the window.
First put the image in the window (blitting or some other means) then draw the line.
See e.g. this link on how to draw straight lines.
Connect to the "expose-event" (GTK2) or "draw" (GTK3) signal of the GtkImage. I think you should use the C++ equivalent of g_signal_connect_after (which in in GObject), and not the g_signal_connect one, so you get a chance of drawing after the image has been drawn, so your drawing is on top of it. To draw you need to use cairomm, and Joachim already gave you a link to a cairomm tutorial.