2 registered members (AndrewAMD, VoroneTZ),
1,258
guests, and 4
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
question about bitmap
#413820
12/18/12 17:58
12/18/12 17:58
|
Joined: Jul 2011
Posts: 69
pjotr987
OP
Junior Member
|
OP
Junior Member
Joined: Jul 2011
Posts: 69
|
hi there, my todays question is related with bitmaps. i wrote a small console, that sends files from one end to another. now i want to send a jpg picture from a to b, what works fine. as result i get in liteC an array with bit information in it. HOW can i display this jpg image on screen without saving and reloading it again? it takes too long to save and to reload it. can something be done directly with the received array, to show it directly?
thanks for anny idea in advance
Last edited by pjotr987; 12/18/12 17:59.
|
|
|
Re: question about bitmap
[Re: pjotr987]
#413835
12/18/12 21:22
12/18/12 21:22
|
Joined: Jan 2002
Posts: 4,225 Germany / Essen
Uhrwerk
Expert
|
Expert
Joined: Jan 2002
Posts: 4,225
Germany / Essen
|
// Obtain the image data
byte* yourImageBytes = obtainYourImageBytesOverNetwork();
// Add the image data to the engine's buffer.
add_buffer("mybitmap.jpg",yourImageBytes,countOfYourImageBytes);
// Now you can load from this buffer
BMAP* bmapToDisplay = bmap_create("mybitmap.jpg");
// Don't forget to release the buffer
add_buffer("mybitmap.jpg",NULL,countOfYourImageBytes);
I haven't tested or compiled the above code. It's just meant to give you the basic idea.
Always learn from history, to be sure you make the same mistakes again...
|
|
|
Re: question about bitmap
[Re: Uhrwerk]
#413983
12/20/12 19:34
12/20/12 19:34
|
Joined: Jul 2011
Posts: 69
pjotr987
OP
Junior Member
|
OP
Junior Member
Joined: Jul 2011
Posts: 69
|
hi its me again, Uhrwerks code seems to make sense, except that the compiler comlains that there is an invalid pointer. here the modified code. i tried to save the buffer in a file to look whats exactly in it. but didnt worked out so far. here the code:
byte* yourImageBytes = server_push; //Add the image data to the engine's buffer. add_buffer("mybitmap.bmp",yourImageBytes,6400); //Now you can load from this buffer BMAP* bmapToDisplay = bmap_create("mybitmap.bmp"); //Don't forget to release the buffer add_buffer("mybitmap.bmp",NULL,6400);
var file7 = file_open_read("mybitmap.bmp"); var file8 = file_open_write("i:/in/bild0-buffer.txt"); var file_size7; file_size7=file_length(file7); int counter33; int buff; while (counter33 < file_size) { buff=file_asc_read(file7); file_asc_write(file8,buff); counter33++; wait(1); }
Last edited by pjotr987; 12/20/12 19:35.
|
|
|
Re: question about bitmap
[Re: pjotr987]
#413988
12/20/12 21:01
12/20/12 21:01
|
Joined: Jan 2002
Posts: 4,225 Germany / Essen
Uhrwerk
Expert
|
Expert
Joined: Jan 2002
Posts: 4,225
Germany / Essen
|
I guess server_push is a function isn't it? Otherwise you could have diretly used server_push instead of yourImageBytes. In this case you forgot the parantheses behind it and hence the code will crash as yourImageBytes points to a function.
Please use code tags when posting code.
Always learn from history, to be sure you make the same mistakes again...
|
|
|
|