BLock Image Transfer - Involves copying one bitmap onto another using a raster operator.
Questions tagged [blit]
303 questions
27
votes
3 answers
A bit confused with blitting (Pygame)
I've just started learning some pygame (quite new to programming overall), and I have some very basic questions about how it works.
I haven't found a place yet that explains when I need to blit or not to include a certain surface on the screen. For…

Pabce
- 1,429
- 2
- 13
- 12
26
votes
1 answer
What is the surface.blit() function in pygame? What does it do? How does it work?
I am a beginner in Python and I am not clear about the function surface.blit(). What does it do? How does it works?
I have come across the following points as to how to create it.
Create a canvas of desired size
Create a surface of smaller size…

Lavina Khushlani
- 509
- 2
- 7
- 14
23
votes
4 answers
How do I blit a PNG with some transparency onto a surface in Pygame?
I'm trying to blit a PNG image onto a surface, but the transparent part of the image turns black for some reason, here's the simple code:
screen = pygame.display.set_mode((800, 600), pygame.DOUBLEBUF, 32)
world = pygame.Surface((800, 600),…

Eric
- 339
- 2
- 4
- 6
22
votes
4 answers
What is a Blit in SDL?
In the SDL wiki it says
Use this function to perform a fast blit from the source surface to the destination surface.
However that doesn't help me much.
What does the term surface blitting mean in this context?

Marks
- 221
- 1
- 2
- 3
22
votes
2 answers
Does glBlitFramebuffer copy all color attachments if GL_COLOR_BUFFER_BIT mask is specified?
If I am copying pixels from one FBO to another and each of them have multiple (not necessary the same number) of color attachments, and if my mask is GL_COLOR_BUFFER_BIT, which color attachments (GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1, ....,…

viktorzeid
- 1,521
- 1
- 22
- 35
20
votes
9 answers
The fastest way to check if a type is blittable?
In my serialiser/deserialiser, I have the following snippet:
if (element_type.IsValueType && collection_type.IsArray)
{
try
{
GCHandle h = GCHandle.Alloc(array_object, GCHandleType.Pinned);
int…

sebf
- 2,831
- 5
- 32
- 50
14
votes
2 answers
How to blit() in android?
I'm used to handle graphics with old-school libraries (allegro, GD, pygame), where if I want to copy a part of a bitmap into another... I just use blit.
I'm trying to figure out how to do that in android, and I got very confused.
So... we have these…

o0'.
- 11,739
- 19
- 60
- 87
12
votes
4 answers
How to remove/replace text in pygame
I'm fairly new to pygame and ive hit my first stump which I cannot find an answer for..
After blitting text, then changing the string for the same variable, the game instead of replacing the original text with the new, overlaps the two texts..?

Krazyhornet
- 129
- 1
- 1
- 5
11
votes
3 answers
Pygame. How do I resize a surface and keep all objects within proportionate to the new window size?
If I set a pygame window to resizable and then click and drag on the border of the window the window will get larger but nothing blit onto the surface will get larger with it. (Which is understandable) How would I make it so that when I resize a…

RatstabOfficial
- 479
- 2
- 8
- 14
9
votes
1 answer
Blitting for live update in Tkinter GUI - performance and image overlap issues
I've got some issues about blitting a matplotlib plot, which is itself embedded in a Tkinter GUI - the whole program will eventually run on a Raspberry Pi. The question involves various levels, this is my first question, so sorry in advance for any…

JRMueller
- 91
- 4
9
votes
4 answers
PyGame: Applying transparency to an image with alpha?
I want to display an image with alpha with a specified transparency, but can't figure out how to do it.
To elaborate on how I'm struggling with this, the blurb below is a slightly modified hunk of code from this SO answer, but if you run it, you'll…

Synthead
- 2,162
- 5
- 22
- 25
8
votes
2 answers
SDL: Render Texture on top of another texture
i am having trouble with the following:
I need to render a texture on top of another texture and then render that main texture.
For example I have the blue rectangle texture, and I want to draw red rectangles on top of this blue rect. However i want…

chelo_c
- 1,739
- 3
- 21
- 34
8
votes
12 answers
Is there any way to "clear" a surface?
Is there any way to clear a surface from anything that has been blitted to it?

Eric
- 339
- 2
- 4
- 6
6
votes
2 answers
Blit faster than conditional + pointer increment?
This is my simple blitting function:
static void blit8(unsigned char* dest, unsigned char* src)
{
byte i;
for (i = 0; i < 8; ++i) {
if (*src != 0) {
*dest = *src;
}
++dest;
++src;
}
}
I'm…

Accumulator
- 873
- 1
- 13
- 34
6
votes
1 answer
Convert rectangle to surface in pygame
In my code it keeps giving me the error:
pygame.surface.Surface.blit(a, (x1, y1))
TypeError: descriptor 'blit' requires a 'pygame.Surface' object but received a 'pygame.Rect'.
Help!
This is my code:
import pygame
import time
pygame.init()
screen…

henry
- 103
- 1
- 7