#133924 - DrDerekDoctors - Mon Jul 09, 2007 9:05 pm
Hello there! I'm using PALib to write a sprite editor for the DS, because it's like a wee little graphics tablet but with a cruddy resolution but the advantage of portability.
Anyhoo, I was doing it using a 16bit background bitmap which I drew rectangles onto to represent the zoomed pixels but this is obviously gonna' be REAL slow when I zoom out any distance and so it was suggested to me by a friend that I could use an 8-bit rotatey/zoomy background and then draw into *that* image and I'd get really speedy zooming for free with the slight caveat of only having a 256x256 canvas (although I can live with that just peachy, ta').
So, is it possible to create a blank rotatable bg image on the fly and then alter it? Only PALib seems happy enough to load one but you can't just declare one from scratch and then get a pointer to it's structure so you can mess with it, and it's palette. And that's precisely what I'd need to do.
Thanks for any pointers,
Graham
#133926 - bean_xp - Mon Jul 09, 2007 9:21 pm
Yes, of course it's possible, I don't know anything about using libnds, but I have produced a similar application (although for GBA).
I didn't use zooming in and out, but I was only working with 16x16 pixels, using that method I was able to display a 1x, 4x and 8x live preview of the image, by creating initial blank data then editing it on the fly.
Also because you are producing a sprite editor, I think it would be better to use a paletted mode (as apposed to bitmap mode) to cut down on amount of data and allow quick adjustments to colours throughout the image. But it is your app so your call.
If you want I can send you the source to see my implementation. (But please bear in mind it was a very early project of mine).
#133933 - DrDerekDoctors - Mon Jul 09, 2007 9:38 pm
My understanding of the 8-bit rotated background mode is that it is paletted, and is therefore ideal.
The only downside to using it that I can see, is that I can't easily have a grid drawn in as lines. I suppose I could use very thin elongated sprites for grid-lines, though. Although that's another complexity.
Is your source DS or GBA? I suspect that is it's GBA then unless it was an earlier PALib thing I doubt I'd learn from it as I've not ventured under the hood of the DS really.
#133934 - bean_xp - Mon Jul 09, 2007 9:44 pm
It's GBA source code using libgba, it will be very easy to port to DS and I was planning on doing so, but if you release yours I wont need to (because I'm working on another project now).
Oh and about getting under the hood, intimidating at first but much easier once you get used to it, in my opinion.
#133936 - DrDerekDoctors - Mon Jul 09, 2007 9:48 pm
Well I'll gladly take a squizz at it to see if there's an answer in there for me, but I suspect the use of a different library in it's making might flummox me.
If you can pop it over to contact@arsecast.com, that'd prolly be the easiest address as it's gmail.
Thanks,
Graham
#133937 - HyperHacker - Mon Jul 09, 2007 9:50 pm
You can have up to a 512x512 16-bit or paletted bitmap, but the former leaves very little VRAM for anything else. I think you can do 256x512 (or 512x256) too.
_________________
I'm a PSP hacker now, but I still <3 DS.
#133939 - DrDerekDoctors - Mon Jul 09, 2007 9:55 pm
Aah, I was just about to say I found a demo in PALib which demostrates it (although it's naming is a bit ambiguous). Hurrah!
And 256x256x8bit is plenty, anyhoo, if I get free scaling from it. :)
#133940 - bean_xp - Mon Jul 09, 2007 9:59 pm
Oh Ok, I've sent you the source anyway just now.
#134021 - tepples - Tue Jul 10, 2007 3:36 am
DrDerekDoctors wrote: |
I was doing it using a 16bit background bitmap which I drew rectangles onto to represent the zoomed pixels but this is obviously gonna' be REAL slow when I zoom out any distance and so it was suggested to me by a friend that I could use an 8-bit rotatey/zoomy background |
If you need 16-bit, you can still use a 16-bit rotatey/zoomy background by setting up mode 5 appropriately.
Quote: |
So, is it possible to create a blank rotatable bg image on the fly and then alter it? |
Yes, but I don't know how to do so in PALib. Outside PALib, you can draw pixels to an extended rotation background and set the background's matrix to zoom in (set the texel increments less than 256/256, such as 64/256 for a 400% zoom) and pan to a given texel.
You can do the grid lines at at 400%, 800%, or 1600% zoom by using a text background on top of the extended rotation background. You can even make the grid lines semitransparent using the blend registers.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#134047 - DrDerekDoctors - Tue Jul 10, 2007 9:34 am
Ooh, that's interesting, Tepples, thanks. If I used the 16-bit one I might be able to keep the onion-skinning. I'll have to look into text mode to see if it could help with the grid-lines as they'd be at arbitrary locations due to being able to smoothly move the picture (not a texel at a time).