Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 1,014 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: Sending a BMP or a TGA file [Re: Germanunkol] #116272
03/13/07 19:04
03/13/07 19:04
Joined: Jun 2006
Posts: 2,640
Earth
Germanunkol Offline OP
Expert
Germanunkol  Offline OP
Expert

Joined: Jun 2006
Posts: 2,640
Earth
Hmm... there's multiple ways to do this you mentioned.
Sending the file in a string... how do I read a file in binary into an ascii string?... does that even work?

I don't know much about file types, help?

I wanted to use the pixel_for_bmap method, but the manual is against that somehow... they say not to overuse the function, and that it can crash your program easily...


thx,
Micha

Last edited by Germanunkol; 03/13/07 19:11.

~"I never let school interfere with my education"~
-Mark Twain
Re: Sending a BMP or a TGA file [Re: Germanunkol] #116273
03/14/07 22:44
03/14/07 22:44
Joined: Aug 2005
Posts: 343
Germany
HPW Offline
Senior Member
HPW  Offline
Senior Member

Joined: Aug 2005
Posts: 343
Germany
If you want to use pixel_to_bmap then you should use pixel_for_bitmap on the other side of your client/server to read the information of the pixels into 3 or 4 arrays.

something like this...
Code:

var v_alpha[512];
var v_red[512];
var v_green[512];
var v_blue[512];

function read_bmap(b_bmap)
{
var v_x = 0;
var v_y = 0;
var v_index = 0;
var v_pixel;
var v_format;

v_format = bmap_lock(b_bmap, 0);
if (v_format != 0) // valid bmap?
{
while (v_y < bmap_height(b_bmap))
{
while (v_x < bmap_width(b_bmap))
{
v_index = (v_y*bmap_width(b_bmap))+v_x;
v_pixel = pixel_for_bmap(b_bmap, v_x, v_y);
pixel_to_vec(temp, v_alpha[v_index], v_format, v_pixel);
v_red[v_index] = temp.red;
v_green[v_index] = temp.green;
v_blue[v_index] = temp.blue;
v_x += 1;
}
v_y += 1;
}
}
bmap_unlock(b_bmap);
}

function write_bmap(b_bmap)
{
var v_x = 0;
var v_y = 0;
var v_index = 0;
var v_pixel;
var v_format;

v_format = bmap_lock(b_bmap, 0);
if (v_format != 0) // valid bmap?
{
while (v_y < bmap_height(b_bmap))
{
while (v_x < bmap_width(b_bmap))
{
v_index = (v_y*bmap_width(b_bmap))+v_x;
temp.red = v_red[v_index];
temp.green = v_green[v_index];
temp.blue = v_blue[v_index];
v_pixel = pixel_for_vec(temp, v_alpha[v_index], v_format);
pixel_to_bmap(b_bmap, v_x, v_y, v_pixel);
v_x += 1;
}
v_y += 1;
}
}
bmap_unlock(b_bmap);
}



I don't tested this functions but it should work.
Now you need a function that sends the 4 arrays (v_red, v_green, v_blue and y_alpha) to server or clients.

Last edited by HPW; 03/14/07 22:57.

Evil Blood (v. 0.52) RPG
Commport.de (Social Network Community)
Re: Sending a BMP or a TGA file [Re: HPW] #116274
03/14/07 22:51
03/14/07 22:51
Joined: Aug 2005
Posts: 343
Germany
HPW Offline
Senior Member
HPW  Offline
Senior Member

Joined: Aug 2005
Posts: 343
Germany
I think they means with overuse something like using it every frame?!? But I don't know.


Evil Blood (v. 0.52) RPG
Commport.de (Social Network Community)
Re: Sending a BMP or a TGA file [Re: HPW] #116275
03/17/07 15:55
03/17/07 15:55
Joined: Jun 2006
Posts: 2,640
Earth
Germanunkol Offline OP
Expert
Germanunkol  Offline OP
Expert

Joined: Jun 2006
Posts: 2,640
Earth
Thanks a lot!
the manual said:
"For speed reasons this function is not safeguarded. Exceeding the bmap size (for instance by redefining d3d_texlimit) will lead to an engine crash."
that's what I meant, sorry.
But I don't think that'll be a problem for me, because I'll know the pixel size.
and your code goes around that problem with the pic size as well, cause you check the bmap's size...:)

I'll try this method and let you know what I come up with!



Last edited by Germanunkol; 03/17/07 16:23.

~"I never let school interfere with my education"~
-Mark Twain
Page 2 of 2 1 2

Moderated by  HeelX, Spirit 

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