Best Method For Scaling Image Resources/Sprites

My monitor is 1920x1080, so everything I create on it will be how it looks on a 1920x1080 monitor.

This isn’t, however, necessarily the “best” or highest resolution.

Is it still best then to scale everything to the user’s resolution from my own? And should scaling be done only down, or up as well?

How to create the graphics for a game has always been my biggest issue mainly for this reason.

If you are simply going to scale everything up or down, what is the best method to doing this? AffineTransform or scaling each image individually when it’s loaded?

I could be wrong here :emo:, are you familiar with Java’s ‘DisplayMode’ class?
After you’ve initialized your ‘window’ you can attempt to set the users GraphicsDevice settings to your resolution likings.
^ Hope that makes sense.

/* Initialize Window Above Here */
final int width = 640;
final int height = 480;
GraphicsDevice userGraphicsDevice = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
userGraphicsDevice.setDisplayMode(new DisplayMode(width, height, DisplayMode.BIT_DEPTH_MULTI, DisplayMode.REFRESH_RATE_UNKNOWN));

Pretty sure there’s a way to do this without having to set a window to full screen.

Hope it helps some.

This is the best way to scale a Image in Java(you can change of course some of the parameters and so on) ->

Scaling images at startup to the desired size is always good, because you can use better scaling functions.
There is a bunch of functions which can be used to scale an image, from fast and low quality to slow and high quality.

So it is of course best to not need any scaling at run-time at all. So scale all your images with the most expensive functions at startup to get the best visuals.
There are of course always some corner cases for which this rule doesn’t fully apply.

When I dev an android game, I’ll whip my artist telling all image should be based on S3 resolution (which already big enough for phone) so all I do is scaling down to keep the quality.

So yes, +1 for high images.

What is the author doing with the “accWidth” and “accHeight” variables in this code exactly?

What is the point of the loop and the Math.max call?

the point of this is to not down-scale an image more then half of its size, because this can causes aliasing.

Why is there a while loop? It seems to me that those two variables will never be changed from their initial values.

take another look, each time the loop is called the image size to which to scale is halfed. (this is only done if the highquality flag is set)

I’ve only seen that approach done with bilinear scaling, not bicubic - called progressive bilinear scaling. The halving then makes sense because that’s the threshold where bilinear stops sampling a pixel. Does bicubic offer any advantage? Could it actually be less accurate because it’s sampling outside the area?