gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Graphics > Large scale up of sprites -Scaling sprites above 2x original

#131847 - bean_xp - Wed Jun 20, 2007 6:17 pm

I am writing a short GBA program (for learning purposes) which I intend to be a simple sprite editor. In the design mode I intend to display the canvas as an 8x preview, an original size preview, and a 4x preview.

I have implemented the 8x display through manipulating a tiled background (because the tiles are conviniently 8x8 pixels) which works well. I have also implemented the original size preview by writting the array data to a sprite which is dynamicall regenerated when the canvas is modified.

However I for the 4x display I planned to use an affine sprite scaled up to 4x the original size, after investigating this I found (as tonc describes) "the clipping arifact", preventing anything extending beyond 2x original size (in double mode).

So my question is "Are there any workarounds for this, or am I overlooking something?"

If not I would like to hear your thoughts of the best method of implementing the 4x preview?

The methods I have come up with all have individual problems, please let me know any alternative ideas:
    Method 1: Use a sprite containing a 4x4 block of colour for each pixel in the sprite. (problem uses 256 sprites, which we don't have - The image is 16x16 pixels)

    Method 2: Create a new sprite from the old sprites tile which is sized 32x32 padded with blank tiles in VRAM which will allow me to scale higher as the blank tiles can be cropped. (problem will waste 12 tiles for blank data, and a further 4 tiles for the copied data, which I do currently have available, but don't want to waste)

    Method 3: Use a bitmap mode and "draw" the preview in the VRAM. (Problem I'm currently using tiled backgrounds and will have to be changed, however if this is necessary I am willing to do this)

#131859 - NeX - Wed Jun 20, 2007 8:02 pm

Draw the sprite at 2x, scale it down for "normal" and then scale it up for "quadruple".
_________________
Strummer or Drummer?.
Or maybe you would rather play with sand? Sandscape is for you in that case.

#131870 - tepples - Wed Jun 20, 2007 9:55 pm

Can you use a rot/scale background?

Method 3 does not require the use of a bitmapped background (modes 3-5), also called an "extended rotation" background. It is perfectly possible to draw 4x4 pixel rectangles in software by modifying a set of background tiles.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#131925 - bean_xp - Thu Jun 21, 2007 12:43 pm

Ok, thanks for your replies, I'm thinking I'll go with NeX's suggestion as it will probarbly be the simplest to implement at this point, however in the case of larger graphics such as 8x I could see the exrot background being the greater method.

Thanks again bean_xp