Board index » delphi » tBitmap, pfDevice AND saveToFile

tBitmap, pfDevice AND saveToFile

I am using Delphi 3.0 and encountered problems saving/reloading tBitmaps
to/from a tStream. I found out that there are problems, if the
PixelFormat = pfDevice. So if  I  save the pfDevice picture (may be
rtl-compressed) and reload it, it will totally mess up the memory of the
application. (Acces Violation Screen with HexDump, Application aborts).
This only happens with pfDevice.

tv

 

Re:tBitmap, pfDevice AND saveToFile


This may or may not be helpfull, and may or may not be
outdated information... So here goes...

1) RLE compressed Windows bitmap files are a valid format.

2) Yes, they are an "inconvience" to read and write.

3) To the best of my knowledge, there is little (if any)
support in the VCL for this format. I believe is to
be especially true if you are changing the incomming format.

I cannot comment on RLE support in Delphi 4, since I have
yet to examine the code.

If this is indeed the case, you may want to find a
component that actually supports the Windows Bitmap
subset as published.

Its really not too difficult to support this format.

Microsoft produced a primer at one time, aimed at
the beginning level graphics programmer that addressed
writing code to support all known Windows and OS/2
presentation manager bitmap types. It provided an
in depth explanation, code, test cases.

The sample bitmaps provided by the tutorial
included bitmaps that any reasonably written
bitmap reader/writer should be able to
decode and re-encode properly.

You might want to search the Microsoft
web site to see if this downloadable
tutorial still exists.

Good Luck!

Joe

Quote
Tom wrote:

> I am using Delphi 3.0 and encountered problems saving/reloading tBitmaps
> to/from a tStream. I found out that there are problems, if the
> PixelFormat = pfDevice. So if  I  save the pfDevice picture (may be
> rtl-compressed) and reload it, it will totally mess up the memory of the
> application. (Acces Violation Screen with HexDump, Application aborts).
> This only happens with pfDevice.

> tv

--
Joe C. Hecht
joehe...@gte.net
(850) 689-0877 121 Louise Dr. Crestview, FL 32536
http://home1.gte.net/joehecht/index.htm

Re:tBitmap, pfDevice AND saveToFile


Thank You for responding!
The problem WAS occuring only while in Graphic Modes with 16bit Colors.
The Bitmap was displayed before saving, so its content changed.
Now I reload the raw data (the bmp file) into a memorystream and let the
memorystream write it to my stream. This works, finally.

Before I did a tBitmap.loadFromFile and placed the bitmap inside a tImage and
afterwards saved it with tBitmap.saveToStream to my stream...

TV

Other Threads