[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] Re: using alpha for a circle
Greg Ewing wrote:
Jan Filip Tristan wrote:
either I made a mistake or it doesn't work with Screen as a Surface
screen=pygame.display.set_mode(SCREEN_SIZE,pygame.SRCALPHA,32)
pygame.draw.circle(screen,(200,200,255,0.4)
(self.blit_pos[0],self.blit_pos[1]),int(gdata.cans[self.akt][1]))
Something doesn't make sense here. I don't understand why
the *destination* surface should need an alpha channel in
order to draw onto it with a partially transparent colour.
Here is an example:
import pygame
import os, sys
pygame.init()
screen = pygame.display.set_mode((500,500), pygame.RESIZABLE)
screen.fill((255, 0, 0))
s = pygame.Surface(screen.get_size(), pygame.SRCALPHA, 32)
s.fill((255, 255, 255, 255))
pygame.draw.circle(s, (0, 0, 225, 255), (250, 100), 80, 5)
pygame.draw.circle(s, (0, 0, 255, 192), (255, 400), 80, 5)
screen.blit(s, (0, 0))
pygame.display.flip()
while 1:
event = pygame.event.wait()
if event.type == pygame.QUIT:
break
pygame.display.flip()
pygame.quit()
The bottom circle is purple, not light blue. Drawing is a fill
operation. The alpha value is part of the color copied to the surfaces
pixels.
--
Lenard Lindstrom
<len-l@xxxxxxxxx>