Can someone explain how pygame.transform.chop works? The way I would think it works is you put in the coords and size of the section of image you want to chop, then you blit it to a surface, but when I tried to use it it did this
2000000
0111111
0111111
Imagine the picture is the numbers. I was trying to take out the 2 and blit it to a surface, but what the program did was cut out the 2 and the 0s and then blit the 1s. Is it just the fact that I am using an online IDE, or is that not how pygame chop works?
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (3)
As you already discovered, the chop works at the opposite of what you need. You select a cross to remove from an image and the remaining areas are glued together in a new image.
I drew to pictures to better explain what I mean:
If you select a corner, you will observe exactly the behaviour you described (area color meanings are the same of the picture above):
To select a rectangular surface of an image, mainly to get sprites from a spritesheet, you need to use the pygame.Surface.subsurface method. It define a child image of your main one ready to be blitted on a new surface or used as is.
Warning Changes to the main surface or to the subsurface will be reflected on the other one.
thanks for the explanation!
I have used pygame.transform.chop before and it usually takes in a Rect object for defining the section to be chopped. From your description it appears the blitting process might not align with your expectations.
Best Corporate Event Transportation Services in St. Augustine FL