#144076 - yellowstar - Sun Oct 28, 2007 11:33 pm
Does anybody know of any screenshot converters
to BMP?(bin-to-bmp)
I tried to google,
but I couldn't find anything.
Click here for my sub screen capturing question.
Last edited by yellowstar on Tue Nov 20, 2007 3:59 am; edited 5 times in total
#144081 - tepples - Sun Oct 28, 2007 11:50 pm
Which .bin are you talking about? A raw 15-bit format?
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#144082 - yellowstar - Sun Oct 28, 2007 11:52 pm
Yes, 15-bit.
The same kind display capture outputs.
#144085 - Lick - Sun Oct 28, 2007 11:54 pm
I find TGA to be a simpler format. You can even add compression (RLE = simple) so it sure beats BMP.
It's basically 18 bytes of header + RGB(A) data after the header.
_________________
http://licklick.wordpress.com
#144086 - Mighty Max - Sun Oct 28, 2007 11:59 pm
So does BMP, except it's header is 54 Bytes for non-palletted.
_________________
GBAMP Multiboot
#144088 - yellowstar - Mon Oct 29, 2007 12:06 am
My screenshot function calls another function
which saves a TGA.(broken)(It's good enough
for screenshots in which you know what the colors
are for all/most of the pixels.)
(Like black-and-white)
(maybe other kinds of simple screenshots)
The only computer I have
which has an app to access TGA
is my old computer.(obviously I'm
not on it all the time.)
I want a BMP converter so both computers
can convert screenshots.(It's slow
to load-up the GIMP on my old PC.)
(I import the screenshot TGA,
then export BMP)
(On my newer PC,
I use a NDS which copys in
the screenshot on my card,
to the data dir,
and display it.
Then, in a Emu,
I take a screenshot.)
#144170 - yellowstar - Mon Oct 29, 2007 9:49 pm
If anybody would like to help
fix my broken TGA saver,
read the following:
The part that is the problem
is probably the code
which converts a 16-bit color
into 8-bit.(converts all colors,
and puts them in seperate bytes.)
Does anybody know of code
to do this correctly?
#144171 - Lick - Mon Oct 29, 2007 10:02 pm
If by 16-bit you mean R5G5B5A1 to R8G8B8A8 (TGA32):
Code: |
// color is a 16-bit value
u8 color32r = ((color & 0x001F) << (16+3));
u8 color32g = ((color & 0x03E0) << ( 8+3));
u8 color32b = ((color & 0x7C00) << ( 0+3));
u8 color32a = ((color & 0x8000)? 0xFF000000 : 0); |
-edit- explanation of the above crap: I originally copypasted my u16 to u32 routine, but then decided to split the 32-bit value into 8-bit color components on-the-fly. Obviously, that wasn't such a smart idea, since I now see that I screwed up the shifts.
If you want to convert to R8G8B8 (TGA24):
Code: |
// color is a 16-bit value
u8 color24r = ((color & 0x001F) << (16+3));
u8 color24g = ((color & 0x03E0) << ( 8+3));
u8 color24b = ((color & 0x7C00) << ( 0+3)); |
-edit- same as above
Those are the conversions.
_________________
http://licklick.wordpress.com
Last edited by Lick on Tue Oct 30, 2007 2:22 am; edited 3 times in total
#144172 - wintermute - Mon Oct 29, 2007 10:15 pm
You might be a bit better off with
Code: |
// color is a 16-bit value
u8 red = (color & 0x001F) ;
u8 green = ((color & 0x03E0) >> 5 );
u8 blue = ((color & 0x7C00) >> 10 );
u8 alpha = ((color & 0x8000) ? 0xFF : 0);
|
then write the bytes in whatever order you need.
The entirely black image you'll get with Lick's code might confuse you a little.
_________________
devkitPro - professional toolchains at amateur prices
devkitPro IRC support
Personal Blog
#144173 - kusma - Mon Oct 29, 2007 10:20 pm
Yeah, that's the best way of ensuring that white does not stay white...
To combat that problem, you'd do something like this:
Code: |
x = (float(x) / ((1 << 5) - 1)) * ((1 << 8) - 1) |
or
Code: |
x = (x << (8 - 5)) | (x >> (5 - (8 - 5))) |
...if you want to avoid those floats. It gives a slightly different result for some of the values, but it's still much better than just shifting up.
#144179 - yellowstar - Mon Oct 29, 2007 11:36 pm
Thanks!
The code with no alpha is the
one I need for this.(I could add code
to handle alpha also)
I can't test it right now,
as I'm not on my computer with my TGA software on it.
#144184 - Cearn - Tue Oct 30, 2007 12:05 am
Alternatively, use a 16-bit TGA, in which case you'd only have to swap red and blue:
Code: |
u32 color, rb;
...
rb= color & 0x7C1F;
rb |= rb<<20;
color= (color &~ 0x7C1F) | (rb>>10);
|
#144197 - yellowstar - Tue Oct 30, 2007 3:04 am
I tried wintermute's code,
but I got the same result as my
original code.(screenshot)
(Screenshot is of my Pong game)
(No gameplay yet, the sprites are
just in the correct places)
The background is black,(or something similar)
and the pixels that are supposed to be white
are a lighter color than black.
EDIT:
I could write a BMP saver,
but, untill this problem is solved,
I would get the same output as above.(same colors and ect.)
#144201 - ecurtz - Tue Oct 30, 2007 3:29 am
Wintermute's code is right, it's just leaving them as 5 bit values.
Try
Code: |
#define R_FROM_RGB15(rgb) ((rgb & 0x001F) << 3)
#define G_FROM_RGB15(rgb) ((rgb & 0x03E0) >> 2)
#define B_FROM_RGB15(rgb) ((rgb & 0x7C00) >> 7)
|
#144205 - yellowstar - Tue Oct 30, 2007 3:49 am
Thanks,
it works now!
I guess I'll need to investigate
BMP again later.
#144260 - yellowstar - Tue Oct 30, 2007 11:06 pm
I have another question.
Does anybody know of
code to copy the data from
the sub engine to the main one?
So,
this would enable me to take screenshots
of the sub screen.
#144275 - tepples - Wed Oct 31, 2007 2:00 am
Which mode and which VRAM banks are you using for the sub screen?
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#144280 - yellowstar - Wed Oct 31, 2007 2:48 am
Sub screen is console.
Code: |
videoSetModeSub(MODE_0_2D | DISPLAY_BG0_ACTIVE);
vramSetBankC(VRAM_C_SUB_BG);
|
(I want code to handle
backgrounds, sprites, 3D, ect.)
(Also for use in other HB)
#144771 - yellowstar - Wed Nov 07, 2007 2:06 am
Anybody?
#145475 - yellowstar - Fri Nov 16, 2007 3:41 am
How do I use the display capture FIFO?
Also,
what are the advantages/disadvantages and such,
between FIFO and VRAM?
Is there a way to capture videos?
#145664 - yellowstar - Tue Nov 20, 2007 4:01 am
Anybody?
How much faster/slower is DISPCAP FIFO, compared to VRAM?