|
procedure TWMImages.LoadDxImage (position: integer; pdximg: PTDxImage);
var
imginfo : TWMImageInfo;
ddsd : TDDSurfaceDesc;
SBits, PSrc, DBits : PByte;
n, slen, i, dlen : integer;
nErrorCode : Integer;
ms : TMemoryStream;
w : Word;
size : DWord;
DWBits : PDWORD;
begin
m_FileStream.Seek (position, 0);
if btVersion <> 0 then m_FileStream.Read (imginfo, SizeOf(TWMImageInfo) - 4)
else m_FileStream.Read (imginfo, SizeOf(TWMImageInfo));
(*if g_boUseDIBSurface then begin //DIB
try
lsDib.Clear;
ChangeDIBPixelFormat(lsDIB, FBitFormat);
lsDib.Width := imginfo.nWidth;
lsDib.Height := imginfo.nHeight;
except
end;
lsDib.ColorTable := MainPalette;
lsDib.UpdatePalette;
DBits := lsDib.PBits;
//m_FileStream.Read (dib.PBits^, imgi.nWidth * imgi.nHeight); 晋升
m_FileStream.Read (DBits^, imginfo.nWidth * imgInfo.nHeight{ * BytesPerPixe});
pdximg.nPx := imginfo.px;
pdximg.nPy := imginfo.py;
pdximg.surface := TDirectDrawSurface.Create (FDDraw);
pdximg.surface.SystemMemory := TRUE;
pdximg.surface.SetSize (imginfo.nWidth, imginfo.nHeight);
pdximg.surface.Canvas.Draw (0, 0, lsDib);
pdximg.surface.Canvas.Release;
pdximg.surface.TransparentColor := 0;
end else begin *) //注释后解决修改真彩后按钮不能点
end
|
|