Re: win32lib / bitmap from memory question

new topic     » goto parent     » topic index » view thread      » older message » newer message

On 11 Jul 2005, at 12:41, Steve wrote:

> 
> 
> Hello everyone,
> 
> I created a simple datafile format that reads in bitmap images from 
> files.  Each bitmap file is completely contained within the datafile in 
> a simple index like fashion without distorting the original file 
> structure.  I would like to be able to draw the images from the datafile 
> without extracting them and placing them in a temporary file, or, even 
> better to draw straight from memory.  Is there a simple way to read a 
> bitmap from a allocated memory structure similar to reading directly 
> from a native bitmap file?  The format would be the exact same just in 
> memory rather than in a file.  
> 
> Visual(?) for clarity:
> 
> bitmap.bmp --> datafile.dat  
> (byte for byte movement just with a few bytes of header information 
> preceding each bitmap)
> 
> datafile.dat --> allocate(<sizeofbitmap>) 
> (original bitmap file is now contained byte-for-byte in memory)
> 
> memory bitmap -->  draw_bitmap(Window1, memHandle, 1, 1)
> (The intent anyways.)
> 
> So is there an easy way to do this without mucking around in the 
> win32lib internals?  Shouldn't it be fairly trivial considering the 
> bitmap is byte-for-byte an exact copy of the original file format, just 
> in memory?  Sorry, still a bit of a newb but I would like to use my 
> datafile format in a win32 prog and can't seem to figure out how to go 
> about it using win32lib.  Any helpful pointers would be awesome.

Pointers, literally, yes, can be helpful. Someone (?Euman?) did a fast bit 
move / screen update that moved bits from an allocate()ed memory block, 
but that's the only way to do this in Eu, because we don't have a string type 
which you can store the actual 0-255 bytes in, nor could you get a var_id() 
for such a string (because pointers are evil and un-necessary in Euphoria!?). 
Look at allocate_string(), it returns a pointer (but we don't call it that!) to
the
variable, and you can use an OS api call to move it to the screen, passing 
the address and appropriate length and such. I think. Did it in dos and 
pascal. Otherwise, win32lib and the other win libs have ways to do this, read 
their read.me's for examples. There's numerous display_this() and 
draw_that() and jpg-bmp_convertor()s and such that prolly have working 
examples in them, in the archives.

Kat

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu