Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Sprite masking. A confusing problem.

Author
Message
Non Sequitur M
17
Years of Service
User Offline
Joined: 28th Oct 2008
Location: Where am I!? Where are YOU?
Posted: 23rd Apr 2010 21:33 Edited at: 24th Apr 2010 19:07
So, I recently realized that DBPro has only a static sprite mask(wherein, a single color is treated as a mask.), yet I needed a free moving mask. Well, I set about coding a memblock based mask system, that in the end turned out to function almost perfectly and efficiently. I have three memblocks... The original image that the section to be masked is copied from, the memblock containing the data of the mask itself, and the memblock to which the section from the original image is to be copied. I ran into one problem(which I have now fixed, with a somewhat crude fix ). The mask was 200x200 and the image cutout used is also 200x200. Yet, when I apply the mask to the image, lo and behold, the mask was too large! I measured and remeasured, but I kept coming up with the same answer. The two set of image data are both the same exact size! The crude fix mentioned was to resize the mask to 156x156(Not the size of the canvas, that produced errors, only the size of the image). Then the mask fit the image perfectly! Why would I need a mask of 156x156 for a 200x200 image?

*EDIT* Okay, I made a ZIP. It's in attachments. Just change screen resolution to your native screen size. On some smaller resolutions, the images might be a little large(As my screen is 1280x800). To see the 200x200 mask in action just change Mask.png to Mask2.png in the code.

Thanks in advance, Amo Deus.

If life were like a box of chocolates, I'd know what I would get... The one that got dropped on the floor and put back in the box.

Iye nehvur yoose spehl chehk, ahn mie tippyng izz fiyne.
Non Sequitur M
17
Years of Service
User Offline
Joined: 28th Oct 2008
Location: Where am I!? Where are YOU?
Posted: 27th Apr 2010 01:07
Is this too technical or did I not format my post correctly? Why am I not even getting any guesses? Help would be greatly appreciated.

If life were like a box of chocolates, I'd know what I would get... The one that got dropped on the floor and put back in the box.

Iye nehvur yoose spehl chehk, ahn mie tippyng izz fiyne.

Login to post a reply

Server time is: 2026-07-26 04:27:14
Your offset time is: 2026-07-26 04:27:14