Social Networks




Follow sproutworks on Twitter
Enter your Email


Powered by FeedBlitz

RSS Feed

Links

Blogshares Links

The BlogShares fantasy blog stock market.

BlogShares Price Tracker
I wrote this program to archive information from the BlogShares fantasy stock market. You can view graphs of any industry, and analyze your portfolio.

SproutWorks Projects

Digg Archive
A new experimental Digg page.
AJAX Pixel Editor
A Collaborative pixel editor currently in development.
Web promotion links
These tools help you get visitors on your website.
SproutPics
My photography Site
SproutSearch
I designed this blog indexing tool, and it has accumulated over 6 million blogs so far.
Products
Some of the programs I've written.
SproutTree Demo
A demo of a tree-drawing PHP script.
My Gallery

Sign In

Username:
Password:
Remember Me

sprout man
modules
./
pathfile sizelines
color.php139961
gradient2.php5591230
6,990 bytes total
<?

class Color {

    var 
$red;
    var 
$green;
    var 
$blue;

    function 
Color($red$green$blue) {
        
$this->red $red;
        
$this->green $green;
        
$this->blue $blue;
    }
    
    function 
add($color) {
            return new 
Color($color->red $this->red$color->green $this->green$color->blue $this->blue);
    }

    function 
blend($color1$color2) {
        return new 
Color(($color1->red $color2->red)/2, ($color1->green $color2->green)/2, ($color1->blue $color2->blue)/2);
    }
    
    function 
changeBrightness($percent) {
        
$this->red *= $percent;
        
$this->green *= $percent;
        
$this->blue *= $percent;
    
        if (
$this->red 255$this->red 255;
        if (
$this->green 255$this->green 255;
        if (
$this->blue 255$this->blue 255;
    }
    
    function 
difference($color) {
        
$rDiff $this->red $color->red;
        
$gDiff $this->green $color->green;    
        
$bDiff $this->blue $color->blue;
        
        return new 
Color($rDiff$gDiff$bDiff);
    }
    
    function 
getAlphaColor($level) {
        
$red $level $this->red;
        
$green $level $this->green;
        
$blue $level $this->blue;
    
        if (
$red 255$red 255;
        if (
$green 255$green 255;
        if (
$blue 255$blue 255;
        if (
$red 0$red 0;
        if (
$green 0$green 0;
        if (
$blue 0$blue 0;
        
        return array(
$red$green$blue);
    }
    
    function 
allocate($image) {
        return 
imagecolorallocate($image$this->red$this->green$this->blue);
    }
}

?>