2 registered members (AndrewAMD, 7th_zorro),
1,285
guests, and 4
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
bmap_save plugin?
#352716
01/05/11 15:01
01/05/11 15:01
|
Joined: Dec 2008
Posts: 605 47°19'02.40" N 8°32'54.67" E...
hopfel
OP
User
|
OP
User
Joined: Dec 2008
Posts: 605
47°19'02.40" N 8°32'54.67" E...
|
Hey guys, I know this question was asked many times before, but I just can't find the thread so I have to ask again:
Im looking for a plugin I can save bitmaps with not only in the size with a power of two. Is there something like this? Would be very helpful. :3 ~Greets
Hilf mir, dir zu helfen!
|
|
|
Re: bmap_save plugin?
[Re: hopfel]
#352718
01/05/11 15:07
01/05/11 15:07
|
Joined: Feb 2009
Posts: 3,207 Germany, Magdeburg
Rei_Ayanami
Expert
|
Expert
Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
|
bmap_save "Die jpg-Qualität läßt sich nicht anpassen und die Bildgrösse muß ein Vielfaches von 8 sein" PNG zum Beispiel geht mit jeder Größe
Last edited by Rei_Ayanami; 01/05/11 15:07.
|
|
|
Re: bmap_save plugin?
[Re: Rei_Ayanami]
#352721
01/05/11 15:19
01/05/11 15:19
|
Joined: Dec 2008
Posts: 605 47°19'02.40" N 8°32'54.67" E...
hopfel
OP
User
|
OP
User
Joined: Dec 2008
Posts: 605
47°19'02.40" N 8°32'54.67" E...
|
Es steht aber auch: The allocated bitmap size (always a power of two) is saved in engine versions up to 7.85; from 7.86 on the size given in the BMAP definition is saved Und wenn dem trotzdem nicht so ist muss ich mich wundern wieso meine 80*85 PNG-Bitmap trotzdem als 128*128 gespeichert wird. O.o Könnte es sein, dass das erst ab A8 geht?
Last edited by hopfel; 01/05/11 15:19.
Hilf mir, dir zu helfen!
|
|
|
Re: bmap_save plugin?
[Re: hopfel]
#352723
01/05/11 15:24
01/05/11 15:24
|
Joined: Aug 2007
Posts: 1,922 Schweiz
Widi
Serious User
|
Serious User
Joined: Aug 2007
Posts: 1,922
Schweiz
|
Vielleicht hilft dir der folgende Code etwas, damit kannst du tga files speichern.
void SCHREIBE_TGA_8(var shadow_byte) // schreibe char
{
file_asc_write (Filehandle,shadow_byte);
}
void SCHREIBE_TGA_16(var shadow_short) // schreibe unsigned shadow_short
{
file_asc_write (Filehandle,shadow_short&255);
file_asc_write (Filehandle,(shadow_short>>8)&255);
}
void SCHREIBE_TGA_BILD(BMAP* MY_BMAP,STRING* MY_STR) // ***** SPEICHERT DAS BILD IM TGA - FORMAT ***** //
{
var format = 0;
var pixel = 0;
var pixel_alpha = 0;
Temp_vec1.x = bmap_width (MY_BMAP);
Temp_vec1.y = bmap_height (MY_BMAP);
format = bmap_lock (MY_BMAP,0);
Filehandle = file_open_write (MY_STR);
//----------------------------------------------------------------------------------------------// schreibe Header der tga Datei
SCHREIBE_TGA_8(0);
SCHREIBE_TGA_8(0);
SCHREIBE_TGA_8(2); // ild Typ: 10 = RLE komprimierte tga, 2 = unkomprimierte tga
SCHREIBE_TGA_16(0);
SCHREIBE_TGA_16(0);
SCHREIBE_TGA_8(0);
SCHREIBE_TGA_16(0);
SCHREIBE_TGA_16(0);
SCHREIBE_TGA_16(Temp_vec1.x); // Breite
SCHREIBE_TGA_16(Temp_vec1.y); // Höhe
SCHREIBE_TGA_8(32); // 24 oder 32 für Alphakanal
SCHREIBE_TGA_8(0);
//----------------------------------------------------------------------------------------------// schreibe Bilddaten der tga Datei
for (i=0; i < Temp_vec1.x * Temp_vec1.y; i++)
{
pixel = pixel_for_bmap (MY_BMAP, i%Temp_vec1.x, (Temp_vec1.y-1)-integer(i/Temp_vec1.x));
pixel_to_vec (Temp_col1,pixel_alpha,format,pixel);
pixel_alpha *= 2.55; // wandle alpha von 0 bis 100 --> 0 bis 255
SCHREIBE_TGA_8 (Temp_col1.blue); // b
SCHREIBE_TGA_8 (Temp_col1.green); // g
SCHREIBE_TGA_8 (Temp_col1.red); // r
SCHREIBE_TGA_8 (pixel_alpha); // alpha
}
file_close(Filehandle);
bmap_unlock(MY_BMAP);
}
Rufe einfach "SCHREIBE_TGA_BILD(bmap_pointer,speichername);" zum speichern auf. Diese Files sind genau so gross wie das ursprüngliche Bild. EDIT: du musst noch einen Vector (Temp_vec1) und eine Color (Temp_col1) definieren...
Last edited by Widi; 01/05/11 15:27.
|
|
|
Re: bmap_save plugin?
[Re: Widi]
#352732
01/05/11 16:06
01/05/11 16:06
|
Joined: Dec 2008
Posts: 605 47°19'02.40" N 8°32'54.67" E...
hopfel
OP
User
|
OP
User
Joined: Dec 2008
Posts: 605
47°19'02.40" N 8°32'54.67" E...
|
(i und Filehandle mussten auch noch definiert werden) Das wäre genau das was ich suche, aber aus irgendeinem Grund crasht die Funktion "SCHREIBE_TGA_BILD" wenn ich sie ausführe... Ich habe ka was es sein könnte, ich kann im Code keine Fehler erkennen. Aber vielen dAnk schonma. ^^
Hilf mir, dir zu helfen!
|
|
|
Re: bmap_save plugin?
[Re: Widi]
#352738
01/05/11 17:21
01/05/11 17:21
|
Joined: Dec 2008
Posts: 605 47°19'02.40" N 8°32'54.67" E...
hopfel
OP
User
|
OP
User
Joined: Dec 2008
Posts: 605
47°19'02.40" N 8°32'54.67" E...
|
Oke, Problem gelöst, ich war mal wieder extrem unfähig und habe den Farbvector mit COLOR* anstatt mit COLOR definiert. --,,-- Aber jetzt funktionierts wunderbar. Vielen herzlichen Dank!
Hilf mir, dir zu helfen!
|
|
|
Re: bmap_save plugin?
[Re: hopfel]
#352741
01/05/11 17:32
01/05/11 17:32
|
Joined: Aug 2007
Posts: 1,922 Schweiz
Widi
Serious User
|
Serious User
Joined: Aug 2007
Posts: 1,922
Schweiz
|
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|