--- oup/current/Global/OniImgClass.pas 2007/05/24 17:48:18 192 +++ oup/current/Global/OniImgClass.pas 2007/05/26 18:26:48 194 @@ -15,6 +15,7 @@ type function GetHeight(MipGen: Integer): Integer; function GetImageFormat: TImageFormat; procedure SetImageFormat(Format: TImageFormat); + function pGetImageFormatInfo: TImageFormatInfo; function GetHasMipMaps: Boolean; protected public @@ -23,6 +24,7 @@ type property Width[MipGen: Integer]: Integer read GetWidth; property Height[MipGen: Integer]: Integer read GetHeight; property Format: TImageFormat read GetImageFormat write SetImageFormat; + property FormatInfo: TImageFormatInfo read pGetImageFormatInfo; property HasMipMaps: Boolean read GetHasMipMaps; constructor Create; @@ -55,7 +57,7 @@ var rect: TRect; begin InitImage(singleimg); - CloneImage(FImages[Index], singleimg); + CloneImage(FImages[Index-1], singleimg); ConvertImage(singleimg, ifX8R8G8B8); rect.Left := 0; rect.Top := 0; @@ -130,6 +132,13 @@ begin end; +function TOniImage.pGetImageFormatInfo: TImageFormatInfo; +begin + if Length(FImages) > 0 then + GetImageFormatInfo(FImages[0].Format, Result); +end; + + function TOniImage.GetHasMipMaps: Boolean; begin Result := Length(FImages) > 1; @@ -423,10 +432,26 @@ begin ConManager.Connection[ConnectionID].LoadRawFile(fileid, $9C, TStream(data)) else ConManager.Connection[ConnectionID].LoadRawFile(fileid, $A0, TStream(data)); + +// data.Seek(0, soFromBeginning); +// data.SaveToFile('m:\test.txmp'); + data.Seek(0, soFromBeginning); result := LoadMultiImageFromStream(data, FImages); data.Free; - +{ + if result then + begin + for i := 0 to High(FImages) do + begin + data := TMemoryStream.Create; + data.Write(FImages[i].Bits^, FImages[i].Size); + data.Seek(0, soFromBeginning); + data.SaveToFile('m:\test.txmp.'+IntToStr(i)); + data.Free; + end; + end; +} if not result then begin ShowMessage('Error while loading file' + #13#10 + DetermineStreamFormat(data));