Re: your mail

Search this archive.

From: Alper Akçan (distch@hotmail.com)
Date: Sat 28 Dec 2002 - 22:46:15 IST


Hi all,

> > how can I use rgba colors in svgalib?
>
>What does it mean?
>
>--
>Matan Ziv-Av.                         matan@svgalib.org

I `do not know` much about rgba colors, but I as I read from web sites A 
stands for transparecny (alpha chanel I think ?!). But it defines the levels 
of trancparency (I think ;)).

R stands for red, G, green, B blue, as U already know. A is for 
transparency.

for example; 255,0,0 is pure red in rgb.
255, 0, 0, 0 is also pure red with no transparency in rgba.

but if A was 255 like;
255, 0, 0, 255 it would be transparent so red color would not seen.

A can get values of 0 <= A <= 255, trancparency of that pixel is defined 
with the value of A.

So;
When we want to draw a color with a trancparency level, we first must know 
the old color of the pixel, that we are drawing on to. second, the color 
that we want to draw, final (the most important) "a" trancparency level.

thist function takes the old color of the pixel, new colorof the pixel, and 
trans. level.

func (int c1, int c2, int a)
{
int ret;

// here we should get a color that is transparent according to the trans. 
level (a). so, return value is a function of three (old col, new col, trans. 
level). But how?

return ret.
}


this functions takes the coordinates of the pixel(x, y), the color that we 
want to draw (r, g, b), and the trancparencylevel (a).

simple_rgba_color_drawing_func (int x, int y, int r, int g, int b, int a)
{

int r_, g_, b_;
int final_color;

// Fist get the old color of pixel
gl_getpixelrgb (x, y, &r_, &g_, &b_);

// gets the final color
final_color = func (gl_rgbcolor(r_, g_, b_), gl_rgbcolor(r, g, b), a);

// draws the final color
gl_setpixel (x, y, final_color);
}


Again, I have no idea how a level of rgba colors is used, but I think the 
idea should be like this for a trans. level. I am asking that what would be 
the function for (old_col, new_col, trans_lev) to get a new color?

All I know is if A == 0 then that is not transparent, if A == 255 it is 
transparent like a glass (not seen).

Alper.

_________________________________________________________________
Add photos to your messages with MSN 8. Get 2 months FREE*. 
http://join.msn.com/?page=features/featuredemail&xAPID=42&PS=47575&PI=7324&DI=7474&SU= 
http://www.hotmail.msn.com/cgi-bin/getmsg&HL=1216hotmailtaglines_addphotos_3mf


------------------------------------------------------------------
Unsubscribe:  To:   listbot@svgalib.org
              Body: unsubscribe linux-svgalib


This archive was generated by hypermail 2.1.4 : Wed 21 Jan 2004 - 22:10:25 IST