[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[pygame] Blitting to alpha channel or using another image's alpha channel
- To: pygame-users@xxxxxxxx
- Subject: [pygame] Blitting to alpha channel or using another image's alpha channel
- From: Weeble <clockworksaint@xxxxxxxxx>
- Date: Fri, 19 Dec 2008 02:54:11 +0000
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: pygame-users-outgoing@xxxxxxxx
- Delivered-to: pygame-users@xxxxxxxx
- Delivery-date: Thu, 18 Dec 2008 21:54:16 -0500
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:mime-version:content-type:content-transfer-encoding :content-disposition; bh=ZFl7xCnNEDJGhTRJ7dBXBY1HJD6X0Pu4VRAy9HXTS9o=; b=RmWbEx/uzxJvFjF5Cri0TQ6WdGbHiwG9Wr/F7zTK5ggHsV70KsUa+GGUkiB9hZWnji 1BmNN+6NeiHPrBcQGtpZtInanu7ohgvasjPFWGVgeUPnckHqeszhp+2SS4ei5PgmTCvi 1P97+wZnEyFRZD7RLABA6hQvpHFNkuKO6axpo=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type :content-transfer-encoding:content-disposition; b=RQv8p2JvgvT3kMBq6o6B+azNVDvvXbUJD60WoepKD8ikZEzDP1QNs8ALGbO8/SflUn VjsnDGtuOca3o1XNUWv3dSeNheJYt4cUG3smsid/3gwrjs9LJwFCah+3kIJvyDiLpixO KXA9q6a9+tDVF7sEee0Ia/ZE+tUIKcMIdODAk=
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
Can somebody suggest how to do this? I want to render parts of an
image based on a dynamically generated mask. Right now I'm doing this
by drawing the mask in black and white on another surface, then
iterating over every pixel and changing the alpha value of the source
image to match the red value of the corresponding pixel in the mask
surface, then finally blitting this onto the target surface. This
seems a bit convoluted and I get the feeling there's probably a more
efficient way to do it. Is there a way either to 1. blit an 8-bit
greyscale image directly into the alpha channel of an image, or 2.
directly blit image A onto image B using image C as the alpha channel?