Scaling a bitmap in to another bitmap, best 'manual' way?
<p>The bitmap is nothing more then a <code>int[] pixels = new int[width * height]</code>;</p>

<p>I am using in this way:</p>

<pre><code>BufferedImage img = new BufferedImage(WIDTH,HEIGHT,RGB);
int[] pixels = ((DataBufferInt) img.getRaster().getDataBuffer()).getData();
</code></pre>

<p>'do rendering here on pixels[], for instance load an image using <code>BufferedImage img = ImageIO.read(URL)</code>;</p>

<pre><code>Graphics g;
g.drawImage(img, 0,0, getWidth(), getHeight(), null);
</code></pre>

<p>Now during the 'do rendering here on pixels' lots of stuff can happen, coloring the textures (they are gray-scales) but I also need to rescale them. Though I don't know "the best way" to do this.</p>

<p>All 'bitmaps' are just an array of ints.</p>

<p>Scaling can be done in steps on 0.1 or 0.01 or 3.
I personally thought something like:</p>

<pre><code>for(int yy = 0; yy &lt; tex.height; yy++){
    for(int xx = 0; xx &lt; tex.width; xx++){
        int px = tex.getPixel(yy * tex.width + xx);
        this.putPixel( (y*this.width)+((int)((yy*scale) * tex.width)) + (x) + ((int)(xx*scale)));
    }
}
</code></pre>

<p>But I have no clue if this would be 'the right' way. Or if there are other/better ways.</p>
