/usr/src/castle-game-engine-5.2.0/images/images_dds.inc is in castle-game-engine-src 5.2.0-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | function LoadDDS(Stream: TStream;
const AllowedImageClasses: array of TEncodedImageClass): TEncodedImage;
var
DDS: TDDSImage;
begin
DDS := TDDSImage.Create;
try
DDS.LoadFromStream(Stream);
{ After successfully loading, DDS should always contain at least one image }
Assert(DDS.Images.Count >= 1);
{ This way I don't have to make a copy of DDS.Images[0] for Result,
which would be a waste of time. }
DDS.OwnsFirstImage := false;
{ TODO: make sure to honor AllowedImageClasses.
For now, this just returns whatever DDS set, without converting... }
Result := DDS.Images[0];
finally FreeAndNil(DDS) end;
end;
procedure SaveDDS(Img: TEncodedImage; Stream: TStream);
var
DDS: TDDSImage;
begin
DDS := TDDSImage.Create;
try
DDS.Width := Img.Width;
DDS.Height := Img.Height;
DDS.DDSType := dtTexture;
DDS.Mipmaps := false;
DDS.MipmapsCount := 1;
DDS.Images.Count := 1;
DDS.Images[0] := Img;
DDS.OwnsFirstImage := false;
DDS.SaveToStream(Stream);
finally FreeAndNil(DDS) end;
end;
|