Skip to main content
gamedev.net
🔒 Locked

Negative image

Started by Rickard Mar 28, 2000 at 6:08 AM 5 replies 1k views
Original Post
Rickard
Rickard
Hi I wonder if there''s a way to negative an image on a DirectDrawsurface? Guess it can be done by blitting to a dc and then perform a bitblt with some flags, but I can imagine that''s not the fastest way... //Rickard
Rick_Dangerous
GEo
GEo
Can't you just NOT each individual colour value (RGB)?
You could write some fast ASM code to do this I can imagine.

Why do you want to, couldn't you just negative the image in PSP or whatever, and have two bitmaps. (I guess not, otherwise you wouldn't ask )

George.

"Who says computer games affect kids, imagine if PacMan affected us as kids, we'd all sit around in a darkened room munching pills and listening to repetitive music....uh oh!"


Edited by - GEo on 3/28/00 8:33:14 AM
George. F"Who says computer games affect kids, imagine if PacMan affected us as kids, we'd all sit around in a darkened room munching pills and listening to repetitive music....uh oh!"
Rickard
Rickard
Maybe if I knew ASM ;-)
Of course I could do it in PSP, I just thought it would be more flexible and less work to do it runtime.
The reason I want to do it is that I can achieve some cool effects.

//Rickard
Rick_Dangerous
NuFAN
NuFAN
Hi,
you can, if you''re using 32-bit, then you read the first 8 bits, negate them, and so on ... I guess there is no function to do this in DDraw in realtime, so I would precalculate it.

CU

Graphix Coding @
Skullpture Entertainment
http://www.skullpture.de
Graphix Coding @Skullpture Entertainmenthttp://www.skullpture.de
Harvester
Harvester
If you're using 8bit gfx, you just need to NOT the palette's contents. Otherwise a simple asm routine would do it for you, though C++ code for such a task is that simple that with the compiler's optimizations, you won't loose that much speed.

ps: i think i'd seen an asm routine that was negating an image in an example for ASM with VB at area51... That might give you a piece of code to work on.

c 'ya

Edited by - Harvester on 3/28/00 10:01:58 AM
... LEMMINGS ... LEMMINGS ... LEMMINGS ... LEM..... SpLaSh!...Could this be what we stand like before the mighty One?Are we LeMmIngS or WhAt!? ;)
Domini
Domini
I wouldn''t alter the palette if you wanted to use 8-bit. That would mess up all the other colors. I would have a table that has the index of the color entry with the opposite color.

For 16, 24, and 32 bit modes, I don''t think notting the bits will work, if you want the colors to go from black - white, yellow - blue, green - red (I think this is what it is), it won''t work.

11111111 00000000 00000000 - blue
00000000 11111111 11111111 - yellow (right)

00000000 11111111 00000000 - green
11111111 00000000 11111111 - purple (close but no)

00000000 00000000 11111111 - red
11111111 11111111 00000000 - blue/green (close but no)

There are 2 theories on color. I can remember the exactly what the names are, both are correct. You have the tri-color RGB theory, that we all uses. There is also a contrast theory, where colors mask each other (red/green,
blue/yellow, black/white). Try notting the bits. If you are satisfied, go for it.

Sorry for the wordiness.



Domini
KaneTHP
KaneTHP
If you just want an interesting effect to add to your toolbox (as opposed to specifically a negative image) you may want to consider XORing it against various colors patterns, etc. as well.. produces some pretty trippy effects...

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.