form1.DXImageList1.Items.Find('image1dib').Draw(form1.DXDraw1.Surface, tmpx, 100, 0);
Quote from: Galfar on 5 April 2010, 19:37:58
Check out TDXImageList class mentioned in this forum thread http://delphigamedev.com/forums/viewtopic.php?f=2&t=1185.
I think you can't get any alpha blending simply by using Surface.Draw methods (http://www.gamedev.net/community/forums/topic.asp?topic_id=303701 - it would have to be hardware supported to work).
var
Form1: TForm1;
DIB : TDIB;
img: TImageData;
dxsurf : TDirectDrawSurface;
implementation
{$R *.dfm}
procedure TForm1.DXTimer1Timer(Sender: TObject; LagCount: Integer);
begin
form1.DXDraw1.Surface.Fill(clSilver);
form1.DXDraw1.Surface.Draw(1,1,dxsurf);
form1.DXDraw1.Flip;
end;
procedure TForm1.DXDraw1Initialize(Sender: TObject);
var linebytes,i : integer;
begin
InitImage(img);
LoadImageFromFile('mydds.dds', img);
DIB := TDIB.Create;
DIB.SetSize(img.Width, img.Height, 32);
// make sure both are 32bit
//DIB.BitCount := 32;
ConvertImage(img, ifA8R8G8B8);
// copy bits
LineBytes := DIB.WidthBytes;
for I := 0 to Img.Height - 1 do
begin
Move(PByteArray(Img.Bits)[I * LineBytes], DIB.Scanline[I]^, LineBytes);
end;
dxsurf := TDirectDrawSurface.Create(form1.DXDraw1.DDraw);
dxsurf.LoadFromDIB(dib);
form1.DXTimer1.Enabled := TRUE;
end;
var
DIB: TDIB;
Img: TImageData;
... load DDS to Img ...
DIB := TDIB.Create;
DIB.SetSize(Img.Width, Img.Height);
// make sure both are 32bit
DIB.BitCount := 32;
ConvertImage(Img, ifA8R8G8B8);
// copy bits
Move(Img.Bits, DIB.PBits, Img.Size);
... now make surface out of DIB32 ...
img := TImagingGraphic.Create;
img.LoadFromFile('mydds.dds');
dxsurf := TDirectDrawSurface.Create(form1.DXDraw1.DDraw);
dxsurf.SetSize(img.Width, img.Height);
dxsurf.Fill(0);
dxsurf.LoadFromGraphic(img);
Move(img, dxsurf, SizeOf(img);
dxsurf.LoadFromGraphic(img);
dxsurf.LoadFromGraphic(img)
Move(img, dxsurf, SizeOf(img);
Page created in 0.009 seconds with 20 queries.