Results 1 to 10 of 10

Thread: Alpha draw not working

  1. #1
    PGD Community Manager AthenaOfDelphi's Avatar
    Join Date
    Dec 2004
    Location
    South Wales, UK
    Posts
    1,245
    Blog Entries
    2

    Alpha draw not working

    Hi all,

    Heres a quick question for you....

    I'm doing some work on our game engine and I want to add something to the main screen, but I want it to be alpha blended.

    I create a surface and fill it with black (0) for transparency, then I draw on it. I want to draw a section of this on the main screen using alpha blend so the user can see whats underneath, but all I get is nothingness. No errors, just nothing.

    As soon as I change the drawAlpha to draw, it works.

    So my code goes something like this:-

    Code:
    ....
    // Create the surface 'mySurface'
    ....
    // Draw on the surface 'mySurface'
    ....
    // Draw a portion of 'mySurface' on the main surface
    fDXDraw.surface.drawAlpha(dstRect,srcRect,mySurface,true,150);
    ....
    Apologies if the syntax isn't quite right, and just figured I'd ask the question in case anyone else has encountered this problem and has found a solution.

    That code doesn't work, but draw(left,top,srcRect,mySurface,true); (again, apologies if the syntax isn't quite right) does. Any ideas? Its not a show stopper, but alpha is just much nicer and it doesn't obscure the players view completely.
    :: AthenaOfDelphi :: My Blog :: My Software ::

  2. #2

    Alpha draw not working

    Could it be that you have a similar problem as dicussed in here?

  3. #3
    PGD Community Manager AthenaOfDelphi's Avatar
    Join Date
    Dec 2004
    Location
    South Wales, UK
    Posts
    1,245
    Blog Entries
    2

    Alpha draw not working

    Hi Traveller,

    I don't think so. I started off, by just trying to draw it with Alpha, without any transparency and that didn't work either.

    Basically, I'm adding a minimap... so the minimap surface is around the 2000 x 2000 pixel mark. As each cell is uncovered, it is drawn onto the minimap surface. As the player moves, I simply draw a section of the minimap in the bottom left corner of the screen.

    My original code didn't use transparency at all. It simply filled the minimap surface with black and the drew the cells onto the minimap and then tried to alphadraw it to the main surace, but I just get nothing. Its not that its being corrupted or anything like that, its simply not being drawn at all.
    :: AthenaOfDelphi :: My Blog :: My Software ::

  4. #4

    Alpha draw not working

    Hmmm.... if Draw is working, and DrawAlpha doesn't, then maybe your Rect-Calculations are not correct? I don't think that it really has to do something with the alpha property itself. Did you try to use DrawAlpha and set Alpha to "no transparency"? (Don't know if it is 0 or 255 in you case, for I don't use DelphiX).
    <a href="http://www.greatgamesexperiment.com/game/Valgard/?utm_source=gge&amp;utm_medium=badge_game"><img border="0" alt="GGE" title="GGE" src="http://static.greatgamesexperiment.com/badge/game/valgard/gge400x56.png"></a>

  5. #5
    PGD Community Manager AthenaOfDelphi's Avatar
    Join Date
    Dec 2004
    Location
    South Wales, UK
    Posts
    1,245
    Blog Entries
    2

    Alpha draw not working

    Hi Dirk,

    I've checked the rect boundary and its fine... topleft is less than bottomright and all coordinates are valid for both the source and destinations.

    Alpha draw is working nicely when I draw a whole image (a tile for example), but I've never been able to get it to draw a portion of a surface (IIRC) which is obviously what I'm trying to do with the minimap.

    Its no problem if I can't get it working, we'll just have to have the miniamp smaller, but it would have been nice to allow it to be bigger by way of the fact that the player can see through it.
    :: AthenaOfDelphi :: My Blog :: My Software ::

  6. #6

    Alpha draw not working

    Quote Originally Posted by AthenaOfDelphi
    I've never been able to get it to draw a portion of a surface
    Here i see the problem. If you are using accelerated unDelphix, try the new 1.07 where it should be actually made All should work on software mode though in all versions.

  7. #7
    PGD Community Manager AthenaOfDelphi's Avatar
    Join Date
    Dec 2004
    Location
    South Wales, UK
    Posts
    1,245
    Blog Entries
    2

    Alpha draw not working

    I have just tried the latest version... see my feedback in the thread announcing its release.
    :: AthenaOfDelphi :: My Blog :: My Software ::

  8. #8

    Alpha draw not working

    Alphablending you can use in the way:

    1/ make bitmap32 with alphachannel (8bit)
    2/ load it int DXImageList
    3/ turn on hardware acceleration (like prototype project)

    when all is correct, blending works as well. (Exotic formats like R4G4B4A4 doesn't works).

    When you make copy from DDS, I am not sure that is copy with alphachanel, I take that is in 24 bitcount only

    Sincerely
    Ijcro.

  9. #9
    PGD Community Manager AthenaOfDelphi's Avatar
    Join Date
    Dec 2004
    Location
    South Wales, UK
    Posts
    1,245
    Blog Entries
    2

    Alpha draw not working

    Alpha blending works when I draw an item from TDXImageList in its entirety... it doesn't work when I try to draw a section of a surface onto the primary surface. But the latest version of unDelphiX doesn't compile straight from the archive on Delphi 5.
    :: AthenaOfDelphi :: My Blog :: My Software ::

  10. #10

    Alpha draw not working

    Please download lastest version 1.07a! Thank you.
    Sincerely
    Ijcro.

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
  •