Blog

eXorithm – Execute Algorithm: View / Run Algorithm allocate_color

function allocate_color ($image$color$transparency
{
  if (preg_match'/[0-9ABCDEF]{6}/i'$color)==0) {
    throw new Exception"Invalid color code.");
  }
  if ($transparency<0 || $transparency>127) {
    throw new Exception"Invalid transparency.");
  }
  
  $r  = hexdecsubstr$color, 0, 2));
  $g  = hexdecsubstr$color, 2, 2));
  $b  = hexdecsubstr$color, 4, 2));
  if ($transparency>127) $transparency = 127;
  
  if ($transparency<=0)
    return imagecolorallocate$image$r$g$b);
  else
    return imagecolorallocatealpha$image$r$g$b$transparency);

eXorithm – Execute Algorithm: View / Run Algorithm unity

function unity ($passkey
{
  $ubn = array();
  
  while ($passkey > 9) {
    if (strlen$passkey) > 1)
      $passkey = array_sumstr_split$passkey));
    else
      $passkey = $passkey
  } 
  
  $ubn[] = $passkey
  
  return end$ubn);
} 

eXorithm – Execute Algorithm: View / Run Algorithm rounded_rectangle

function rounded_rectangle ($height$width$corner_radius$rectangle_color$background_color$background_transparent
{
  if (($corner_radius>($height/2)) || ($corner_radius>($width/2))) {
    throw new Exception'Corner radius may not exceed half the length of any of the sides.');
  }
  
  $image = image_create_alpha$width$height);
  
  if (!$background_transparent) {
    $background_color = allocate_color$image$background_color);
    imagefilledrectangle$image, 0, 0, $width$height$background_color);
  }
  
  $rectangle_color = allocate_color$image$rectangle_color);
  
  // draw 2 rectangles that overlap (making an image like the cross on the Swiss flag)
  imagefilledrectangle$image$corner_radius, 0, $width$corner_radius-1, $height$rectangle_color);
  imagefilledrectangle$image, 0, $corner_radius$width$height$corner_radius-1, $rectangle_color);
  
  // draw 4 circles for the corners
  imagefilledellipse$image$corner_radius$corner_radius$corner_radius*2, $corner_radius*2, $rectangle_color);
  imagefilledellipse$image$width$corner_radius-1, $corner_radius$corner_radius*2, $corner_radius*2, $rectangle_color);
  imagefilledellipse$image$corner_radius$height$corner_radius-1, $corner_radius*2, $corner_radius*2, $rectangle_color);
  imagefilledellipse$image$width$corner_radius-1, $height$corner_radius-1, $corner_radius*2, $corner_radius*2, $rectangle_color);
  
  return $image

eXorithm – Execute Algorithm: Embed Algorithm weather_forecast


Embed This Algorithm

This page will help you embed the algorithm weather_forecast on a page on your own website. Just configure the inputs, then click the generate button to get a snippet of code you can paste onto your site. You have two options.

  1. You can embed the entire form. Users will be able to enter their own arguments, and will need to press the run button to execute the algorithm.
  2. You can add only the output of the algorithm to your website. There will be no argument inputs or run button.

location Argument info
units Argument info
header color Argument info
day header color Argument info
day color Argument info
Embed the form Embed only the output

eXorithm – Execute Algorithm: Embed Algorithm draw_upc_barcode


Embed This Algorithm

This page will help you embed the algorithm draw_upc_barcode on a page on your own website. Just configure the inputs, then click the generate button to get a snippet of code you can paste onto your site. You have two options.

  1. You can embed the entire form. Users will be able to enter their own arguments, and will need to press the run button to execute the algorithm.
  2. You can add only the output of the algorithm to your website. There will be no argument inputs or run button.

number Argument info
show numbers Argument info
Embed the form Embed only the output