Page 1 of 1

What color is that text?

Posted: Tue Aug 03, 2004 12:23 am
by Menotu
Is there a way to tell what color a certain letter is. For example, if I printed a sentence like "Hello World!" (for lack of imagintaion) with "Hel" being one color, "lo Wo" another, and "rld!" a third color, would I be able to figure out which string was, let's say, red?

Yes...

Posted: Tue Aug 03, 2004 9:57 am
by Levi
actually I believe you good. Using the screen function you can get the characters from any position on the screen using rows and columns of course. Now knowing what screen you are using, 12 13 ect. you can know how big in pixles the character boxes are. Then knowing the position in rows and columns of text you want to look at you can caluclate the pixels of the letters. From there there is a function of sometype that gets a single pixel color. I haven't used it in a long time so I don't know the name. but that is the general idea that I came up with to do it. Good luck.

Re: Yes...

Posted: Tue Aug 03, 2004 10:04 am
by Nodtveidt
Levi wrote:From there there is a function of sometype that gets a single pixel color. I haven't used it in a long time so I don't know the name.
There are two ways of doing this:

BIOS method (POINT routine) [slow]
Direct video memory method (PEEK routine, with DEF SEG to &HA000) [faster]

Posted: Tue Aug 03, 2004 6:37 pm
by Pete
Even if you know the (x,y) position of the ASCII character, you're gonna have to check several different points before you actually hit one that is colored rather than the black background. In the characters that show up on screen, there's generally more empty space than actual "character." It's pretty hit and miss...kinda like playing Battleship or something.

The best way is probably to start in the upper left and just check through each point, one by one. (Or maybe start at the bottom left corner, since a ton of characters--commas, lowercase letters, periods, etc.--are mostly in the lower region of the ASCII character's "sprite".


It seems to me like there's an easier way to do this...the color data for every letter has to be stored in the memory somewhere...though I can't think of an alternate method.