I'm not sure which drawing methode you are using, but I think the following should work:
[pascal]Dxdraw1.Surface.Draw(0, 0, yourspritesurface.clientrect, yourspritesurface, true);[/pascal]
I'm not sure which drawing methode you are using, but I think the following should work:
[pascal]Dxdraw1.Surface.Draw(0, 0, yourspritesurface.clientrect, yourspritesurface, true);[/pascal]
The best transparent color is Black. I've seen other colors having problems, when changing color manually. I think proper color would come when you get pixel from DXSurfaceCanvas of picture (not from DXSurface.Pixels).
These colors may not be in form $FFFFFF which normally would be white.
In my experience the best color for transparency is MAGENTA as it is easily replaced by other colors. Black, on the other hand, is used a lot, to border the sprites, for example. I've also encountered problems using black for transparency on WinME, dunno why, though, as the game worked fine on other OSs.Originally Posted by User137
I select the transparent color by checking the color of the pixel[1,1] and it works fine.
What echoes in Eternity has been done in someone's life...
I think is something we can debate about. In my opinion it doesn't really matter which color you choose as a background color. It all depends on the image itself. If you have one with a lot of purple in it, then magenta isn't the color either...
Anyway, I discovered that selecting a transparency color doesn't always work at diferent color depths.
When selecting the color by looking at pixel[x,y] you might want to try typecasting it to a word
[pascal]if (word(YourSurface.Pixels[X,Y]) = 65535) then showmessage('you have clicked on a white pixel');[/pascal]
The TransparentColor property of TDXPictureCollectionItem is a Delphi TColor, so you can simply use $00FF00FF for magenta and it should work. For TDirectDrawSurface, however, TransparentColor is in the format of the surface. You can use the ColorMatch method to set the TransparentColor of a surface to a TColor value, like so:
[pascal]Surface.TransparentColor := Surface.ColorMatch($00FF00FF);[/pascal]
[size=10px][ Join us in #pgd on irc.freenode.net ] [ Sign the Petition for a Software Patent Free Europe ][/size]
Bookmarks