Page 2 of 2 FirstFirst 12
Results 11 to 15 of 15

Thread: Player Drawing

  1. #11

    Player Drawing

    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]

  2. #12

    Transparency

    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.

  3. #13

    Re: Transparency

    Quote Originally Posted by User137
    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.

    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...

  4. #14

    Player Drawing

    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]

  5. #15

    Player Drawing

    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]

Page 2 of 2 FirstFirst 12

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •