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 / Lines disappear when the sprite is resized

Author
Message
instinto criador
19
Years of Service
User Offline
Joined: 19th Dec 2006
Location:
Posted: 6th Oct 2012 23:44 Edited at: 6th Oct 2012 23:52
Why edge sprite's lines disappear when the sprite is resized for below of 50% or they are increased when are resized above 50% from your original size? Thank you! Sorry for my english.

Lucas Tiridath
AGK Developer
17
Years of Service
User Offline
Joined: 28th Sep 2008
Location: Kings Langley, UK
Posted: 7th Oct 2012 10:08
Quote: "Why edge sprite's lines disappear when the sprite is resized for below of 50% or they are increased when are resized above 50% from your original size?"

Well when you procedurally shrink a sprite, you cannot keep all the pixels because there are not enough across. You can't draw 100px across a 50px wide sprite. As your sprite's size decreases, more and more lines are going to be lost. By the time you reach 50%, 1 in 2 lines is going to have disappeared. As your borders are just 1px across, if their line of pixels is selected to be removed, they will appear to disappear. The same is true of increasing the size. The additional width has to be artificially generated, basically by duplicating lines of pixels. Thus you will see your borders double in width (to 2px) when it reaches 150%.

Now the thing is that you have the screen resolution set incredibly low.

One way to get around this problem is to use a higher screen resolution and have borders that are more pixels across. That way, although lines will still be eliminated, you are unlikely to lose the entire border. The more pixels you can have, the nicer the scaling will look because you can have more levels of details. The borders will still change in size because they are part of the image and the entire image is being stretched but they will remain in closer proportion to the image.

Consider this example. You sill see that the lines will still disappear eventually but it can get smaller before they do than your example.


If what you want however is to have borders that are always the same width, regardless of scaling, you will need to have them as separate sprites so that they are not affected by altering the size of the main sprite.

Hope that helps.

instinto criador
19
Years of Service
User Offline
Joined: 19th Dec 2006
Location:
Posted: 7th Oct 2012 22:45 Edited at: 8th Oct 2012 00:21
Very thanks for your explanation! I hoped it was a bug ... so it looks like I will have same to create the image with the edges dynamically, frame by frame, to simulate what I want, this is sad...
Mage
Valued Member
19
Years of Service
User Offline
Joined: 3rd Feb 2007
Location:
Posted: 8th Oct 2012 05:39 Edited at: 8th Oct 2012 05:39
It's called "Nearest Neighbour" scaling. The fastest but crappiest of all scaling methods. It's not a bad thing really, since speed is almost always the top priority. It's the right all-round option for scaling.

You can use a variety of plugins to get better, prettier scaling.

Login to post a reply

Server time is: 2026-07-08 10:39:55
Your offset time is: 2026-07-08 10:39:55