Results 1 to 18 of 18

Thread: Some Bitmap -> Get More/Less Light

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2000
    Location
    Israel
    Posts
    636

    Some Bitmap -> Get More/Less Light

    Hi,

    I have a question.
    I have some BMP file...
    I want within my game, change its light, darker or lighter, whatever I choose.
    How can I do it?

    Thank you,
    Arie.

  2. #2
    Lively Member ice & fire's Avatar
    Join Date
    Oct 2001
    Location
    Land of ice & fire
    Posts
    110
    Need tha too!
    They don´t answer.
    But it´s not a bitmap, just a part of the screen, where i want to change the gamma!

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2000
    Location
    Israel
    Posts
    636

    I have done it.. but...

    See, I don't think my way is fast for big pictures.

    here is the change that I do:
    L = 1 is the same light as original

    Code:
    Private Sub Command1_Click()
    Dim I As Integer, J As Integer
    Dim mR As Integer, mG As Integer, mB As Integer
    Dim L As Single
    L = InputBox("Enter the Light power(0.1-1.9):", "Light Power")
    If L < 0.1 Or L > 1.9 Then
     MsgBox ("Light is not in range!" & vbCrLf & "Setting to 0.5")
     L = 0.5
    End If
    
    TempDC = LoadDC("F:\Real\1.jpg", Form1.hdc)
    BitBlt Form1.hdc, 0, 0, 16, 16, TempDC, 0, 0, vbSrcCopy
    For I = 0 To 16
     For J = 0 To 16
      mR = (GetPixel(TempDC, J, I) And 255) * L
      mG = (GetPixel(TempDC, J, I) \ 256 And 255) * L
      mB = (GetPixel(TempDC, J, I) \ 65536 And 255) * L
      SetPixel TempDC, J, I, RGB(mR, mG, mB)
     Next J
    Next I
    BitBlt Form1.hdc, 16, 0, 16, 16, TempDC, 0, 0, vbSrcCopy
    End Sub
    I wonder if there is a faster way to do it?

    Thank you,
    Arie.

  4. #4
    Lively Member ice & fire's Avatar
    Join Date
    Oct 2001
    Location
    Land of ice & fire
    Posts
    110

    Thumbs down

    I know, I use a similar one for brightness and contrast. For a game with a huge Bitmap, no chance. Calculating for hours!!!

  5. #5
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    You'll be happy if you go see the "Suggestions for Rewrite of Graphics Library" thread by Janus. It has GDI operations that are up to 300 FPS fullscreen on a 1 GHZ machine! (well, at least the old one did )
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  6. #6

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2000
    Location
    Israel
    Posts
    636
    Do you have the Link to it?
    Maybe Code?

    Thank you,
    Arie.

  7. #7
    Lively Member ice & fire's Avatar
    Join Date
    Oct 2001
    Location
    Land of ice & fire
    Posts
    110
    Well, thanks, i downloaded it and read your last posting.
    I have the same problems with running the included demo game....
    How does that work?
    There IS no f2Init...

  8. #8

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2000
    Location
    Israel
    Posts
    636
    Please tell me exactly the address for this post you told about.

    Thank you,
    Arie.

  9. #9
    Lively Member ice & fire's Avatar
    Join Date
    Oct 2001
    Location
    Land of ice & fire
    Posts
    110
    Search for: "Suggestions for Rewrite of Graphics Library"
    on this board

  10. #10
    Hyperactive Member
    Join Date
    Jun 1999
    Location
    ma,usa
    Posts
    485

    It ain't there!

    I went there but didn't get the download. Just a recusive link to the thread. What gives? Can someone post it?

  11. #11
    Lively Member ice & fire's Avatar
    Join Date
    Oct 2001
    Location
    Land of ice & fire
    Posts
    110
    You´re somewhat slow, eh? (don´t take it serious)
    If you search for: "Suggestions for Rewrite of Graphics Library" it will turn up the thread: "I need suggestions for my rewrite of my graphics library."
    If you click on that, you see the link: "Download the Fury2 Graphics Engine"
    If you click on the link there, you´ll get to a post, which includes the file.


    Or HERE it is too: http://www.vbforums.com/attachment.php?s=&postid=563943

  12. #12
    Hyperactive Member
    Join Date
    Jun 1999
    Location
    ma,usa
    Posts
    485
    No offence taken. I am retarded by technology's simplicity!

  13. #13
    Hyperactive Member
    Join Date
    Jun 1999
    Location
    ma,usa
    Posts
    485
    Uhmm... I tried to refrence the .dll through vb "add refrence" and got an error "Can not refrence <filename>". How do I get at and use this through VB?

  14. #14
    Lively Member ice & fire's Avatar
    Join Date
    Oct 2001
    Location
    Land of ice & fire
    Posts
    110
    dunno, on my pc it doesn´t work...

  15. #15
    Lively Member ice & fire's Avatar
    Join Date
    Oct 2001
    Location
    Land of ice & fire
    Posts
    110
    There are 2 dlls. only reference to the second one...

  16. #16

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2000
    Location
    Israel
    Posts
    636

    DOES ANYONE CAN POST A SIMPLE CODE?

    Guys, guys...

    I need a simple code that it will be used for getting more/less light in a picture... I need a fast function...

    Thank you,
    Arie.

  17. #17
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    Yes, that's a common problem with VB! That's why DirectDraw was invented, you know. It can do this fast as well, although it doesn't work with the traditional GDI interface (DCs).
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  18. #18
    Lively Member ice & fire's Avatar
    Join Date
    Oct 2001
    Location
    Land of ice & fire
    Posts
    110
    That´s only half true.
    I use DCs to put Pics in the DD Backbuffer, change the light and contrast and flip it to the primary surface. It DOES work with DCs Well, bit slow...

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