예제 #1
0
파일: lpf.php 프로젝트: noccy80/lepton-ng
 static function cast($val, $type)
 {
     list($type, $constrain) = explode(':', $type);
     switch ($type) {
         case 'INT':
             $v = intval($val);
             list($min, $max) = explode(',', $constrain);
             $v = $v < $min ? $min : ($v > $max ? $max : $v);
             break;
         case 'FLOAT':
             $v = floatval($val);
             list($min, $max) = explode(',', $constrain);
             $v = $v < $min ? $min : ($v > $max ? $max : $v);
             break;
         case 'BOOL':
             if (is_string($val) && $val == 'true') {
                 $v = true;
             } else {
                 $v = $val ? true : false;
             }
             break;
         case 'COLOR':
             if (!$val) {
                 $val = '#000000';
             }
             $v = rgb($val);
             break;
         case 'STRING':
             $v = (string) $val;
             break;
     }
     return $v;
 }
예제 #2
0
파일: text.php 프로젝트: noccy80/lepton-ng
 function render(SceneState $ss, ActorState $as, Canvas $c)
 {
     $font = new TrueTypeFont($this->font, $this->size);
     $p = $c->getPainter();
     $p->drawFilledRect(0, 0, $c->width, $c->height, rgb($this->background), rgb($this->background));
     $c->drawText($font, rgb($this->color), 0, 0, $this->text);
 }
예제 #3
0
파일: hue.php 프로젝트: noccy80/lepton-ng
 function applyFilter(Canvas $canvas)
 {
     $himage = $canvas->getImage();
     // If not we need to do some enumeration
     $total = imagecolorstotal($himage);
     if ($total > 0) {
         // This works for indexed images but not for truecolor
         for ($i = 0; $i < $total; $i++) {
             $index = imagecolorsforindex($himage, $i);
             $rgb = rgb($index['red'], $index['green'], $index['blue']);
             $hsv = hsv($rgb);
             $hsv->hue = $this->hue;
             $rgb = rgb($hsv);
             $red = $rgb->red;
             $green = $rgb->green;
             $blue = $rgb->blue;
             imagecolorset($himage, $i, $red, $green, $blue);
         }
     } else {
         // For truecolor we need to enum it all
         for ($x = 0; $x < imagesx($himage); $x++) {
             for ($y = 0; $y < imagesy($himage); $y++) {
                 $index = imagecolorat($himage, $x, $y);
                 $rgb = rgb($index['red'], $index['green'], $index['blue'], $index['alpha']);
                 $hsv = hsv($rgb);
                 $hsv->hue = $this->hue;
                 $rgb = rgb($hsv);
                 $red = $rgb->red;
                 $green = $rgb->green;
                 $blue = $rgb->blue;
                 imagesetpixel($himage, $x, $y, $red << 16 | $green < 8 | $blue);
             }
         }
     }
 }
예제 #4
0
 function draw(Canvas $dest, $x = null, $y = null, $width = null, $height = null)
 {
     $c = new Canvas($width, $height, rgb($this->props['background']));
     $p = $c->getPainter();
     $p->drawRect(0, 0, $width - 1, $height - 1, rgb($this->props['bordercolor']));
     $labels = $this->dataset->getLabels();
     $labelcount = count($labels);
     // $ls = floor($height / $labelcount) - 4;
     $ls = 16;
     for ($i = 0; $i < $labelcount; $i++) {
         $x1 = 3;
         $y1 = 3 + ($ls + 2) * $i;
         $x2 = $x1 + $ls;
         $y2 = $y1 + $ls;
         $p->drawFilledRect($x1, $y1, $x2, $y2, rgb(80, 80, 80), rgb(rand(0, 200), rand(0, 200), rand(0, 200)));
     }
     imagecopy($dest->getImage(), $c->getImage(), $x, $y, 0, 0, $width, $height);
 }
예제 #5
0
require_once 'color_range.php';
function usage()
{
    fwrite(STDERR, "Usage: color_range.test1.php color1 color2 number_of_colors\nEach color is of the form rrggbb with 2 digit hex color components.\n");
    exit(1);
}
# Split color "rrggbb" into separate components. Code is from PHPlot.
function rgb($color)
{
    return array(hexdec(substr($color, 1, 2)), hexdec(substr($color, 3, 2)), hexdec(substr($color, 5, 2)));
}
if ($_SERVER['argc'] != 4) {
    usage();
}
$color1 = rgb($_SERVER['argv'][1]);
$color2 = rgb($_SERVER['argv'][2]);
$n_col = (int) $_SERVER['argv'][3];
if ($n_col < 2) {
    usage();
}
# Build a color map from colors[0]=color1 to colors[$n_col-1]=color2.
$colors = color_range($color1, $color2, $n_col);
# Make a picture:
$w = 800;
$h = 800;
$im = imagecreate($w, $h);
$background = imagecolorresolve($im, 0, 0, 0);
for ($col = 0; $col < $n_col; $col++) {
    list($r, $g, $b) = $colors[$col];
    $colmap[$col] = imagecolorresolve($im, $r, $g, $b);
}
예제 #6
0
<?php 
$blue = array(0xef, 0xef, 0xff);
$text = array(0, 0, 0);
function rgb($arr)
{
    return $arr[0] . "," . $arr[1] . "," . $arr[2];
}
$step = 15;
for ($i = 0; $i < 255; $i += $step) {
    $blue[0] -= $step;
    $blue[1] -= $step;
    foreach ($text as &$t) {
        $t += $step;
    }
    ?>

	<div style="background-color: rgb(<?php 
    echo rgb($blue);
    ?>
); color: rgb(<?php 
    echo rgb($text);
    ?>
);">
		Shades of blue
	</div>

<?php 
}
?>
</body>
</html>
예제 #7
0
$rgba;
$names = array('f0f8ff' => 'aliceblue', 'faebd7' => 'antiquewhite', '00ffff' => 'aqua', '7fffd4' => 'aquamarine', 'f0ffff' => 'azure', 'f5f5dc' => 'beige', 'ffe4c4' => 'bisque', '000000' => 'black', 'ffebcd' => 'blanchedalmond', '0000ff' => 'blue', '8a2be2' => 'blueviolet', 'a52a2a' => 'brown', 'deb887' => 'burlywood', 'ea7e5d' => 'burntsienna', '5f9ea0' => 'cadetblue', '7fff00' => 'chartreuse', 'd2691e' => 'chocolate', 'ff7f50' => 'coral', '6495ed' => 'cornflowerblue', 'fff8dc' => 'cornsilk', 'dc143c' => 'crimson', '00ffff' => 'cyan', '00008b' => 'darkblue', '008b8b' => 'darkcyan', 'b8860b' => 'darkgoldenrod', 'a9a9a9' => 'darkgray', '006400' => 'darkgreen', 'a9a9a9' => 'darkgrey', 'bdb76b' => 'darkkhaki', '8b008b' => 'darkmagenta', '556b2f' => 'darkolivegreen', 'ff8c00' => 'darkorange', '9932cc' => 'darkorchid', '8b0000' => 'darkred', 'e9967a' => 'darksalmon', '8fbc8f' => 'darkseagreen', '483d8b' => 'darkslateblue', '2f4f4f' => 'darkslategray', '2f4f4f' => 'darkslategrey', '00ced1' => 'darkturquoise', '9400d3' => 'darkviolet', 'ff1493' => 'deeppink', '00bfff' => 'deepskyblue', '696969' => 'dimgray', '696969' => 'dimgrey', '1e90ff' => 'dodgerblue', 'b22222' => 'firebrick', 'fffaf0' => 'floralwhite', '228b22' => 'forestgreen', 'ff00ff' => 'fuchsia', 'dcdcdc' => 'gainsboro', 'f8f8ff' => 'ghostwhite', 'ffd700' => 'gold', 'daa520' => 'goldenrod', '808080' => 'gray', '008000' => 'green', 'adff2f' => 'greenyellow', '808080' => 'grey', 'f0fff0' => 'honeydew', 'ff69b4' => 'hotpink', 'cd5c5c' => 'indianred', '4b0082' => 'indigo', 'fffff0' => 'ivory', 'f0e68c' => 'khaki', 'e6e6fa' => 'lavender', 'fff0f5' => 'lavenderblush', '7cfc00' => 'lawngreen', 'fffacd' => 'lemonchiffon', 'add8e6' => 'lightblue', 'f08080' => 'lightcoral', 'e0ffff' => 'lightcyan', 'fafad2' => 'lightgoldenrodyellow', 'd3d3d3' => 'lightgray', '90ee90' => 'lightgreen', 'd3d3d3' => 'lightgrey', 'ffb6c1' => 'lightpink', 'ffa07a' => 'lightsalmon', '20b2aa' => 'lightseagreen', '87cefa' => 'lightskyblue', '778899' => 'lightslategray', '778899' => 'lightslategrey', 'b0c4de' => 'lightsteelblue', 'ffffe0' => 'lightyellow', '00ff00' => 'lime', '32cd32' => 'limegreen', 'faf0e6' => 'linen', 'ff00ff' => 'magenta', '800000' => 'maroon', '66cdaa' => 'mediumaquamarine', '0000cd' => 'mediumblue', 'ba55d3' => 'mediumorchid', '9370db' => 'mediumpurple', '3cb371' => 'mediumseagreen', '7b68ee' => 'mediumslateblue', '00fa9a' => 'mediumspringgreen', '48d1cc' => 'mediumturquoise', 'c71585' => 'mediumvioletred', '191970' => 'midnightblue', 'f5fffa' => 'mintcream', 'ffe4e1' => 'mistyrose', 'ffe4b5' => 'moccasin', 'ffdead' => 'navajowhite', '000080' => 'navy', 'fdf5e6' => 'oldlace', '808000' => 'olive', '6b8e23' => 'olivedrab', 'ffa500' => 'orange', 'ff4500' => 'orangered', 'da70d6' => 'orchid', 'eee8aa' => 'palegoldenrod', '98fb98' => 'palegreen', 'afeeee' => 'paleturquoise', 'db7093' => 'palevioletred', 'ffefd5' => 'papayawhip', 'ffdab9' => 'peachpuff', 'cd853f' => 'peru', 'ffc0cb' => 'pink', 'dda0dd' => 'plum', 'b0e0e6' => 'powderblue', '800080' => 'purple', 'ff0000' => 'red', 'bc8f8f' => 'rosybrown', '4169e1' => 'royalblue', '8b4513' => 'saddlebrown', 'fa8072' => 'salmon', 'f4a460' => 'sandybrown', '2e8b57' => 'seagreen', 'fff5ee' => 'seashell', 'a0522d' => 'sienna', 'c0c0c0' => 'silver', '87ceeb' => 'skyblue', '6a5acd' => 'slateblue', '708090' => 'slategray', '708090' => 'slategrey', 'fffafa' => 'snow', '00ff7f' => 'springgreen', '4682b4' => 'steelblue', 'd2b48c' => 'tan', '008080' => 'teal', 'd8bfd8' => 'thistle', 'ff6347' => 'tomato', '40e0d0' => 'turquoise', 'ee82ee' => 'violet', 'f5deb3' => 'wheat', 'ffffff' => 'white', 'f5f5f5' => 'whitesmoke', 'ffff00' => 'yellow', '9acd32' => 'yellowgreen');
switch ($mode) {
    case 'hex':
        preg_match('/[0-9A-Fa-f]*/', $q, $match);
        $rgba = hex($match[0]);
        break;
    case 'hsl':
        $input = preg_replace('/[^0-9.,-]/', '', $q);
        $input = explode(',', $input);
        $rgba = hsl(array_key_exists(0, $input) ? $input[0] : null, array_key_exists(1, $input) ? $input[1] : null, array_key_exists(2, $input) ? $input[2] : null, array_key_exists(3, $input) ? $input[3] : null);
        break;
    case 'rgb':
        $input = preg_replace('/[^0-9%.,-]/', '', $q);
        $input = explode(',', $input);
        $rgba = rgb(array_key_exists(0, $input) ? $input[0] : null, array_key_exists(1, $input) ? $input[1] : null, array_key_exists(2, $input) ? $input[2] : null, array_key_exists(3, $input) ? $input[3] : null);
        break;
    case 'name':
        $input = preg_replace('/[^a-zA-Z]/', '', $q);
        if ($input) {
            $rgba = name($input);
        } else {
            noresult($mode);
            echo $w->toxml();
            return;
        }
        break;
    case 'alpha':
        $alpha = explode('|', $q);
        if ($alpha[0] == 'pick') {
            // if called on Choose Color result
예제 #8
0
 function getColorAt($x, $y)
 {
     $rgb = imagecolorat($this->himage, $x, $y);
     $cv = imagecolorsforindex($this->himage, $rgb);
     return rgb($cv['red'], $cv['green'], $cv['blue']);
 }
예제 #9
0
     $t->setHeight($tHeight);
     $tText = $objs[$coid]->title;
     $t->addString($tText);
     $m->setDimension($dx, $dy);
     // Add the text to the movie and position it
     $i = $m->add($t);
     $i->moveTo((int) ($dx / 2) - $t->getWidth($tText) / 2, $dy - round($t->getDescent()) - ($dy - $tHeight) / 2);
     // Don't forget to add the button
     $m->add($b);
     break;
 case 'blurb':
     $m->setBackground(0xff, 0xff, 0xff);
     $m->setDimension($dx, $dy);
     $t = new SWFTextField();
     if (!empty($objs[$coid]->title)) {
         $rgb = rgb($objs[$coid]->titleColor);
         $t->setColor($rgb[0], $rgb[1], $rgb[2]);
         $t = new SWFText();
         $f = new SWFFont($objs[$coid]->font);
         $t->setFont($f);
         $t->setHeight(flash_fixsize($objs[$coid]->titleSize));
         $t->addString($objs[$coid]->title);
         $i = $m->add($t);
         if ($in == 0) {
             $i->moveTo(5, 0);
         }
     }
     foreach ($el['text'] as $in => $val) {
         if (!empty($el['text'][$in]['data'])) {
             $t = new SWFTextField();
             $t->setColor($defaultColor[0], $defaultColor[1], $defaultColor[2]);
예제 #10
0
$rgba;
$names = array('f0f8ff' => 'aliceblue', 'faebd7' => 'antiquewhite', '00ffff' => 'aqua', '7fffd4' => 'aquamarine', 'f0ffff' => 'azure', 'f5f5dc' => 'beige', 'ffe4c4' => 'bisque', '000000' => 'black', 'ffebcd' => 'blanchedalmond', '0000ff' => 'blue', '8a2be2' => 'blueviolet', 'a52a2a' => 'brown', 'deb887' => 'burlywood', 'ea7e5d' => 'burntsienna', '5f9ea0' => 'cadetblue', '7fff00' => 'chartreuse', 'd2691e' => 'chocolate', 'ff7f50' => 'coral', '6495ed' => 'cornflowerblue', 'fff8dc' => 'cornsilk', 'dc143c' => 'crimson', '00ffff' => 'cyan', '00008b' => 'darkblue', '008b8b' => 'darkcyan', 'b8860b' => 'darkgoldenrod', 'a9a9a9' => 'darkgray', '006400' => 'darkgreen', 'a9a9a9' => 'darkgrey', 'bdb76b' => 'darkkhaki', '8b008b' => 'darkmagenta', '556b2f' => 'darkolivegreen', 'ff8c00' => 'darkorange', '9932cc' => 'darkorchid', '8b0000' => 'darkred', 'e9967a' => 'darksalmon', '8fbc8f' => 'darkseagreen', '483d8b' => 'darkslateblue', '2f4f4f' => 'darkslategray', '2f4f4f' => 'darkslategrey', '00ced1' => 'darkturquoise', '9400d3' => 'darkviolet', 'ff1493' => 'deeppink', '00bfff' => 'deepskyblue', '696969' => 'dimgray', '696969' => 'dimgrey', '1e90ff' => 'dodgerblue', 'b22222' => 'firebrick', 'fffaf0' => 'floralwhite', '228b22' => 'forestgreen', 'ff00ff' => 'fuchsia', 'dcdcdc' => 'gainsboro', 'f8f8ff' => 'ghostwhite', 'ffd700' => 'gold', 'daa520' => 'goldenrod', '808080' => 'gray', '008000' => 'green', 'adff2f' => 'greenyellow', '808080' => 'grey', 'f0fff0' => 'honeydew', 'ff69b4' => 'hotpink', 'cd5c5c' => 'indianred', '4b0082' => 'indigo', 'fffff0' => 'ivory', 'f0e68c' => 'khaki', 'e6e6fa' => 'lavender', 'fff0f5' => 'lavenderblush', '7cfc00' => 'lawngreen', 'fffacd' => 'lemonchiffon', 'add8e6' => 'lightblue', 'f08080' => 'lightcoral', 'e0ffff' => 'lightcyan', 'fafad2' => 'lightgoldenrodyellow', 'd3d3d3' => 'lightgray', '90ee90' => 'lightgreen', 'd3d3d3' => 'lightgrey', 'ffb6c1' => 'lightpink', 'ffa07a' => 'lightsalmon', '20b2aa' => 'lightseagreen', '87cefa' => 'lightskyblue', '778899' => 'lightslategray', '778899' => 'lightslategrey', 'b0c4de' => 'lightsteelblue', 'ffffe0' => 'lightyellow', '00ff00' => 'lime', '32cd32' => 'limegreen', 'faf0e6' => 'linen', 'ff00ff' => 'magenta', '800000' => 'maroon', '66cdaa' => 'mediumaquamarine', '0000cd' => 'mediumblue', 'ba55d3' => 'mediumorchid', '9370db' => 'mediumpurple', '3cb371' => 'mediumseagreen', '7b68ee' => 'mediumslateblue', '00fa9a' => 'mediumspringgreen', '48d1cc' => 'mediumturquoise', 'c71585' => 'mediumvioletred', '191970' => 'midnightblue', 'f5fffa' => 'mintcream', 'ffe4e1' => 'mistyrose', 'ffe4b5' => 'moccasin', 'ffdead' => 'navajowhite', '000080' => 'navy', 'fdf5e6' => 'oldlace', '808000' => 'olive', '6b8e23' => 'olivedrab', 'ffa500' => 'orange', 'ff4500' => 'orangered', 'da70d6' => 'orchid', 'eee8aa' => 'palegoldenrod', '98fb98' => 'palegreen', 'afeeee' => 'paleturquoise', 'db7093' => 'palevioletred', 'ffefd5' => 'papayawhip', 'ffdab9' => 'peachpuff', 'cd853f' => 'peru', 'ffc0cb' => 'pink', 'dda0dd' => 'plum', 'b0e0e6' => 'powderblue', '800080' => 'purple', 'ff0000' => 'red', 'bc8f8f' => 'rosybrown', '4169e1' => 'royalblue', '8b4513' => 'saddlebrown', 'fa8072' => 'salmon', 'f4a460' => 'sandybrown', '2e8b57' => 'seagreen', 'fff5ee' => 'seashell', 'a0522d' => 'sienna', 'c0c0c0' => 'silver', '87ceeb' => 'skyblue', '6a5acd' => 'slateblue', '708090' => 'slategray', '708090' => 'slategrey', 'fffafa' => 'snow', '00ff7f' => 'springgreen', '4682b4' => 'steelblue', 'd2b48c' => 'tan', '008080' => 'teal', 'd8bfd8' => 'thistle', 'ff6347' => 'tomato', '40e0d0' => 'turquoise', 'ee82ee' => 'violet', 'f5deb3' => 'wheat', 'ffffff' => 'white', 'f5f5f5' => 'whitesmoke', 'ffff00' => 'yellow', '9acd32' => 'yellowgreen');
switch ($mode) {
    case 'hex':
        preg_match('/[0-9A-Fa-f]*/', $q, $match);
        $rgba = hex($match[0]);
        break;
    case 'hsl':
        $input = preg_replace('/[^0-9.,-]/', '', $q);
        $input = explode(',', $input);
        $rgba = hsl($input[0], $input[1], $input[2], $input[3]);
        break;
    case 'rgb':
        $input = preg_replace('/[^0-9%.,-]/', '', $q);
        $input = explode(',', $input);
        $rgba = rgb($input[0], $input[1], $input[2], $input[3]);
        break;
    case 'name':
        $input = preg_replace('/[^a-zA-Z]/', '', $q);
        if ($input) {
            $rgba = name($input);
        } else {
            $w->result('tylereich.colors picker', 'color-pick', 'Color Picker', 'Action this item to reveal the OS X color picker', 'icon.png', 'yes');
            echo $w->toxml();
            return;
        }
        break;
    case 'pick':
        $pick = explode('|', $q);
        if ($pick[0] == 'pick') {
            $rgba = explode(',', `osascript -e 'tell application "Finder"' -e 'activate' -e 'choose color' -e 'end tell'`);
예제 #11
0
 /**
  * @description Canvas filtering
  */
 function canvasfilter()
 {
     $f = new Canvas(100, 100, rgb(0, 255, 0));
     $f->apply(new PixelateImageFilter(5));
     // $this->assertEquals($f->getColorAt(0,0),rgb(0,0,255));
 }
예제 #12
0
 $query = "SELECT * FROM " . $cg->dbprefix . "k2_categories WHERE alias='" . $folder . "'";
 //   var_dump($query);
 $category = mysqli_fetch_assoc(mysqli_query($con, $query));
 $id = $category["id"];
 $name = $category["name"];
 var_dump($id);
 $date = date("Y-m-d H:i");
 $createTagQuery = createTag($prefix, $folder);
 var_dump(mysqli_query($con, $createTagQuery));
 $src = $imgDir . $folder;
 foreach ($images as $key => $value) {
     $img = $src . '/' . $value;
     echo "{$img}";
     echo "<p>";
     $image = getImg($img);
     $rgbs = rgb($image);
     $avgRgbs = averageRgb($image, $rgbs);
     $hue = getHSL($avgRgbs);
     var_dump($hue);
     $color = markColor($hue);
     echo "{$color}";
     echo '<div style="width:300px; height:300px; background-color: ' . $color . ';"></div>';
     echo '<img src="../../images/fabrics/' . $folder . '/' . $value . '">';
     var_dump($value);
     echo "</p>";
     # code...
     $itemTitle = $name . "-" . $key;
     $itemAlias = $folder . "-" . $key;
     $extraField = '[{"id":"4","value":"\\/images\\/fabrics\\/' . $folder . '\\/' . $value . '"}, {"id":"9","value":"' . $color . '"}]';
     $query = "  INSERT INTO " . $cg->dbprefix . "k2_items (`title`, `alias`, `catid`, `published`, `created`, `extra_fields`, `access`, `publish_up`)\n                  VALUES ('" . $itemTitle . "', '" . $itemAlias . "', '" . $id . "', '1', '" . $date . "', '" . $extraField . "', '1', '" . $date . "')";
     echo "<p>Make Item</p><p>";
예제 #13
0
 /**
  * @brief Render the chart in 3D
  * 
  * @return Canvas 
  */
 private function render3D()
 {
     $c = new Canvas($this->width, $this->height, rgb($this->getProperty('background', '#FFFFFF')));
     $radiusx = 180;
     $radiusy = 90;
     $cx = $c->getWidth() / 2;
     $cy = $c->getHeight() / 2;
     $explode = $this->getProperty('explode', 0);
     $palette = $this->getProperty('palette');
     list($label, $vals) = $this->dataset->getSeries(0);
     $labels = $this->dataset->getLabels();
     $sum = $vals->getSum();
     $ci = 0;
     $sa = 0;
     for ($n = 0; $n < $vals->getCount(); $n++) {
         list($val, $key) = $vals->getValue($n);
         $a = 360 / $sum * $val;
         // Get angle
         $ea = $sa + $a;
         $ch = rgb($palette[$ci]);
         $cs = hsv($ch);
         $cs->value = $cs->value - 30;
         if (arr::hasKey($labels, $n)) {
             $l = $labels[$n];
         } else {
             $l = $n;
         }
         $data[] = array('key' => $key, 'label' => $l, 'c1' => $ch, 'c2' => $cs, 'sa' => $sa, 'ea' => $ea);
         $sa = $ea;
         $ci++;
     }
     $offs = array();
     foreach ($data as $id => $slice) {
         $avg = ($slice['sa'] + $slice['ea']) / 2;
         $data[$id]['ox'] = cos(($avg - 90) % 360 * PI / 180) * $explode;
         $data[$id]['oy'] = sin(($avg - 90) % 360 * PI / 180) * $explode;
         $data[$id]['dx'] = cos(($avg - 180) % 360 * PI / 180);
         $data[$id]['dy'] = sin(($avg - 180) % 360 * PI / 180);
     }
     $f = new BitmapFont(3);
     $f->setTextEffect(BitmapFont::EFFECT_OUTLINE, rgb(255, 255, 255));
     $p = $c->getPainter();
     for ($yp = 20; $yp >= 0; $yp--) {
         foreach ($data as $slice) {
             $ox = $slice['ox'];
             $oy = $slice['oy'];
             $p->drawFilledArc($cx + $ox, $cy + $oy + $yp, $radiusx * 2, $radiusy * 2, $slice['sa'], $slice['ea'], $yp == 0 ? $slice['c1'] : $slice['c2']);
         }
     }
     for ($yp = 20; $yp >= 0; $yp--) {
         foreach ($data as $slice) {
             // TODO: Labels
             $m = $f->measure($slice['label']);
             $dx = $slice['dx'];
             $dy = $slice['dy'];
             $c->drawText($f, rgb(0, 0, 0), $cx + $dx * $radiusx / 1.5 - $m['width'] / 2, $cx + $dy * $radiusy / 1.5 - $m['height'] / 2, $slice['label']);
         }
     }
     $this->renderObjects($c);
     // Return the canvas
     return $c;
 }