![]() |
[DelphiX] Zeichnen mit Transparenz
Morgen.
Ich lade aus einer Targa-Datei Images für eine TDXImageList. TGAs besitzen bekanntermaßen einen Alphakanal, den ich auch fleißig nutze. Wie muss ich die Targas da rein speichern bzw. rauszeichnen, damit die Transparenz auch angewandt wird? (TTarga, die ich verwende ist von TPicture abgeleitet, hat also alle Propertys/Methoden davon) |
Re: [DelphiX] Zeichnen mit Transparenz
Ist nur ne Vermutung, aber hast du das Property Transparent auf true gesetzt ?
Und geschaut ob die Transparent color stimmt ? |
Re: [DelphiX] Zeichnen mit Transparenz
Transparent ist true und da ich einen Alphakanal habe, brauche ich doch gar keine TransparentColor.
|
Re: [DelphiX] Zeichnen mit Transparenz
Wenn du DirectDraw verwendest, kommst du nicht dran, da DD keine Alphakanäle unterstützt. Der einzige Weg wäre über Direct3D.
|
Re: [DelphiX] Zeichnen mit Transparenz
OK, wie könnt ich es dann lösen?
|
Re: [DelphiX] Zeichnen mit Transparenz
Genau bildfüllende Polygone mit Texturen. Die Textuern in D3D können nämlich mit Alphakanälen arbeiten. Zudem wird es damit erheblich einfacher die Zeichenreihenfolge zu managen: Einfach die Z-Koordinaten dafür hernehmen.
Wie das codemäßig im Detail aussehen müsste, kann ich dir mangels Erfahrung mit D3D leider nicht liefern. Das sollte aber mit Hilfe von Tuts recht gut machbar sein. Ich selbst bin nämlich auch schon mal sehr verzweifelt auf der Suche nach Alpha in DirectDraw gewesen, und bin nach der Erkenntnis, dass das nix wird, dann dort bei dem Projekt bis dato einfach stehen geblieben (war auch nix wirklich wichtiges - nur ne Spielerei). |
Re: [DelphiX] Zeichnen mit Transparenz
Ich will kein D3D verwenden, ich denke mal das würde einiges an Overhead mitbringen.
Ich kann natürlich zur Not auch statt Transparenz einfach clFuchsia verwenden, aber ich müsste dazu wissen, wie ich das dann mit DelphiX löse. Ich denke mal, irgendwie wird Transparenz mit Direct Draw schon gehen, oder? |
Re: [DelphiX] Zeichnen mit Transparenz
ja an sich ein bitmap wo eine hintergrundfarbe da ist dann musst du noch transparent color setzen und transparent auf true.
edit: wenn ich ein beispiel uppen soll sag bescheid |
Re: [DelphiX] Zeichnen mit Transparenz
Ich probiers mal aus...
|
Re: [DelphiX] Zeichnen mit Transparenz
Hello!
Hardware accelerated unDelphiX ver. 1.7a support alphachannel internaly. You have to load image into DXImageList as DIB 32 (with alhachannel) and it will be work (TARGA has to convert to DIB32). You can download source from ![]() Sorry, I don't understand well, but simple note for D3D: Hardware accelerated unDelphiX run on D3D interface and it contain some magics for compatibility to up. I had to find solution for general base of using, sorry. I know that unDelphiX isn't perfect, but I work myself. |
Re: [DelphiX] Zeichnen mit Transparenz
Hi ijcro,
could you give a quick explanation on how to get the alphachannel in the DIB? I tried it with Photoshop (new file -> background = transparent -> a few lines with the brush -> save as -> dib) but it just didnt save the alphachannel. Well maybe it did, but there was no transparence while drawing on the DXDraw surface. Is it possible to use the Sprite/ImageSprite classes just as before by changing the Image from a "foo.bmp" to a "foo.dib" or do you have to change something else? [edit] I just tried to load the image with this TDIB component and called
Delphi-Quellcode:
I saw the Alphachannel, so it must have been saved. But there is still no sign of the Alphachannel when I draw the picture as a Sprite..
DXDraw.Surface.LoadFromDIB(DIB.AlphaChannel);
[/edit] |
Re: [DelphiX] Zeichnen mit Transparenz
Helper exists and with it you can put DIB8 into alphachanel (or get out), please see into source in DIB units.
|
Re: [DelphiX] Zeichnen mit Transparenz
Do I have to Draw the DIB manualy or can I just go on drawing the ImageSprite with the DXSpriteEngine?
|
Re: [DelphiX] Zeichnen mit Transparenz
Aha, you is using DXSpriteEngine yet...
Whe you is using "new look" of DXSpriteEngine, you can use HW acceleration a picture with alpha channel, stored in DXImageList. When you prepare picture in other program in way joint DIB24 R8G8B8 and DIB8 A8 with function DIB32.AssignAlphaChannel(DIB8), no more. Please see to function HasAlphaChannel and property AlphaChannel in TDIB class too. |
Re: [DelphiX] Zeichnen mit Transparenz
Eh sorry, my English is worst than ever
:gruebel: |
Re: [DelphiX] Zeichnen mit Transparenz
Zitat:
|
Re: [DelphiX] Zeichnen mit Transparenz
Well, you can send there code for test...
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 10:11 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