Gamestudio Links
Zorro Links
Newest Posts
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (Quad, degenerate_762), 642 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
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 Offline OP
User
hopfel  Offline 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 Offline
Expert
Rei_Ayanami  Offline
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 wink

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 Offline OP
User
hopfel  Offline OP
User

Joined: Dec 2008
Posts: 605
47°19'02.40" N 8°32'54.67" E...
Es steht aber auch:
Quote:
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 Offline
Serious User
Widi  Offline
Serious User

Joined: Aug 2007
Posts: 1,922
Schweiz
Vielleicht hilft dir der folgende Code etwas, damit kannst du tga files speichern.
Code:
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 Offline OP
User
hopfel  Offline 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. smirk
Aber vielen dAnk schonma. ^^


Hilf mir, dir zu helfen!
Re: bmap_save plugin? [Re: hopfel] #352735
01/05/11 16:57
01/05/11 16:57
Joined: Aug 2007
Posts: 1,922
Schweiz
Widi Offline
Serious User
Widi  Offline
Serious User

Joined: Aug 2007
Posts: 1,922
Schweiz
Hab`s gerade nochmals getestet, funktioniert bei mir.
Hast du beim Speichername auch das .tga angehängt? (zb. test_bmap.tga)
hat dein Ursprungsbild einen Alphachannel? wenn nicht ändere folgende Zeile:

SCHREIBE_TGA_8(32);

zu:

SCHREIBE_TGA_8(24);

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 Offline OP
User
hopfel  Offline 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. grin
Vielen herzlichen Dank! smile


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 Offline
Serious User
Widi  Offline
Serious User

Joined: Aug 2007
Posts: 1,922
Schweiz
Gerne


Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1