0 registered members (),
900
guests, and 2
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: RGB values?
[Re: sheefo]
#87548
08/27/06 03:18
08/27/06 03:18
|
Joined: Feb 2003
Posts: 6,818 Minot, North Dakota, USA
ulillillia
Senior Expert
|
Senior Expert
Joined: Feb 2003
Posts: 6,818
Minot, North Dakota, USA
|
When using BMP images, it's BGR format. You can make Gamestudio write BMP images. When writing the color 64, 128, 255, which is sky blue in the RGB format, it's treated as a bright grayish-orange color in the BGR format. You can see this for yourself. Just use this RGB color and save a small 16x16 BMP image of all this color. In a hex edittor, you'd see it as FF 80 40 repeated 256 times after the 54-byte file header data. I don't know if this applies to other image formats (like JPG, PNG, GIF, or, more easily, TGA (easy when uncompressed - Gamestudio can write uncompressed TGA images)).
"You level up the fastest and easiest if you do things at your own level and no higher or lower" - useful tip
My 2D game - release on Jun 13th; My tutorials
|
|
|
Re: RGB values?
[Re: sheefo]
#87550
08/27/06 19:34
08/27/06 19:34
|
Joined: Aug 2003
Posts: 7,439 Red Dwarf
Michael_Schwarz
Senior Expert
|
Senior Expert
Joined: Aug 2003
Posts: 7,439
Red Dwarf
|
i still use CDs instead of DVD because CD's are more reliable...
"Sometimes JCL reminds me of Notch, but more competent" ~ Kiyaku
|
|
|
Re: RGB values?
[Re: ulillillia]
#87552
08/28/06 05:25
08/28/06 05:25
|
Joined: Feb 2003
Posts: 6,818 Minot, North Dakota, USA
ulillillia
Senior Expert
|
Senior Expert
Joined: Feb 2003
Posts: 6,818
Minot, North Dakota, USA
|
Quote:
You can make Gamestudio write BMP images.
This proves my claim (fully tested too using pure C-script - it makes a palette much like a 16-bit palette, complete with details):
Code:
var temp_handle;
function write_bmp() { // max_loops = 100000; var red_color = 0; var green_color = 255; var blue_color = 0; var bit_depth; var current_data_chunk = 0; // var total_data_chunks; temp_handle = file_open_write("16bitpalette.bmp"); // start file header data file_str_write(temp_handle, "BM"); file_asc_write(temp_handle, 54); // *1 // file size (4 bytes) file_asc_write(temp_handle, 0); // *256 file_asc_write(temp_handle, 3); // *65536 file_asc_write(temp_handle, 0); // *16777216 file_asc_write(temp_handle, 0); // *1 // reserved (2 bytes) file_asc_write(temp_handle, 0); // *256 file_asc_write(temp_handle, 0); // *1 // reserved (2 bytes) file_asc_write(temp_handle, 0); // *256 file_asc_write(temp_handle, 54); // *1 // offset to main bitmap data (4 bytes) file_asc_write(temp_handle, 0); // *256 file_asc_write(temp_handle, 0); // *65536 file_asc_write(temp_handle, 0); // *16777216 file_asc_write(temp_handle, 40); // *1 // size of the information sector (4 bytes) file_asc_write(temp_handle, 0); // *256 file_asc_write(temp_handle, 0); // *65536 file_asc_write(temp_handle, 0); // *16777216 file_asc_write(temp_handle, 0); // *1 // image width (4 bytes) file_asc_write(temp_handle, 4); // *256 file_asc_write(temp_handle, 0); // *65536 file_asc_write(temp_handle, 0); // *16777216 file_asc_write(temp_handle, 64); // *1 // image height (4 bytes) file_asc_write(temp_handle, 0); // *256 file_asc_write(temp_handle, 0); // *65536 file_asc_write(temp_handle, 0); // *16777216 file_asc_write(temp_handle, 1); // *1 // number of planes (2 bytes) file_asc_write(temp_handle, 0); // *256 file_asc_write(temp_handle, 24); // *1 // number of bits per pixel (2 bytes) file_asc_write(temp_handle, 0); // *256 file_asc_write(temp_handle, 0); // *1 // type of compression - 0 if uncompressed (4 bytes) file_asc_write(temp_handle, 0); // *256 file_asc_write(temp_handle, 0); // *65536 file_asc_write(temp_handle, 0); // *16777216 file_asc_write(temp_handle, 0); // *1 // size of image data (4 bytes) file_asc_write(temp_handle, 0); // *256 file_asc_write(temp_handle, 3); // *65536 file_asc_write(temp_handle, 0); // *16777216 file_asc_write(temp_handle, 19); // *1 // X resolution - pixels per meter (4 bytes) file_asc_write(temp_handle, 11); // *256 file_asc_write(temp_handle, 0); // *65536 file_asc_write(temp_handle, 0); // *16777216 file_asc_write(temp_handle, 19); // *1 // Y resolution - pixels per meter (4 bytes) file_asc_write(temp_handle, 11); // *256 file_asc_write(temp_handle, 0); // *65536 file_asc_write(temp_handle, 0); // *16777216 file_asc_write(temp_handle, 0); // *1 // colors used - 0 if no pallete (4 bytes) file_asc_write(temp_handle, 0); // *256 file_asc_write(temp_handle, 0); // *65536 file_asc_write(temp_handle, 0); // *16777216 file_asc_write(temp_handle, 0); // *1 // number of important colors - 0 if all are important (4 bytes) file_asc_write(temp_handle, 0); // *256 file_asc_write(temp_handle, 0); // *65536 file_asc_write(temp_handle, 0); // *16777216 // end file header data while(current_data_chunk < 65536) // all this creates a palette of 65,536 colors { current_data_chunk += 1; file_asc_write(temp_handle, int(blue_color+0.5)); // BMP uses the BGR format file_asc_write(temp_handle, int(green_color+0.5)); file_asc_write(temp_handle, int(red_color+0.5)); red_color += 8.226; if (red_color >= 256) { red_color = 0; blue_color += 8.226; if (blue_color >= 256) { blue_color = 0; green_color -= 4.048; } } } file_close(temp_handle); }
on_v = write_bmp();
Given that it can write BMP files, I'm pretty sure it can write any type of file as well, openable in external programs (such as creating a pure sine WAV file or duplicating an MP3). This would be a decent enhancement for my benchmark tester - create BMP images instead of just numbers in a text file.
"You level up the fastest and easiest if you do things at your own level and no higher or lower" - useful tip
My 2D game - release on Jun 13th; My tutorials
|
|
|
|