Sdl button query

Hi

Is there any way by which I can get the background color of a surface?

Also is there any way to get the color of text written on the surface?

pls send ur suggestions.thanx.

If you know exactly what is on the surface, then you can do these
things. Finding ‘the background color’ and color of text from a
photograph of a billboard, for example, would be difficult indeed.

If you know there’s nothing at a corner of the image and the image has
a flat color background, then you can just get a corner pixel and use
that color. If you know that the surface only contains text and that
the text has a single flat color, then you can scan through every
pixel in order until you find one that does not match the background
color. If there’s more to the surface than that, then you need either
a high knowledge of the contents, or a text-recognition algorithm,
which this mailing list likely cannot help with.

In most cases, however, you are the one who put that background color
and text there in the first place, so you already know these things.
Store them in variables and keep them related to the surface in your
code.

Jonny DOn Fri, May 22, 2009 at 3:07 AM, jyoti wrote:

Hi

Is there any way by which I can get the background color of a surface?

Also is there any way to get the color of text written on the surface?

pls send ur suggestions.thanx.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org