Results 1 to 13 of 13

Thread: DD Image darkening

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jul 2000
    Posts
    225

    DD Image darkening

    Hi,

    Is it possible to blit an image to screen with DD/BltFast (fullscreen), and also darken it to a certain amount? Is there an easy way to do this?

    -Git

  2. #2
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    Well you could make a black surface (bltcolorfill it) and then alphablend them together w/microsoft's alphablend function.
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  3. #3
    Frenzied Member Jotaf98's Avatar
    Join Date
    Jun 2000
    Location
    I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
    Posts
    1,457
    Nah, I think that function only works in Win98 (not sure). You should use something more reliable, like a custom DLL

    Look for vbDABL, it's the best one in my opinion. You can find it in any search engine I think, if not, reply here and I'll e-mail it to you.
    Code:
    Temp = Me.GetIQ()
    'Error 9: Overflow
    'DON'T PANIC! :eek:

    To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systems here.


    Jotaf's Theories!
    "Cats land on their feet. Toast lands peanut butter side down. A cat with toast strapped to its back will hover above the ground in a state of quantum indecision."

  4. #4
    Fanatic Member PsychoMark's Avatar
    Join Date
    Feb 2001
    Location
    Netherlands
    Posts
    540
    That DLL won't work without MMX, and my own pc doesn't have MMC


    If you really want control and speed, plus some other nice things like rotation, you could also use Direct3D:

    Direct3D -> 2D, Rotation
    Direct3D -> 2D, Faking Light (the darkening you're looking for)
    Direct3D -> 2D, Alpha Blending


    Those are samples I've uploaded to PSC when I started using Direct3D for 2D graphics...
    Teaudirenopossum.Musasapientumfixaestinaure.
    (I can't hear you. There's a banana in my ear)

  5. #5
    Frenzied Member Jotaf98's Avatar
    Join Date
    Jun 2000
    Location
    I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
    Posts
    1,457
    Yeah, that's cool. The only reason why it's not THAT widely used, is that it only works decently with a hardware accelerator... of course you could add the option to turn off those effects, but maybe having a "backup plan" would be better

    I've heard ASM is really fast. Maybe faster than C++. But which one do you think would be easier to make a special effects DLL?
    Code:
    Temp = Me.GetIQ()
    'Error 9: Overflow
    'DON'T PANIC! :eek:

    To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systems here.


    Jotaf's Theories!
    "Cats land on their feet. Toast lands peanut butter side down. A cat with toast strapped to its back will hover above the ground in a state of quantum indecision."

  6. #6
    Fanatic Member PsychoMark's Avatar
    Join Date
    Feb 2001
    Location
    Netherlands
    Posts
    540
    I don't know ASM, but I started learning C++ and Delphi recently. Delphi is easier, but I think C++ is a little faster (haven't really tested the Delphi DLL, but the C++ DLL was 900% faster than VB!!!!). AFAIK, ASM is a little faster than C++, but I never even tried to understand it...

    Btw, the test I performed was between a C++ DLL, and a VB ActiveX DLL, both doing array manipulation to change pictures (without lookup tables)... there's an example at http://www.vbexplorer.com/directx4vb/ (Code -> General VB Gaming -> C++ DLL), which I used as a base for my code, not too difficult really...
    Teaudirenopossum.Musasapientumfixaestinaure.
    (I can't hear you. There's a banana in my ear)

  7. #7
    Frenzied Member Jotaf98's Avatar
    Join Date
    Jun 2000
    Location
    I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
    Posts
    1,457
    Hey PsychoMark, thanks for the link! I've been looking for that for AGES!!! And it's easier than I thought

    Also, why did that DLL work only with MMX, and is it THAT fast?
    Code:
    Temp = Me.GetIQ()
    'Error 9: Overflow
    'DON'T PANIC! :eek:

    To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systems here.


    Jotaf's Theories!
    "Cats land on their feet. Toast lands peanut butter side down. A cat with toast strapped to its back will hover above the ground in a state of quantum indecision."

  8. #8
    Fanatic Member PsychoMark's Avatar
    Join Date
    Feb 2001
    Location
    Netherlands
    Posts
    540
    It uses MMX because of some 64-bit buffers or something. I don't know much about it, but it's explained at the DirectX4VB site...

    Don't know how fast it is; my P133 doesn't have MMX, so even though I have a P550 which does support it, I forgot about it ASAP (didn't want to force the user to have MMX)...
    Teaudirenopossum.Musasapientumfixaestinaure.
    (I can't hear you. There's a banana in my ear)

  9. #9

    Thread Starter
    Addicted Member
    Join Date
    Jul 2000
    Posts
    225
    Hmm...is there any way to do it with Direct X/Draw 7? I'd prefer not to use DX8 or D3D (my entire program is written in DD7), but I guess I might not have a choice.

    -Git

  10. #10
    Fanatic Member PsychoMark's Avatar
    Join Date
    Feb 2001
    Location
    Netherlands
    Posts
    540
    For your problem, there are generally 3 ways:

    - create some slow VB code
    - create a C++ DLL which handles it
    - use Direct3D
    Teaudirenopossum.Musasapientumfixaestinaure.
    (I can't hear you. There's a banana in my ear)

  11. #11
    Frenzied Member Jotaf98's Avatar
    Join Date
    Jun 2000
    Location
    I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
    Posts
    1,457
    Don't worry, I'm doing it the DLL way right now, all you gotta do is wait

    I'll use the same code to generate the lookup tables as in another special effects module I made, for BitBlt games. To have a look at it, look for "Special Effects for BitBlt", somewhere in this forum. But this time it's gonna be for DDraw
    Code:
    Temp = Me.GetIQ()
    'Error 9: Overflow
    'DON'T PANIC! :eek:

    To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systems here.


    Jotaf's Theories!
    "Cats land on their feet. Toast lands peanut butter side down. A cat with toast strapped to its back will hover above the ground in a state of quantum indecision."

  12. #12
    Fanatic Member PsychoMark's Avatar
    Join Date
    Feb 2001
    Location
    Netherlands
    Posts
    540
    You can amazing things with the DirectDraw GetLockedArray function and a C++ DLL, that's for sure.... I almost can't wait to see your DLL Jotaf98

    Also, if you make the DLL accept an array, you can use it for both the DD GetLockedArray call and you can apply it to normal PictureBoxes (I've got a sample program here which get's an array from a picture for fast manipulation, somewhat like the GetLockedArray thing, which is pretty fast, a lot faster then Get/SetPixel anyways). Now wouldn't that be nice
    Teaudirenopossum.Musasapientumfixaestinaure.
    (I can't hear you. There's a banana in my ear)

  13. #13
    Frenzied Member Jotaf98's Avatar
    Join Date
    Jun 2000
    Location
    I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
    Posts
    1,457
    The DLL is coming a long good, I've done it in VB and it works very well, so all I need to do now is translate it into C++.

    The DLL will manipulate ARRAYS, not surfaces! You can use it with anything you want, as long as it's 24-bits, NO MATTER IF IT'S RGB OR BGR. Also, the lookup tables will be built-in, so all you have to do is write a simple blting function that handles cut edges (I'll provide one, so don't worry)
    Code:
    Temp = Me.GetIQ()
    'Error 9: Overflow
    'DON'T PANIC! :eek:

    To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systems here.


    Jotaf's Theories!
    "Cats land on their feet. Toast lands peanut butter side down. A cat with toast strapped to its back will hover above the ground in a state of quantum indecision."

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