File/includes/gradient.php

Description
Includes
 include_once ('includes/formvars.php') (line 57)

Generate a gradient image for use as a background image.

Requires gd module.

Input Parameters: height Height of output image (ignored for horizontal gradient) width Width of output image (ignored for vertical gradient) colors Number of colors to generate direction Direction gradient should go Currently limited to multiples of 90 degrees

  1. means left-to-right, 90 means bottom-to-top,
  2. 80 means right-to-left, 270 means top-to-bottom
Notes: One of the following two pairs of input parameters should be used to specify the colors for the gradient:
  1. color1, color2 - End colors of gradient specified as "color1=RRGGBB" or "color1=RGB"
  2. base, percent - `base' is specified the same way as `color1' and `color2' `percent' is the amount the components of `base' should be increased
For example, given "base=445566&percent=50", the starting and ending colors of the gradient will be: Start: Red: 44 (hex) | 68 (dec) Green: 55 (hex) | 85 (dec) Blue: 66 (hex) | 102 (dec) End: Red: 44 + (50% of FF) = CC (hex) | 68 + (50% of 255) = 196 (dec) Green: 55 + (50% of FF) = DD (hex) | 85 + (50% of 255) = 203 (dec) Blue: 66 + (50% of FF) = EE (hex) | 102 + (50% of 255) = 230 (dec)

So it is entirely equivalent to say "base=445566&percent=50" OR "color1=445566&color2=CCDDEE"

Since this file does not use any other WebCalendar file, it could be used by other PHP apps.

TODO: Allow directions which are not multiples of 90 degrees so that we can have diagonal gradients.

Security: No security restrictions by user. Limit height and width parameters to 600 so a malicious user cannot request a 10Gb image 8-)

 include_once ('formvars.php') (line 60)
Functions
background_css (line 149)
void background_css ( $base, [ $height = ''], [ $percent = ''])
  • $base
  • $height
  • $percent
can_write_to_dir (line 134)
void can_write_to_dir ( $path)
  • $path
colorToRGB (line 113)
void colorToRGB ( $color)
  • $color
create_image (line 182)
void create_image ( $file_name, [ $base = ''], [ $height = ''], [ $percent = ''], [ $width = ''], [ $direction = ''], [ $numcolors = ''], [ $color1 = ''], [ $color2 = ''])
  • $file_name
  • $base
  • $height
  • $percent
  • $width
  • $direction
  • $numcolors
  • $color1
  • $color2
hsl2rgb (line 394)
void hsl2rgb ( $hsl)
  • $hsl
Hue_2_RGB (line 424)
void Hue_2_RGB ( $v1,  $v2,  $vH)
  • $v1
  • $v2
  • $vH
rgb2hsl (line 352)
void rgb2hsl ( $rgb)
  • $rgb
rgb_luminance (line 438)

Given an RGB value, return it's luminance adjusted by scale

scale range = 0 to 9

void rgb_luminance ($rgb $rgb, [$scale $scale = 5])
  • $rgb $rgb
  • $scale $scale

Documentation generated on Thu, 10 Jun 2010 17:08:28 -0400 by phpDocumentor 1.4.3