peter2005
-
Content Count
6 -
Joined
-
Last visited
Posts posted by peter2005
-
-
How can I read content of (typed) file of different data types when one of them is null-terminated string?
Something like this:THeader = Record flags : integer; dummy : integer; name: string; padding: integer; end;
This would work fine if it were not for string field.
By definition a record has to be of fixed size but generally strings are not.
Another problem with string is the first byte is omitted since it is considered to be length.
Most likely Record cannot be used for my purpose...is there anything else?
-
-
Here is small bmp image. There is a transparent background and greyishblack shadow at the bottom.
The background is not the problem Image1.Transpartent=False removes it, but the shadow is always fully black.
Can it be loaded and displayed properly?
-
QuoteBecause Windows doesn't have good support for 32bit alpha-channeled bitmaps to begin with.
Lazarus(free pascal) can handle these bitmaps without any trouble.
QuoteWhy don't you want to use a third party component?
I try to avoid installing third party component because it complicates transferring my projects , it has to be installed, even worse when it's for a simple thing like displaying bitmap. Do you have any suggestion of component which could work in my case?
QuoteWhat complications does PNG present to you? Are you working with VCL or FMX? The VCL's TPNGImage class is easy to use. FMX's TBitmap can be a bit difficult, depending on what you are trying to do with it. It would really help if you would explain the problem you are having exactly.
Probably should not even mention that I use Delphi 7
TBitmap allows access to individual pixels which I need to rearrange, no idea if TPNGImage can do that.
-
hi,
for unclear reason delphi does not completely support 32 bit bitmaps. I'm trying to display a 32bit picture data(with alpha channel) in a TImage using TBitmap and have not found a proper way, some parts of the picture are just black. Interesting is that the image although not properly displayed can be saved into a file(image1.Picture.Bitmap.SaveToFile) and works perfectly fine in a picture viewer.
Alternative is to use PNG which uses alpha channel however it complicates whole situation since TBitmap is easy to use.
I do not want use 3rd-part components or huge libraries ....a code code snippet or an unit to include would be great.
record with null-terminated string
in General Help
Posted
After reading all the responses I realized there is no easy way....
My description is correct , it's a null-terminated ASCII string(one character one byte, no special ones), its length is not stored anywhere. Using static array only fixes problem of missing a first byte....
What I wanted to avoid the most is reading the string byte by byte until #0 is found.
I'll try this way.
Perhaps but the file I want to read was created in Visual Studio ..so I presume in C++ are "normal" ways to read #0 strings.