bouvard jean-christophe's Library tagged → View Popular
How to create MS Paint clone with Python and pygame - Stack Overflow
As I see it, there are two ways to handle mouse events to draw a picture.
The first is to detect when the mouse moves and draw a line to where the mouse is, shown here. However, the problem with this is that with a large brush size, many gaps appear between each "line" that is not straight since it is using the line's stroke size to create thick lines.
The other way is to draw circles when the mouse moves as is shown here. The problem with this is that gaps appear between each circle if the mouse moves faster than the computer detects mouse input.
Here's a screenshot with my issues with both: http://imgur.com/32DXN
What is the best way to implement a brush like MS Paint's, with a decently-big brush size with no gaps in the stroke of the line or no gaps between each circle?
-
As I see it, there are two ways to handle mouse events to draw a picture.
The first is to detect when the mouse moves and draw a line to where the mouse is, shown here. However, the problem with this is that with a large brush size, many gaps appear between each "line" that is not straight since it is using the line's stroke size to create thick lines.
The other way is to draw circles when the mouse moves as is shown here. The problem with this is that gaps appear between each circle if the mouse moves faster than the computer detects mouse input.
Here's a screenshot with my issues with both: http://imgur.com/32DXN
What is the best way to implement a brush like MS Paint's, with a decently-big brush size with no gaps in the stroke of the line or no gaps between each circle?
Re: [pygame] sprite engine Top this!
-
# Redraw part of screen
R = rect.clip(self.rect)
i = R.collidelist(self.dirtyrects)
if i > -1:
# Add to existing dirty rectangle
while i > -1:
R.union_ip(self.dirtyrects[i])
del self.dirtyrects[i]
i = R.collidelist(self.dirtyrects)
self.dirtyrects.append(R)
pygame Code Repository
-
Description: A function to display an inputbox and return the inputted text string.
Selected Tags
Related Tags
Sponsored Links
Top Contributors
Groups interested in pygame
-
Computer Programming
These are resources for my ...
Items: 5 | Visits: 9
Created by: Michael Surran
Diigo is about better ways to research, share and collaborate on information. Learn more »
Join Diigo
