|
-
Feb 20th, 2015, 12:35 AM
#1
Thread Starter
New Member
Layering images in a picture box?
A friend of mine found a kind of work around in layering picture boxes but the more I work on my project the more I'm realizing that isn't going to really cut it. How exactly would I get images to layer in a picture box (i.e. I'm making a pixel sprite using a base body and I want to layer other things such as hair and clothes on top). I'm thinking I'd have to give it some kind of Z value for layering but I'm not really sure how to go through with that and google hasn't been much help. Suggestions please? ; w ;
-
Feb 20th, 2015, 07:42 AM
#2
Re: Layering images in a picture box?
If you create an new empty bitmap, it is filled with 0's, which means the pixels are completely transparent if the image is drawn onto another image or bitmap.
If you draw some hair, or glasses, or some other thing in one of those bitmaps, the pixels you don't draw on will still be transparent, only the pixels you drew will be opaque, assuming you used opaque colors. You could use colors with alpha values less than 255 and those pixels would actually be "translucent", and the colors would blend with the existing colors when drawn, allowing the underneath colors to "show through".
So, if you've created a number of these bitmaps with various items, then it just a matter of drawing them in an order that makes sense.
Perhaps create a class or structure that holds the bitmap, and a layer value so you draw the base image first, then perhaps body features (hair, mustache, beard), then accoutrements (glasses, watch, socks), then outer cloths, etc.
Perhaps have a list for a person that strings these things together in order they are to be drawn, and allow changing the order if necessary.
The order that you draw the items, is the Z order of the items, first drawn is the lowest Z order.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|