text on color
Richard Stott -- rstott@redshift.com
Friday, July 26, 1996
Environment: VC++ 4.1, Win95
I'm trying to draw some text on a colored background. To create the
background I'm creating a CBrush using the RGB macro and using FillRect().
For the text, I'm using a stock black brush, setting the background to
TRANSPARENT and drawing with TextOut().
The following RGB colors work fine:
( 0, 255, 128 ) //green
( 255, 255, 0 ) //yellow
but the following blot out parts of the text:
( 128, 128, 255 ) //purple
( 255, 255, 128 ) //orange
I've tried using SetBkColor() with opaque and transparent settings and
tried SetROP2( R2_BLACK ) with no success.
It seems to me that black pen should write black regardless of what it is
writing on, but this is apparently no the case. Can anyone enlighten me on
this and/or suggest a solution?
Thanks very much,
Dick Stott
Jim Tannenbaum -- jimt1@voicenet.com
Wednesday, July 31, 1996
[Mini-digest: 3 responses]
snip
>
>The following RGB colors work fine:
> ( 0, 255, 128 ) //green
> ( 255, 255, 0 ) //yellow
>
>but the following blot out parts of the text:
> ( 128, 128, 255 ) //purple
> ( 255, 255, 128 ) //orange
>
Dick,
The problem is not your black pen. It is the colors you have
selected for the background. Depending on the number of color bits your
video card is set up for, your video card will dither the selected
"non-standard" color with some rather ugly results. Try better than SVGA
color resolution (> 256 colors) or pick the standard 16 for background colors.
JJM Systems, Inc Phone: (215) 672-3660
1 Ivybrook Blvd, Suite 190 Fax: (215) 672-5702
Ivyland, PA 19874 Net: jimt1@voicenet.com
-----From: Jeff Thompson
Have you used the Zoom Utility to view this text enlarged? I would just
about bet
that these two colors are dithered and that the black pen is dropping
out for
one of the two dithered portions of the brush.
--
+----------+------------------------------------------------------------
| Jeff | If a philosopher falls out a tree in a forest, and there's
| Thompson | no one there to hear him, does he make any sound ?
+----------+------------------------------------------------------------
-----From: "Alistair Israel"
[...snip...]
>The following RGB colors work fine:
> ( 0, 255, 128 ) //green
> ( 255, 255, 0 ) //yellow
>
>but the following blot out parts of the text:
> ( 128, 128, 255 ) //purple
> ( 255, 255, 128 ) //orange
>
[...snip...]
>It seems to me that black pen should write black regardless of what it is
>writing on, but this is apparently no the case. Can anyone enlighten me on
>this and/or suggest a solution?
Maybe it's because you're running in 16 or 256 color mode, and Windows dithers
the above colors (purple & orange), so the text just "appears" blotted out?
If you really need to work with colors like those that are not in the system
palette, you'll probably have to define then realize your own palette which
includes those particular colors. You may have to use an off-screen bitmap to
hold the temporary results first.
Look around, examples abound.
"Walk the earth, Surf the Net"
- Alistair Israel (aisrael@hotmail.com)
Developer Dude
Pilipino Data Network, Inc.
http://202.47.133.168 [0800-2000 GMT+0800 only]
---------------------------------------------------------
Get Your *Web-Based* Free Email at http://www.hotmail.com
---------------------------------------------------------
| Вернуться в корень Архива
|