Question: overlaying PNG-8 w/ transparency

From: Date: Tue, 14 May 2002 00:04:03 +0000
Subject: Question: overlaying PNG-8 w/ transparency
Groups: php.general 
Request: Send a blank email to php-general+get-97437@lists.php.net to get a copy of this message
I've been reading through the documentation, and before going further I'll ask if someone's done this before: I'm putting a simple 2d tile-based game together; I have a series of tiles saved as 8-bit PNG images with transparency (the lowest tile has no transparent pixels). I have a bit-vector telling me which overlays I need. I want to take the background and consecutively add on each of the overlays in order. I can load each of the tiles, and I can send a resulting image to the browser; so far, so good. The sticking point is I can't figure out how to lay one partially-transparent image over another. It kind of looks like I have to create a TrueColor image structure, then consecutively load each 8-bit image, turn it into a Brush, and apply it to the canvas... then (optionally) reduce back to a palettized image before sending it to the browser. Is there an easier way to do this ?

« previous php.general (#97437) next »