views:

456

answers:

1

Hi there,

I'm working with Via Builder, from Inscriber Technology. This app merges a TGA sequence animation into one single .via file, making it much better to load large sequences, as this file is optimized. There are plugins to use this with some Adobe products.

I'm working on Delphi, and my problem is that I can't get back the original alpha channel from the frames. Using their VIACODECLib_TLB library, I have the following function:

function GetFrameBitmap(Frame: Integer): Integer;

from tha IViaFile interface. This function is supposed to return a handle to a frame bitmap from the original sequence. The following code could work:

viaObject: IViaFile;
bmp: TBitmap;
index: Integer;

bmp.Handle := ViaObject.GetFrameBitmap(index);

But the resulting bitmap is the original frame with no alpha channel. Actually, its alpha channel is zero for the entire image.

Assuming I was doing something wrong, I tried using the GetDIBits function, to be sure there was an alpha channel somewhere. So I allocated memory long enough to store the bitmap assuming it had 4 channels and used the GetDIBits function. I got the same result as before: normal frame, alpha channel zero for the entire image.

Just to note, Inscriber (whose forums are dead), claims that its Via Builder has full alpha support. I know someone who managed to load the frames correctly, on C++, using the GetDIBits function, but "translating" the code to Delphi didn't work.

Any help would be much appreciated.

Thank you.

A: 

I suggest you take a closer look at your colleague's C++ code that supposedly works. You probably missed some detail. How much of the code was Windows API, and how much of it was some vendor-specific graphics code? The API stuff should be a cinch to translate to Delphi.

You might find that Delphi's TBitmap class doesn't support transparency, so you would need to use some other graphic-support library instead of plain old GDI. But if you're fetching the raw bitmap data as with GetDIBits, you should at least be able to see that the alpha-channel data is there. (You'd still need to find a way of displaying the bitmap properly, but at least you'd know you had the right data to start with.)

Rob Kennedy
Hi, thanks for answering. I forgot to mention I'm using a graphic library wich supports alpha blending (GR32). Using the GetDIBits, I'm just copying the byte array returned by the function, and the result is the original frame with alpha channel all set to zero. I'll look the C++ code again. Thanks.
Rafael