Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: Another alphablending question

  1. #1

    Another alphablending question

    I'm using DelphiX with Delphi 6 and was playing with the drawalpha functions. I have a few questions

    Could anyone tell me what the patternindex integer is used for?

    DXImageList1.Items[x].drawalpha(Dest: TDirectDrawSurface; const DestRect: TRect; PatternIndex: Integer; Alpha: Integer);

    all I have found out is if its set to anything other than 0 it doesn't draw your image and the other is, if I draw an object using any of the alpha functions the object appears green. I guess I'm doing something wrong, anyone have any ideas on that?

    Thanks

    Asmod.

  2. #2

    Re: Another alphablending question

    Quote Originally Posted by Asmod
    Could anyone tell me what the patternindex integer is used for?
    It is used to allow you to combine multiple images the same size, into one single image, which is especially useful for animation and tiling. You can divide the image up using the PatterWidth and Pattern Height properties of the TPictureCollectionItem object (also the SkipHeight and SkipWidth properties)

    The PatternIndex then specifies which part of the image to draw:
    Code:
    -------------------
    |0 |1 |2| 3| 4| 5|
    -------------------
    |6 |7 |8| 9|10|11|
    -------------------
    |12|13|14|15|16|17|
    -------------------

    I have no idea why anything would be going green. The Alpha value should be between 0 and 255.
    [size=10px][ Join us in #pgd on irc.freenode.net ] [ Sign the Petition for a Software Patent Free Europe ][/size]

  3. #3

    Another alphablending question

    Sure I can... The PatternIndex is usefull when you are using a tiled bitmap, with that I mean, say you have an animation of a walking mario, and say each your total picture is 690x64 and each frame of your animation is 64x64 then you can set the patternwidth of the image to 64 and the patternheight to 64. Each time you draw the image to the screen, a rect is calculated with the size of your frame, so in short it only draws the frame you want, so if I wanted the 4th frame I set PatternIndex to 4, if I want the 10th frame then I set the patternIndex to 10...

    I hope I make a bit of sense... It's hard to explain without having examples... Take a look at the pacman image over at this URL
    http://delphigamedev.name2host.com/dxtut3b.htm and you'll see what I mean, each pacman frame has the same with and so you could make an animation using the patternindex (the tutorial uses the SpriteEngine to make animations, but if you want you can do it yourself with the patternindex).
    Do it by the book, but be the author!
    <br />
    <br />Visit the Lion Productions website at:
    <br />http://lionprod.f2o.org

  4. #4

    Another alphablending question

    ah thanks, I've used tiled bitmaps before the green alpha blend is the weird one though. Maybe I have some settings wrong but this is what I mean by green !!


    The image on the bottom right should be the same as the image on the bottom left (colourwise) the only difference is one was drawn using the drawalpha function


  5. #5

    Another alphablending question

    What image type are you using, I'm no expert on alpha drawing, but it might be a color problem or a image type problem... Just a guess though
    Do it by the book, but be the author!
    <br />
    <br />Visit the Lion Productions website at:
    <br />http://lionprod.f2o.org

  6. #6

    Another alphablending question

    its a png, thats a good point though, I'll try a few different types

  7. #7

    Another alphablending question

    I belive that DelphiX for Delphi6 has a bug when it comes to alpha drawing, and that is why you get green. Sadly, I don't know how to fix this.
    Signature:
    <br />This is a block of text that can be added to posts you make. There is a 255 character limit

  8. #8

    Another alphablending question

    Quote Originally Posted by Ultra
    I belive that DelphiX for Delphi6 has a bug when it comes to alpha drawing, and that is why you get green. Sadly, I don't know how to fix this.
    oh ok, well thanks for the replies one final question then,

    Whats a good replacement for DelphiX that can handle alphablending and stuff? The headers from http://www.crazyentertainment.net/ ? or something else?

  9. #9

    Replacement for DelphiX

    There is free Graphics32 out there. It has even alpha-channeled bitmaps (transparency varies at each pixel) and it doesn't need DirectX.
    But DelphiX is The primary graphics component that you should not forget. Even if you don't use DelphiX for graphics, it still has easy Internet/Networking, sound and input capabilities.

  10. #10

    Another alphablending question

    if you don't mind me advertizing my own component set here...

    http://www.xsdevkit.com

    does fast alpha blending and alpha channels using DirectXGraphics. You might want to check it out.
    It doesn't have network components yet, but of course you can continue to use the DelphiX ones.
    Ask me about the xcess game development kit

Page 1 of 2 12 LastLast

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
  •