Unlimited canvas painting program

M

markotaht

How to create a program similar to paint, but the difference would be that the cursor would be always in the middle and the canvas moves or the camerais always fixed on the cursor as it moves around the canvas. And the canvas should be infinite. What would be reasonable to use?

In addition, i want it to draw a line whidout me having to press a button, just move the mouse.

Ill try to think a better way to describe, what i want, but for now i hope this is sufficient and clear enough.
 
M

markotaht

So, i`ll take the canvas, somekind of mouse tracker, for each mouse location il draw a dot or 2X2 square or something. Main thing i have never understood, is how can i get the backround to move.

Lets say ia hve 200X200 window. In the middle of it is the cursor that draws. If i move the mouse the cursor doesent move, but the canvas moves. So ifi move mouse to the left, i get a line that goes to the left. So i probably must invert the canvas movement. If mouse goes left, canvas goes right.

And if possible i would like to save my piece of art aswell :D
 
M

MRAB

So, i`ll take the canvas, somekind of mouse tracker, for each mouse
location il draw a dot or 2X2 square or something. Main thing i have
never understood, is how can i get the backround to move.

Lets say ia hve 200X200 window. In the middle of it is the cursor
that draws. If i move the mouse the cursor doesent move, but the
canvas moves. So if i move mouse to the left, i get a line that goes
to the left. So i probably must invert the canvas movement. If mouse
goes left, canvas goes right.

And if possible i would like to save my piece of art aswell :D
I think it'll be confusing because it goes against how every other
program does it!

In a painting program you can point to other things, such as tools, but
if the cursor never moves...

It would be simpler, IMHO, if you just moved the canvas and stopped the
cursor going off the canvas when the user is drawing near the edge, so
that the user doesn't need to stop drawing in order to expose more of
the canvas.
 
T

Tim Chase

How to create a program similar to paint, but the difference would
be that the cursor would be always in the middle and the canvas
moves or the camera is always fixed on the cursor as it moves
around the canvas. And the canvas should be infinite. What would be
reasonable to use?

To hold an (effectively) infinite *bitmap* canvas, you'd (effectively)
need an (effectively) infinite amount of memory. However, it could be
done with an (effectively) infinite *vector* canvas. That way you
could limit the on-screen rendering to just the clipped subset of the
vector collection.

You'd still want to make it easy to toggle between "draw" and "stop
drawing", but you could make a mouse-click.

To implement, just pick a GUI library tkinter, wx, or whatver.

-tkc
 
G

Grant Edwards

To hold an (effectively) infinite *bitmap* canvas, you'd (effectively)
need an (effectively) infinite amount of memory.

Sparse arrays allow it to be sort-of implemented as long as most of
the bitmap is "empty".
However, it could be done with an (effectively) infinite *vector*
canvas.

Sort of. Eventually you run out of bits to hold the coordinates.
That way you could limit the on-screen rendering to just the
clipped subset of the vector collection.

The same can be done for a sparse array of bitmap subsets.
 
T

Tim Chase

Sparse arrays allow it to be sort-of implemented as long as most of
the bitmap is "empty".

Fair enough. Raw bitmap canvas eats memory like a ravenous dog. But
a smarter sparse array would certainly ameliorate the problem well.

-tkc
 
A

Albert van der Horst

I think it'll be confusing because it goes against how every other
program does it!

In a painting program you can point to other things, such as tools, but
if the cursor never moves...

It would be simpler, IMHO, if you just moved the canvas and stopped the
cursor going off the canvas when the user is drawing near the edge, so
that the user doesn't need to stop drawing in order to expose more of
the canvas.

A trick that is used in the editor I'm currently using is to do
normal cursor movement, until you are within a certain range from
the border. At that point you move the window over the canvas
in order to keep the cursor in the middle part of the canvas.
This can be done in discrete steps, and is not too disruptive.
Even if you do it continuously, it is more intuitive (but functionally
equivalent to) keeping the cursor in the middle.

A problem that remains is that a mouse is not intended for an infinite
canvas. At some point you will have to lift it and place it back on the
pad.

Groetjes Albert
 
C

Chris Angelico

A problem that remains is that a mouse is not intended for an infinite
canvas. At some point you will have to lift it and place it back on the
pad.

Only if you're talking about the physical grasp mouse, which is
probably the most common household mouse, or the touchpad, probably
the next most common. With a stick mouse (IBM calls it a TrackPoint),
you can carry on to infinity; same with a roller ball. But yes, a lot
of mouse designs aren't built for infinity.

ChrisA
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top