var
LImage: TMultiImage;
LImageCanvas: TImagingCanvas;
LImageMipMaps: TDynImageDataArray;
begin
...
LImage.Format := ifDXT5;
Imaging.GenerateMipMaps(LImage.ImageDataPointer^, 10, LImageMipMaps);
LImage.AddImages(LImageMipMaps);
FreeImagesInArray(LImageMipMaps);
LImage.SaveMultiToFile(ToDir + ToMaterial + '.dds');
...
end;
function TMultiImage.PrepareInsert(Index, Count: Integer): Boolean;
var
I: Integer;
begin
// Inserting to empty image will add image at index 0
if GetImageCount = 0 then
Index := 0;
if (Index >= 0) and (Index <= GetImageCount) and (Count > 0) then
begin
SetLength(FDataArray, GetImageCount + Count);
if Index < GetImageCount - 1 then
begin
// Move imges to new position
System.Move(FDataArray[Index], FDataArray[Index + Count],
(GetImageCount - Count - Index) * SizeOf(TImageData));
// Null old images, not free them!
for I := Index to Index + Count - 1 do
InitImage(FDataArray[I]);
end;
Result := True;
end
else
Result := False;
end;
function TMultiImage.PrepareInsert(Index, Count: Integer): Boolean;
var
I, LImageCount: Integer;
begin
// Inserting to empty image will add image at index 0
LImageCount := GetImageCount;
if LImageCount = 0 then
Index := 0;
if (Index >= 0) and (Index <= LImageCount) and (Count > 0) then
begin
SetLength(FDataArray, LImageCount + Count);
if Index <= LImageCount - 1 then
begin
// Move images to new position
System.Move(FDataArray[Index], FDataArray[Index + Count], (GetImageCount - Count - Index) * SizeOf(TImageData));
// Null old images; do not free them!
for I := Index to Index + Count - 1 do
InitImage(FDataArray[I]);
end;
Result := True;
end
else
Result := False;
end;
procedure TMultiImage.InsertImages(Index: Integer;
const Images: TDynImageDataArray);
begin
DoInsertImages(Index, FDataArray);
end;
procedure TMultiImage.InsertImages(Index: Integer;
const Images: TDynImageDataArray);
begin
DoInsertImages(Index, Images);
end;
Var Img: TImageData;
tm: TMemoryStream;
tm := TMemoryStream.Create;
InitImage(Img);
LoadImageFromFile('Z:\xx.dds', Img);
SaveImageToStream('.png',tm,Img);
tm.SaveToFile('z:\xxx.png');
tm.free;
FreeImage(Img);
Page created in 0.016 seconds with 20 queries.