Results 1 to 8 of 8

Thread: RGB pallet manipulation - blackout and light-up effects

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 2001
    Posts
    80

    RGB pallet manipulation - blackout and light-up effects

    I'm working with Turbo C++ in 13h mode (256 colors) and what I want to do is make a function(s) that would either light-up the entire screen (just like turning up the brightness for all colors) or blackout (all colors going to black). So what I want to know is what's a good algorithm for both? I've written a few functions, for example for the light-up function I would just take the current RGB value for a color and increment all three colors by 1, but that tends to mess up the actual picture (like if one of the colors is at the max already then the other two would increase by them selves changing the actual color and not only the brightness). Any good ideas?

  2. #2
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    You have to move them relative and not absolule. If the original color is 0 / 128 / 255 you have to increase the colors by 1.0 / 0.5 / 0.0 understand the system? So the movement is ( 1 - (Original / 255) ) for each, R, G and B.

  3. #3
    Hyperactive Member csar's Avatar
    Join Date
    Mar 2002
    Location
    Siam
    Posts
    288

    if we use PictureBox

    In that case, if I have picturebox control and I want to do that on the picture. So, how could I use BitBlt or anything else to succeed?
    Don't leave it till tomorrow, Do It Now!
    5361726176757468204368616E63686F747361746869656E

  4. #4
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    BitBlt won't help you on this.. You'll have to go thru each pixel and modulate the color..

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Oct 2001
    Posts
    80
    Go it all working great. Thanks.

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Oct 2001
    Posts
    80
    Hehe very well, this is a bit unfinished but you get the point (didn’t finish the ending sequence). Just a program that I'm making for my final project in my C++ class, no real point though. To quit press Esc and you will see why I wanted these 2 effects. Also, there are 2 versions that I've compiled, for some unknown reason (at least to me) the text memory offset (I'm using direct text output - writing to memory) needs to be changed on some computers. For most computers RACE1.EXE should work fine, but if you see that the text is in the wrong position when you start the program, then try RACE2. Maybe you know why this is? I'm using pokeb() function and address B800 : offset to output the text to the screen yet on my computer the offset for the first character on the screen is 32 instead of 0 as it is on most computers I’ve tried this on.

    Well any way, here are the programs:
    http://www.tnstop.com/RACE1.EXE
    http://www.tnstop.com/RACE2.EXE

    I can give you the source if you'd like, but I hate commenting, so it might kinda hard to understand.

    Oh and also if you use + and - keys (-/=) you can adjust the speed - I was bored
    Last edited by MXK; Jun 3rd, 2002 at 02:47 PM.

  7. #7
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    I had to use the RACE2 one. If it helps, I'm running a Celeron/Win2000/GF2MX.
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  8. #8

    Thread Starter
    Lively Member
    Join Date
    Oct 2001
    Posts
    80
    Hm...so far what I'm noticing is that any system running Win2k or XP (what I use) has to use the second one, while systems on Win 98 (at my school) use the first one. Strange...

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