RPGDXThe center of Indie-RPG gaming
Not logged in. [log in] [register]
 
Drawing unbroken freehand lines with the mouse
 
Post new topic Reply to topic  
View previous topic - View next topic  
Author Message
tcaudilllg
Dragonmaster


Joined: 20 Jun 2002
Posts: 1731
Location: Cedar Bluff, VA

PostPosted: Mon Aug 24, 2009 3:34 pm    Post subject: Drawing unbroken freehand lines with the mouse [quote]

How is it done?
Back to top  
DeveloperX
202192397


Joined: 04 May 2003
Posts: 1626
Location: Decatur, IL, USA

PostPosted: Mon Aug 24, 2009 3:56 pm    Post subject: [quote]

Typically by tracking the previous location and drawing a line from the previous location to the current location.
_________________
Principal Software Architect
Rambling Indie Games, LLC

See my professional portfolio
Back to top  
Ninkazu
Demon Hunter


Joined: 08 Aug 2002
Posts: 945
Location: Location:

PostPosted: Mon Aug 24, 2009 5:43 pm    Post subject: [quote]

The man speaks truth.
Back to top  
tcaudilllg
Dragonmaster


Joined: 20 Jun 2002
Posts: 1731
Location: Cedar Bluff, VA

PostPosted: Mon Aug 24, 2009 5:44 pm    Post subject: [quote]

How does Windows do it? I swear the Z-Soft algorithm is superior. MS Paint doesn't use lines, I don't think.
Back to top  
DeveloperX
202192397


Joined: 04 May 2003
Posts: 1626
Location: Decatur, IL, USA

PostPosted: Mon Aug 24, 2009 11:03 pm    Post subject: [quote]

LordGalbalan wrote:
How does Windows do it? I swear the Z-Soft algorithm is superior. MS Paint doesn't use lines, I don't think.


#1 As I said above.
#2 what are you talking about Z-Soft algorithm?
#3 Yes it does. Run mspaint.exe through Boomerang and spend about a week reading the code.
_________________
Principal Software Architect
Rambling Indie Games, LLC

See my professional portfolio
Back to top  
tcaudilllg
Dragonmaster


Joined: 20 Jun 2002
Posts: 1731
Location: Cedar Bluff, VA

PostPosted: Wed Aug 26, 2009 6:28 pm    Post subject: [quote]

Well then, I would have thought it'd use a curve algorithm, but I guess not. Thanks for looking that up, though.
Back to top  
Malignus
Scholar


Joined: 12 May 2009
Posts: 198

PostPosted: Wed Aug 26, 2009 9:29 pm    Post subject: [quote]

Most modern graphics programs let you draw in a straight line by simply holding down Shift while you draw.

In Paint Shop Pro (which I use), you click once, hold down Shift, then click a second time, and a line will be generated with those clicks as its endpoints using your current brush settings as if you had drawn it by hand.
Back to top  
DeveloperX
202192397


Joined: 04 May 2003
Posts: 1626
Location: Decatur, IL, USA

PostPosted: Thu Aug 27, 2009 2:45 am    Post subject: [quote]

he was asking as a programmer..not as a user.

He wanted to know how it was implemented, and also, he wanted freehand lines, not straight lines.

I'm guessing he wanted to know how to avoid the "spattering" of pixels that you get when you write your first drawing program that draws a pixel at the mouse's position on the drawing surface bitmap.
_________________
Principal Software Architect
Rambling Indie Games, LLC

See my professional portfolio
Back to top  
tcaudilllg
Dragonmaster


Joined: 20 Jun 2002
Posts: 1731
Location: Cedar Bluff, VA

PostPosted: Fri Aug 28, 2009 1:26 am    Post subject: [quote]

Exactly.
Back to top  
Malignus
Scholar


Joined: 12 May 2009
Posts: 198

PostPosted: Fri Aug 28, 2009 5:35 pm    Post subject: [quote]

Ah, okay. N/m.
Back to top  
tcaudilllg
Dragonmaster


Joined: 20 Jun 2002
Posts: 1731
Location: Cedar Bluff, VA

PostPosted: Sun Aug 30, 2009 6:04 pm    Post subject: [quote]

How fast is the timer kernel Windows uses for that stuff? I know the normal mouse rate is 18 discrete positions per sec. Does Windows use a better rate?
Back to top  
DeveloperX
202192397


Joined: 04 May 2003
Posts: 1626
Location: Decatur, IL, USA

PostPosted: Mon Aug 31, 2009 2:54 am    Post subject: [quote]

http://www.codinghorror.com/blog/archives/000832.html

Unless I'm mistaken, that fully depends on the mouse and the driver(s) being used.

If you're interested in Windows' ways, go read through this.

http://msdn.microsoft.com/en-us/library/ms645533%28VS.85%29.aspx
_________________
Principal Software Architect
Rambling Indie Games, LLC

See my professional portfolio
Back to top  
Post new topic Reply to topic Page 1 of 1 All times are GMT
 



Display posts from previous:   
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum