![]() |
Re: Andorra 2D [Ver. 0.4.5.1, 31.12.08]
Die Surface-Demo läuft hier wunderbar (Linux, Lazarus, OpenGL)
|
Re: Andorra 2D [Ver. 0.4.5.1, 31.12.08]
Hm.
Wenn ich nach dem Create noch ein
Delphi-Quellcode:
einfüge, funktioniert es zumindest insofern, dass ich das gezeichnete übertragen kann. Allerdings wird der Inhalt des TextureSurfaces dann nicht gespeichert, sondern ist im nächsten Zeichenschritt wieder verloren (-> Grafikmüll oder gar nichts).
adTextureSF.Texture.Clear;
Sprich, ich muss jedesmal neu auf das TextureSurface zeichnen, was aber ja nicht Sinn der Sache ist. Mich wundert's halt, dass es in OpenGL prima funktioniert... habe auch nochmal die AndorraDX93D.dll neu compiliert, damit wurde sie zwar ~30kb kleiner, hat aber ansonsten nichts gebracht. |
Re: Andorra 2D [Ver. 0.4.5.1, 31.12.08]
Zitat:
Zitat:
Zitat:
Zitat:
Und ich habe jetzt das AdImage einfach mal drauf gezeichnet und das Ergebnis ist dass unter Delphi 2009 SaveToGraphic nicht funktioniert. MfG xZise |
Re: Andorra 2D [Ver. 0.4.5.1, 31.12.08]
Wenn du wissen möchtest, ob ein TAdImage komplett Schwarz ist, dann speichere es doch in ein TAdBitmap und greife einfach über Scanline darauf zu:
Delphi-Quellcode:
var
adbmp: TAdBitmap; pc: PCardinal; begin adbmp := TAdBitmap.Create; AdImage.Texture.SaveToGraphic(adbmp); pc := adbmp.Scanline; for i := 0 to (adbmp.Size div 4) - 1 do begin if (pc^ and $FFFFFF00) <> 0 then Nicht Schwarz //and $FFFFFF00 ist um den Alphakanal zu ignorieren inc(pc); end; adbmp.Free; end; |
Re: Andorra 2D [Ver. 0.4.5.1, 31.12.08]
Zitat:
Delphi-Quellcode:
MfG
bmp := TBitmap.Create;
try AImgBuf.Texture.SaveToGraphic(bmp); bmp.SaveToFile(ExtractFilePath(ParamStr(0)) + 'Neuer Ordner\' + AName + '-a.bmp'); finally bmp.Free; end; xZise |
Re: Andorra 2D [Ver. 0.4.5.1, 31.12.08]
Debugge das "SaveToFile" doch mal durch. Dann erkennst du doch vermutlich wo es scheitert.
|
Re: Andorra 2D [Ver. 0.4.5.1, 31.12.08]
Ehm warum das denn? Also erstens nehme ich an dass der VCL Code soweit i.O. ist und zweitens könnte ich dieses Bitmap auch mit einem TImage verknüpfen und würde nur eine Schwarze Fläche sehen.
MfG xZise [edit=0]Ich meine natürlich nicht den VLC media player sondern die Visual Component Library[/edit] |
Re: Andorra 2D [Ver. 0.4.5.1, 31.12.08]
Ich meinte natürlich SaveToGraphic :oops:
|
Re: Andorra 2D [Ver. 0.4.5.1, 31.12.08]
Achso ;)
Naja ich habe es vermutlich auf das Kopieren der Daten (AssignTo der Klasse TAdVCLFormat^^) eingegrenzt. Aber so richtig weiß ich nicht, was ich da testen könnte. Was sein könnte, dass er irgendwie die Hintergrundfarbe nicht richtig setzt, weil da wo Transparenz ist, sieht man schwarz (durchscheinen). Trace von SaveToGrapic
Delphi-Quellcode:
Wenn ich da das bmp speichere habe ich schon den Big. Das heißt ich vermute es liegt irgendwie an den Move. Wobei ich natürlich da vorher das ABitmap getestet habe und wenn ich vor der for-Schleife das Bitmap teste läuft alles wunderbar:
function TAdVCLFormat.AssignTo(ABitmap: TAdBitmap;
AGraphic: TObject): boolean; var bmp: TBitmap; y: integer; begin result := true; bmp := TBitmap.Create; try bmp.PixelFormat := pf32Bit; bmp.Width := ABitmap.Width; bmp.Height := ABitmap.Height; for y := 0 to bmp.Height - 1 do Move(ABitmap.ScanLine(y)^, bmp.ScanLine[y]^, ABitmap.Width * 4); TGraphic(AGraphic).Assign(bmp); finally bmp.Free; end; end;
Delphi-Quellcode:
MfG
function TAdVCLFormat.AssignTo(ABitmap: TAdBitmap;
AGraphic: TObject): boolean; var bmp: TBitmap; y: integer; i : Integer; pc: PCardinal; begin result := true; bmp := TBitmap.Create; try bmp.PixelFormat := pf32Bit; bmp.Width := ABitmap.Width; bmp.Height := ABitmap.Height; pc := ABitmap.Scanline; for i := 0 to (ABitmap.Size div 4) - 1 do begin if (pc^ and $FFFFFF00) <> 0 then Beep; inc(pc); end; for y := 0 to bmp.Height - 1 do Move(ABitmap.ScanLine(y)^, bmp.ScanLine[y]^, ABitmap.Width * 4); bmp.SaveToFile(ExtractFilePath(ParamStr(0)) + 'Neuer Ordner\' + IntToStr(Random(MaxInt - 1)) + '-a.bmp'); TGraphic(AGraphic).Assign(bmp); finally bmp.Free; end; end; xZise |
Re: Andorra 2D [Ver. 0.4.5.1, 31.12.08]
Ersetzte die MoveTo Zeilen mal Schritt für Schritt durch die folgenden Codeschnipsel und schildere was passiert:
1.
Delphi-Quellcode:
2.
var
pc1, pc2: PCardinal; x, y: integer; begin for y := 0 to bmp.Height - 1 do begin pc1 := bmp.Scanline[y]; pc2 := ABitmap.Scanline(y); for x := 0 to bmp.Width - 1 do begin pc1^ := $FF0000FF; //Blaues Bitmap, Alpha $FF inc(pc1); inc(pc2); end; end; end;
Delphi-Quellcode:
3.
var
pc1, pc2: PCardinal; x, y: integer; begin for y := 0 to bmp.Height - 1 do begin pc1 := bmp.Scanline[y]; pc2 := ABitmap.Scanline(y); for x := 0 to bmp.Width - 1 do begin pc1^ := $FFFFFFFF; //Weißes Bitmap, Alpha $FF inc(pc1); inc(pc2); end; end; end;
Delphi-Quellcode:
var
pc1, pc2: PCardinal; x, y: integer; begin for y := 0 to bmp.Height - 1 do begin pc1 := bmp.Scanline[y]; pc2 := ABitmap.Scanline(y); for x := 0 to bmp.Width - 1 do begin pc1^ := pc2^ or $000000FF; //Inhalt ABitmap, Alpha $FF inc(pc1); inc(pc2); end; end; end; 4.
Delphi-Quellcode:
var
pc1, pc2: PCardinal; x, y: integer; begin for y := 0 to bmp.Height - 1 do begin pc1 := bmp.Scanline[y]; pc2 := ABitmap.Scanline(y); for x := 0 to bmp.Width - 1 do begin pc1^ := pc2^; //Inhalt ABitmap, Alpha $FF inc(pc1); inc(pc2); end; end; end; |
Alle Zeitangaben in WEZ +1. Es ist jetzt 01:04 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz