Inverted Text
In my game, I want to create a console whose text is visible at all times. Using GDI functions, it''s possible to draw inverted shapes, but not text. I think the way to go is to copy the text somewhere else, and then copy it back using an inverted blit operation thing. But I have no idea how to do this..
Oh. I''m using GDI (GetDC() with Direct3D9), and MSVC++ 6.0. Using the BitBlt() function, I managed to get the text looking "different" from the background with SRCINVERT, but it still doesn''t look the way I''d like to. SRCINVERT uses XOR, but it comes closest to what I want to achieve; none of the other flags does what I want to: invert the destination when the source pixel is black. Do I have to write this manually?
I guess.. but I think my text looks odd, it doesn't show up very clearly half the time. I'm rendering inverted text on a very colorful background (think lime and hot pink), but most of the time it just turns gray. I want it to be inverted, like from blue to yellow.
EDIT: Nevermind, I think XOR works fine. The contrast on my monitor was too low to see clearly.
Just to check, to invert say blue (0x0000ff), I would XOR it with white (0xffffff) to get yellow (0xffff00), right?
[edited by - Psybr on July 7, 2003 10:07:36 AM]
EDIT: Nevermind, I think XOR works fine. The contrast on my monitor was too low to see clearly.
Just to check, to invert say blue (0x0000ff), I would XOR it with white (0xffffff) to get yellow (0xffff00), right?
[edited by - Psybr on July 7, 2003 10:07:36 AM]
Yes, XOR with white will invert the color.
[edit] Incidentally, XOR with white will (AFAICT) always produce the color with greatest possible contrast to the original color. This is a very handy side effect, and the reason why many users like inverted mouse cursors, especially on laptops.
[edited by - ApochPiQ on July 7, 2003 11:36:09 AM]
[edit] Incidentally, XOR with white will (AFAICT) always produce the color with greatest possible contrast to the original color. This is a very handy side effect, and the reason why many users like inverted mouse cursors, especially on laptops.
[edited by - ApochPiQ on July 7, 2003 11:36:09 AM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement