question about bitmap

Posted By: pjotr987

question about bitmap - 12/18/12 17:58

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
Posted By: txesmi

Re: question about bitmap - 12/18/12 18:40

Never tryed something related but what about...
(LPDIRECT3DTEXTURE9*)bmap.d3dtex?
Posted By: Uhrwerk

Re: question about bitmap - 12/18/12 19:56

Have you tried adding the content to the egines buffer with add_buffer?

http://www.conitec.net/beta/aadd_buffer.htm
Posted By: pjotr987

Re: question about bitmap - 12/18/12 20:20

hi its me again,
i cant follow the the suggestion from txesmi. but Uhrwerk can u please specify how i can utilize the add_buffer function for my needs?
i have an array "int[6400]" there is the entire jpg file in binaroc form. now i want to turn it so, that i can display it as pannel without saving it first.

thanks
Posted By: Uhrwerk

Re: question about bitmap - 12/18/12 21:22

Code:
// 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.
Posted By: pjotr987

Re: question about bitmap - 12/20/12 19:34

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);
}

Posted By: Uhrwerk

Re: question about bitmap - 12/20/12 21:01

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.
© 2024 lite-C Forums