This site is no longer active and is available for archival purposes only. Registration and login is disabled.

Surface Masking


Surface Masking

Postby Bapdude » Jun 1, 2004 @ 7:19am

User avatar
Bapdude
pm Member
 
Posts: 140
Joined: May 14, 2004 @ 5:06am


Postby fast_rx » Jun 1, 2004 @ 5:09pm

Go ahead and apply the mask to your image in the editor and use
img->SetColorMask(Color(255,0,255));
after loading your image.

This will NOT draw any areas that contain the color 255,0,255 (or whatever color you wish to use).
User avatar
fast_rx
pm Member
 
Posts: 660
Joined: Jun 10, 2003 @ 4:24pm


Postby Bapdude » Jun 1, 2004 @ 5:27pm

Well, that's really not "masking"...that's "transparency". Doing as you said will require me to have multiple images instead of just 1 image.

For example, if I have an image of a ball and I want the image to slowly shrink, I can take a single image and apply different masks to achieve this result. Each mask will be smaller and smaller which, when applied to the image, will give the effect that the ball is shrinking.

If I use a color mask, I will have to have many images (for each frame of the ball shrinking). Of course, I guess either way, I have to have multiple images OR multiple masks. Perhaps this is my only option in PF...I was just hoping there was a better solution.

Thanks for your input!
:D
User avatar
Bapdude
pm Member
 
Posts: 140
Joined: May 14, 2004 @ 5:06am


Postby Conan » Jun 1, 2004 @ 6:41pm

I think it would be useful to know exactly what you are trying to achieve.

There are no built-in masking functions though if you search this & other forums they are discussed here & there. GD uses masks for pixel perfect collision detection for instance.

Your suggestion re a shrinking ball does not sound like a good way to achieve this given that PF can already scale & rotate directly. For simple sprites which have pixels on or off the transparency method works just fine & alpha blending allows semi-transparent parts.

Anyway I'm sure if you explain your aim we can all help more re: what PocketFrog can do.
What is Best in Life ?
User avatar
Conan
pm Member
 
Posts: 1309
Joined: Dec 24, 2001 @ 5:16am
Location: the Shades, Ankh-Morpock


Postby fast_rx » Jun 1, 2004 @ 6:43pm

Shrinking the mask and not the ball wouldn't really give the effect that the ball is shrinking - would it? You could blit the color key onto the image in order to do that.

Or, you can scale blit with a mask, which would make the ball shrink...


I have written my own modifications to PF that take 2 surfaces as an input - using one for an alpha mask and one as an image source. This does allow something similar to what you were wanting - in that you can animate the mask separately from the image. This requires modifying several of the frog source files. If you're really interested, maybe I can post some directions.
User avatar
fast_rx
pm Member
 
Posts: 660
Joined: Jun 10, 2003 @ 4:24pm


Postby Bapdude » Jun 1, 2004 @ 7:35pm

Thanks guys...I appreciate your responses. Now that I think about it, you are right. Shrinking the mask, doesn't really shrink the ball...it only draws less and less of the original image.

I'm currently working on a puzzle game with game pieces that "dissolve" when they are removed from the board. I'm trying to give the effect that the "ball" pieces are shrinking until they disappear. There are different shaped pieces, so not all of them are round. I figured the best option would be a mask for each type of shape.

I suppose the easiest option is to create multiple images for each frame and then cycle thru these images to create the animation. Perhaps this is better than using a mask because it would be faster and require less CPU overhead.

Yeah, I could scale blit to achieve the desired effect, but this would certainly require more CPU cycles. I'm already fighting to stay above 20 FPS on my Dell Axim.
User avatar
Bapdude
pm Member
 
Posts: 140
Joined: May 14, 2004 @ 5:06am


Postby fzammetti » Jun 1, 2004 @ 7:49pm

How big are your balls? (Groan...)

Your comment that your fighting to stay above 20FPS makes me wonder if you might not be doing some inefficient things besides, unless you've got really big balls (sorry, couldn't resist ;) ) because a stretchBlt shouldn't kill your performance that much if your balls aren't huge (can't... stop... myself...)

Just curious because in K&G Arcade I do stretches and rotations in a couple of places with a fair amount of other stuff going on at the same time and I'm getting 24FPS on my Axim Basic with no trouble (it's hard-coded to 24, otherwise it would be higher).
...and so I said to Mr. Gates: "$640 billion should be enough for anyone!"
User avatar
fzammetti
pm Insider
 
Posts: 1496
Joined: Jun 4, 2002 @ 6:21pm
Location: Omnytex Technologies


Postby Bapdude » Jun 1, 2004 @ 8:44pm

User avatar
Bapdude
pm Member
 
Posts: 140
Joined: May 14, 2004 @ 5:06am


Postby fzammetti » Jun 1, 2004 @ 8:54pm

...and so I said to Mr. Gates: "$640 billion should be enough for anyone!"
User avatar
fzammetti
pm Insider
 
Posts: 1496
Joined: Jun 4, 2002 @ 6:21pm
Location: Omnytex Technologies


Postby Bapdude » Jun 1, 2004 @ 9:48pm

User avatar
Bapdude
pm Member
 
Posts: 140
Joined: May 14, 2004 @ 5:06am


Postby adde » Jun 4, 2004 @ 4:43am

User avatar
adde
pm Member
 
Posts: 152
Joined: Oct 9, 2002 @ 1:42pm
Location: Stockholm / Sweden


Return to PocketFrog & PocketHAL


Sort


Forum Description

SDKs for fast and robust device-independent access to Pocket PC display hardware.

Moderators:

sponge, Kzinti

Forum permissions

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum