blending

Changing colour of a surface without overwriting transparency

Changing colour of a surface without overwriting transparency Question: I want to change the colour of a rect dynamically during runtime. Currently set_colour is filling all of the pixels of the surface with a single colour value. This works, but an issue arises when a method like set_outline is called, which modifies the transparency of …

Total answers: 1

Setting a pygame surface to have rounded corners

Setting a pygame surface to have rounded corners Question: This Rectangle class extends from pygame.sprite. I’d like to use set_rounded to modify how round the corners of the rect are. For example https://imgur.com/2N5NHlg class Rectangle(pg.sprite.Sprite): def __init__(self): pg.sprite.Sprite.__init__(self) self.original_image = pg.Surface((10, 10)) self.image = self.original_image self.rect = self.image.get_rect() def set_rounded(self, roundness): pass The roundness argument …

Total answers: 1

Is it possible to do additive blending with matplotlib?

Is it possible to do additive blending with matplotlib? Question: When dealing with overlapping high density scatter or line plots of different colors it can be convenient to implement additive blending schemes, where the RGB colors of each marker add together to produce the final color in the canvas. This is a common operation in …

Total answers: 2