[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] puzzle piece problem.



If you're doing using a predefined image, I think the easiest way is to blit the mask over the image using the foreground as a colorkey, and then set the background of the mask as the color key on the result. This will leave holes in the puzzle piece if the picture contains the background color of the mask though.

--Mike

Joseph king wrote:
That is what i was thinking some one was able to point out that i
could let them Have like a pre made shape that would cut the piece out
in that shape..... and then i thought that you could have what you
discribed after noticing the link to another picture.... the problem i
see now is getting it to cut the picture just so that there would not
be any left over shards from where they did not cut the image
properly.  thanks for the link

On Nov 7, 2007 2:31 PM,  <kschnee@xxxxxxxxxx> wrote:
On Wed, November 7, 2007 3:31 pm, Joseph king wrote:
hey it is me again on the same issue..... thanks for the help but now i am
on to something a little easier if you program a lot. My issue now if you
saw the code that i had which i will repost on this...... creating a
"cookie cutter" to cut out the puzzle piece
shape of where the user wants and size/shape the user wants...... but i
seem to be having an issue with this line of code
Are you proposing to have the user decide not just the position of a
puzzle-piece shape, but the exact shape of the knobs/grooves on the edges?
Rather than coming up with a set of functions for computing possible
shapes, why not draw them in advance?

Say, draw a puzzle piece (try Inkscape), load it, then use that as a
"mask" to copy part of an image. Or draw several versions of the
knobs/grooves that can be combined with a basic rectangle.

<http://kschnee.xepher.net/code/shrubbery.py> has some code that might be
relevant for copying part of one image to another using a pixel-by-pixel
check of a third, "mask" image. A better way to do it might be to use
transparency somehow.