Oder muss ich alle einzeln kreieren ?
Code: Alles auswählen
procedure TTexturBuffer.LoadTextures(Bitmap: TBitmap);
var
tx, ty, x, y: integer;
begin
tx := Bitmap.Width;
ty := Bitmap.Height;
Width := tx;
Height := ty;
SetLength(Data, tx * ty);
for y := 0 to ty - 1 do begin
for x := 0 to tx - 1 do begin
Data[y * tx + x].i := Bitmap.Canvas.Pixels[x, (ty - 1) - y];
end;
end;
geladen := False;
end;
procedure TTexturBuffer.LoadTexturesJPG(Datei: string);
var
bmp: TBitmap;
jpg: TJpegImage;
begin
jpg := TJpegImage.Create;
jpg.LoadFromFile(Datei);
bmp := TBitmap.Create;
bmp.Assign(jpg);
LoadTextures(bmp);
bmp.Free;
jpg.Free;
end;
procedure TTexturBuffer.LoadTexturesBMP(Datei: string);
var
bmp: TBitmap;
begin
bmp := TBitmap.Create;
bmp.LoadFromFile(Datei);
LoadTextures(bmp);
bmp.Free;
end; Code: Alles auswählen
procedure TTexturBuffer.LoadTextures3(Datei: string);
var
Picture: TPicture;
begin
Picture := TPicture.Create;
Picture.LoadFromFile(Datei);
LoadTextures(Picture.Bitmap);
Picture.Free;
end;