Results 1 to 11 of 11

Thread: BitBlt

  1. #1

    Thread Starter
    Not NoteMe SLH's Avatar
    Join Date
    Mar 2002
    Location
    192.168.0.1 Preferred Animal: Penguin Reason for errors: Line#38
    Posts
    3,051

    BitBlt

    Firstly, sorry about starting a thread for this, i know this sort of thing has been answered many times, but i just can not get it to work.


    I'm making an tile based game editor. I'm currently bitblting the pictures on to the form, then using SRCAND to overlay the current object to place (which follows the cursor, and only changes the 'map' when the user clicks.

    Instead of blending the images together i want to overlay the current object on top of the form.

    As i already had all the SRCAND bitblt commands set up correctly, i decided to make a sub that instead of doing and, did a mask & picture.

    Here is the Sub i'm using:

    VB Code:
    1. Public Sub MskBlt(DestDC, X, Y, Width, Height, SrcDC)
    2.     BitBlt DestDC, X, Y, Width, Height, SrcDC, Width, 0, SRCPAINT
    3.     BitBlt DestDC, X, Y, Width, Height, SrcDC, 0, 0, SRCAND
    4. End Sub

    All the parameters are the same as the ones i used for bitblt (which worked), except the last 3, which arn't needed any more.


    The trouble is that this still blends the pictures together instead of overlaying them. What have i don't wrong?


    Thanks for any replies.
    Quotes:
    "I am getting better then you guys.." NoteMe, on his leet english skills.
    "And I am going to meat her again later on tonight." NoteMe
    "I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
    "my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
    Have I helped you? Please Rate my posts.


  2. #2
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    Sorry if I misunderstood your problem but what I suppose is:

    Did you generate a mask for your picture or not?

  3. #3

    Thread Starter
    Not NoteMe SLH's Avatar
    Join Date
    Mar 2002
    Location
    192.168.0.1 Preferred Animal: Penguin Reason for errors: Line#38
    Posts
    3,051
    I sure did, infact i used your program to do so

    For those who arn't familiar with Fox's brillient program, it created a bitmap, with the picture on the left, and the mask on the right (how i used it anyway).
    Quotes:
    "I am getting better then you guys.." NoteMe, on his leet english skills.
    "And I am going to meat her again later on tonight." NoteMe
    "I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
    "my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
    Have I helped you? Please Rate my posts.


  4. #4
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    Switch SrcAnd and SrcPaint.
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  5. #5

    Thread Starter
    Not NoteMe SLH's Avatar
    Join Date
    Mar 2002
    Location
    192.168.0.1 Preferred Animal: Penguin Reason for errors: Line#38
    Posts
    3,051
    Thanks for the reply, but i've already tried that already, and for some reason, it does nothing (nothing is drawn on the form).

    I have checked the bitmap is in the correct place etc...
    Quotes:
    "I am getting better then you guys.." NoteMe, on his leet english skills.
    "And I am going to meat her again later on tonight." NoteMe
    "I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
    "my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
    Have I helped you? Please Rate my posts.


  6. #6
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    There's the remote possibility that this could help:

    (What colour is the sprite's background? If it's black use SrcAnd/Paint. If it's white, use MergePaint/SrcAnd (in those orders))
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  7. #7

    Thread Starter
    Not NoteMe SLH's Avatar
    Join Date
    Mar 2002
    Location
    192.168.0.1 Preferred Animal: Penguin Reason for errors: Line#38
    Posts
    3,051
    It's a black background.
    Quotes:
    "I am getting better then you guys.." NoteMe, on his leet english skills.
    "And I am going to meat her again later on tonight." NoteMe
    "I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
    "my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
    Have I helped you? Please Rate my posts.


  8. #8
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    Whoah there's anyone using my Mask Generator? ^^*

    Uhm, however it should work.. make sure AutoRedraw of the picturebox holding your source bitmap is true or post the project..

    Err I'm not sure whether my old MaskGen uses black or white backgrounds.. but if you're using Paint/And (as you do, the drawing code seems correct btw) the colored bitmap part needs a white background and the mask would have a black one...
    Last edited by Fox; May 28th, 2002 at 03:48 PM.

  9. #9

    Thread Starter
    Not NoteMe SLH's Avatar
    Join Date
    Mar 2002
    Location
    192.168.0.1 Preferred Animal: Penguin Reason for errors: Line#38
    Posts
    3,051
    Ok, didn't want to resort to this, but here it is.


    The sub is in the module (with a tempory solution so you can see what's going on), and all the code that calls it is in a procedure called RedrawArea (at the top).

    When you run it, an open dialog will appear, choose test.gnr in the maps directory.
    Attached Files Attached Files
    Quotes:
    "I am getting better then you guys.." NoteMe, on his leet english skills.
    "And I am going to meat her again later on tonight." NoteMe
    "I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
    "my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
    Have I helped you? Please Rate my posts.


  10. #10
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    VB Code:
    1. Public Sub MskBlt(DestDC, X, Y, Width, Height, SrcDC)
    2.     'Draw
    3.     BitBlt DestDC, X, Y, Width, Height, SrcDC, Width, 0, vbSrcPaint
    4.     BitBlt DestDC, X, Y, Width, Height, SrcDC, 0, 0, vbSrcAnd
    5. End Sub

    I had no problem running it with this function.. I could move around the objects in placement mode and they were drawn with transparency... That's it.

  11. #11

    Thread Starter
    Not NoteMe SLH's Avatar
    Join Date
    Mar 2002
    Location
    192.168.0.1 Preferred Animal: Penguin Reason for errors: Line#38
    Posts
    3,051
    Great, that's fixed it. Thanks.
    Quotes:
    "I am getting better then you guys.." NoteMe, on his leet english skills.
    "And I am going to meat her again later on tonight." NoteMe
    "I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
    "my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
    Have I helped you? Please Rate my posts.


Posting Permissions

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



Click Here to Expand Forum to Full Width