PDA

View Full Version : Saving a TBitmap to a VTDB



Cataclysm
21-05-2003, 11:42 AM
Hi All!

Does anybody have any ideas to save a Bitmap to a VTDB?
I want to do this without using a TAGFImage (because then I'll need an IDirectDevice).

Actually I'm looking for a piece of code like the VTDBTool in which the bitmaps are saved to the VTDB!

Thanx in advance,

Coen

LP
22-05-2003, 01:24 AM
In examples section (for PD3 - it's in "PowerDraw2.x Examples" directory) there is VTDView sample. It only loads bitmaps, so you'll have to figure out how to do it vise-versa (sorry, right now got no time to provide an example)...

- Lifepower

kornalius
26-05-2003, 04:37 PM
Here it is:

procedure BitmapToAGF;
var
LRect: TD3DLocked_Rect;
Res, i: Integer;
DestP: Pointer;
begin
b.PixelFormat := pf32bit; // convert bitmap format to 32-bit

a.Finalize;
Res := a.Initialize(TexWidth, TexHeight, PtCount, PtWidth, PtHeight, D3DFMT_A4R4G4B4);
if (Res <> errNone) then Exit;

Res := a.Lock(0, LRect);
if (Res <> errNone) then Exit;

for i := 0 to a.TextureHeight - 1 do
begin
DestP := Pointer(Integer(LRect.Bits) + (LRect.Pitch * i));
try
pdrawLineConv(b.Scanline[i], DestP, a.TextureWidth, D3DFMT_A8R8G8B8, D3DFMT_A4R4G4B4);
except
end;
end;

Res := a.Unlock(0);
if (Res <> errNone) then Exit;

a.TransparentColor := Color;
end;

Cataclysm
26-05-2003, 09:42 PM
I tried that, and it looks alright. I think it will work in Powerdraw 3, but the PDrawEx.Dll in PowerDraw 2.42 doesn't seem to have pdrawLineConv... Any suggestions how to get the code working in Powerdraw 2.42?

Thanx in advance!

Coen

kornalius
27-05-2003, 03:07 PM
It does only work in v3 I think. I never used any previous versions of PowerDraw.

Regards,
Kornalius

Cataclysm
27-05-2003, 08:09 PM
Ok! That's what I thought... no problem, we'll just have to wait doing that until version 3 goes final ;)

Thanx for your help!

Coen