Re: color gradients in windows?



Didn't catch if someone already replied, but might I suggest:
 
If you can plot points (new to GTK, don't ask me how), just get the RGB color values (or KKKKRRRRGGGGBBBB - which i think is the format gtk uses : k=black level, r=red level g=green level and b=blue level)..
 
Call "StartR" "StartG" "StartB" the starting color's red, green and blue components which you should be able to extract from the above format somehow.  Then have "EndR" "EndG" and "EndB" for the ending colors.  Then have a dynamic "CurrentR" "CurrentG" and "CurrentB" color, and an "IncrementR" "IncrementG" and "IncrementB".  Next, get the length (or height, depending on how you're doing it) of the area you're putting the gradient on (# of pixels, that is) and call it "size".  Assign "IncrementR"="(EndR-StartR)/size (or StartR-EndR depending on which is "bigger", in all cases), then "IncrementG"=(EndG-StartG)/size, then "IncrementB"=(EndB-StartB)/size.  Set CurrentR CurrentG and CurrentB initially to the appropriate Start values.  Let's say hypothetically you have a box that is 100 px x 100 px, and you're putting the gradient from top to bottom.  Draw the top line (0,0 to 100,0) with CurrentR CurrentB and CurrentG as the color.  Then increment each of those by the appropriate increment value.  Draw the next line, increment the color, next line, increment, .... you get the idea (I hope)...
 
-Rob
 
----- Original Message -----
From: Gary Scavone
Sent: Monday, May 21, 2001 11:19 AM
To: gtk-list gnome org
Subject: color gradients in windows?
 

I've looked through some of the documentation but I haven't been able
to figure out whether it is possible to have gtk windows with
background color gradients.  For example, I wrote a gtk program for
psychoacoustic tests that lets the user move items (buttons) around in
a gtk_layout widget.  We'd now like to define regions within the
gtk_layout widget by having different background colors.  Is that
currently possible?

-------------------------------------------------
Gary Scavone
Center for Computer Research in Music & Acoustics
Stanford University
gary ccrma stanford edu
http://www-ccrma.stanford.edu/~gary/
-------------------------------------------------


_______________________________________________
gtk-list mailing list
gtk-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-list


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]