Example #1
1
 public function applyImageFilter(Canvas $canvas, Rect $rect = null)
 {
     if ($rect) {
         $image = $canvas->getImageRect($rect);
     } else {
         $image = $canvas;
     }
     $im = $image->toImagick();
     $im->adaptiveSharpenImage($this->radius, $this->sigma);
     $image->fromImagick($im);
     if ($rect) {
         // Draw dest onto canvas
         $c = new Canvas();
         $c->fromImagick($image);
         $c->draw($rect);
     } else {
         $canvas = $image;
     }
     return $canvas;
 }
Example #2
0
 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);
 }
Example #3
0
 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);
             }
         }
     }
 }
Example #4
0
 function applyFilter(Canvas $canvas)
 {
     $himage = $canvas->getImage();
     if (function_exists('imagefilter')) {
         // If gd is bundled this will work
         imagefilter($himage, IMG_FILTER_GRAYSCALE);
     } else {
         // 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);
                 $avg = ($index["red"] + $index["green"] + $index["blue"]) / 3;
                 $red = $avg;
                 $green = $avg;
                 $blue = $avg;
                 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);
                     $avg = (($index & 0xff) + ($index >> 8 & 0xff) + ($index >> 16 & 0xff)) / 3;
                     imagesetpixel($himage, $x, $y, $avg | $avg << 8 | $avg << 16);
                 }
             }
         }
     }
 }
Example #5
0
 function draw(Canvas $dest, $x = null, $y = null, $width = null, $height = null)
 {
     $image = new Canvas($width, $height);
     $p = $image->getPainter();
     if (!$x) {
         $x = 0;
     }
     if (!$y) {
         $y = 0;
     }
     if (!$width) {
         $width = $dest->width;
     }
     if (!$height) {
         $height = $dest->height;
     }
     if ($width && $height) {
         $grad = $height;
         // Top down
         $this->colors['step'] = array((double) ($this->colors['delta'][0] / $grad), (double) ($this->colors['delta'][1] / $grad), (double) ($this->colors['delta'][2] / $grad));
         $w = $width;
         for ($n = 0; $n < $grad; $n++) {
             $c = new RgbColor(floor($this->colors['first'][0] + $this->colors['step'][0] * $n), floor($this->colors['first'][1] + $this->colors['step'][1] * $n), floor($this->colors['first'][2] + $this->colors['step'][2] * $n));
             // Console::debug("Row %d: rgb(%d,%d,%d)", $n, $c->r, $c->g, $c->b);
             $p->drawLine(0, $n, $w, $n, $c);
         }
         imagecopy($dest->getImage(), $image->getImage(), $x, $y, 0, 0, $width, $height);
     } else {
         throw new BadArgumentException();
     }
 }
Example #6
0
 function applyFilter(Canvas $canvas)
 {
     $himage = $canvas->getImage();
     $m = array(array(1.0, 2.0, 1.0), array(2.0, 4.0, 2.0), array(1.0, 2.0, 1.0));
     $div = 16;
     $offs = 0;
     ImageUtils::imageconvolution($himage, $m, $div, $offs);
 }
 /**
  * @dataProvider getInsertXData
  */
 public function testInsertX($x, $w, array $expectedData)
 {
     $from = [0 => [0 => 'A', 1 => 'B', 2 => 'C'], 1 => [0 => 'D', 1 => 'E', 2 => 'F']];
     $from = new Canvas(null, $from);
     $to = [0 => [0 => 'X', 1 => 'Y', 2 => 'Z']];
     $to = new Canvas(null, $to);
     $from->insert($to, 0, $x, 0, $w);
     $this->assertEquals($expectedData, $from->getArrayCopy());
 }
Example #8
0
 function applyFilter(Canvas $canvas)
 {
     $himage = $canvas->getImage();
     if (function_exists('imagefilter') && defined('IMG_FILTER_COLORIZE')) {
         // If gd is bundled this will work
         imagefilter($himage, IMG_FILTER_COLORIZE, $this->r, $this->g, $this->b);
     } else {
         throw new FunctionNotSupportedException("Colorize not supported by this version of GD");
     }
 }
Example #9
0
 function applyFilter(Canvas $canvas)
 {
     $himage = $canvas->getImage();
     if ($this->usegdfilter) {
         if (!imagefilter($himage, IMG_FILTER_PIXELATE, $this->pixelsize, $this->advanced)) {
             throw new GraphicsException("Failed to apply filter");
         }
     } else {
         // TODO: Implement our own pixelation filter
     }
     $canvas->setImage($himage);
     return null;
 }
Example #10
0
 public function getMapCanvas($width, $height)
 {
     $url = $this->getApiQueryUrl(["w" => $width, "h" => $height]);
     $map = file_get_contents($url);
     $c = Canvas::createFromString($map);
     return $c;
 }
Example #11
0
 /**
  * @covers Image\Canvas::__clone
  */
 public function test__clone()
 {
     $this->object->createImage(200, 200);
     $clone = clone $this->object;
     $this->assertEquals($this->object->getImageWidth(), $clone->getImageWidth());
     $this->assertEquals($this->object->getImageHeight(), $clone->getImageHeight());
 }
Example #12
0
 function __destruct()
 {
     $this->imh->clear();
     $this->imh->destroy();
     unset($this->imh);
     parent::__destruct();
 }
 function evaluate($code, $vars = array())
 {
     if (!$this->_canvas->get_dompdf()->get_option("enable_php")) {
         return;
     }
     // Set up some variables for the inline code
     $pdf = $this->_canvas;
     $PAGE_NUM = $pdf->get_page_number();
     $PAGE_COUNT = $pdf->get_page_count();
     // Override those variables if passed in
     foreach ($vars as $k => $v) {
         ${$k} = $v;
     }
     //$code = html_entity_decode($code); // @todo uncomment this when tested
     eval($code);
 }
Example #14
0
 private static function generateThumb($path, $name, $width, $heigth)
 {
     $save = self::$path . DIRECTORY_SEPARATOR . $name;
     $thumb = \Canvas::Instance();
     $thumb->carrega($path);
     $thumb->redimensiona($width, $heigth, 'crop');
     $thumb->grava($save);
 }
Example #15
0
 /**
  * Método singleton para que apenas uma instancia da classe seja utilizada no servidor.
  * @param String $origem
  * @return canvas
  */
 public static function Instance($origem = '')
 {
     if (empty(self::$instance)) {
         self::$instance = new canvas($origem);
     } else {
         self::$instance->resetar();
     }
     return self::$instance;
 }
Example #16
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);
 }
Example #17
0
 /**
  * Returns the PDF as a string
  *
  * The file will open a download dialog by default.  The options
  * parameter controls the output.  Accepted options are:
  *
  *
  * 'compress' = > 1 or 0 - apply content stream compression, this is
  *    on (1) by default
  *
  *
  * @param array  $options options (see above)
  *
  * @return string
  */
 function output($options = null)
 {
     $this->save_locale();
     $this->write_log();
     if (is_null($this->_pdf)) {
         return null;
     }
     $output = $this->_pdf->output($options);
     $this->restore_locale();
     return $output;
 }
Example #18
0
 function applyFilter(Canvas $canvas)
 {
     $himage = $canvas->getImage();
     $iw = imagesx($himage);
     $ih = imagesy($himage);
     switch ($this->placement) {
         case WatermarkImageFilter::POS_RELATIVE:
             $dx = $this->x >= 0 ? $this->x : $iw - $this->width + $this->x + 1;
             $dy = $this->y >= 0 ? $this->y : $ih - $this->height + $this->y + 1;
             break;
         case WatermarkImageFilter::POS_ABSOLUTE:
             $dx = $this->x;
             $dy = $this->y;
             break;
         case WatermarkImageFilter::POS_CENTERED:
             $dx = $iw / 2 + $this->x;
             $dy = $ih / 2 + $this->y;
             break;
     }
     imagecopymerge_alpha($himage, $this->hwatermark, $dx, $dy, 0, 0, $this->width, $this->height, 0);
 }
Example #19
0
 function applyFilter(Canvas $canvas)
 {
     $himage = $canvas->getImage();
     $rheight = $this->_os->get('reflectionheight', 25);
     $iheight = imagesy($himage);
     $iwidth = imagesx($himage);
     if ($this->_os->get('resizecanvas', false)) {
         // create new canvas of iheight+rheight, set offset to
         // iheight
         $offs = $iheight;
         $hreflect = imagecreatetruecolor($iwidth, $iheight + $rheight);
     } else {
         // create new canvas of iheight, set offset to iheight to
         // iheight-rheight
         $offs = $iheight - $rheight;
         $hreflect = imagecreatetruecolor($iwidth, $iheight);
     }
     if ($this->_os->get('background', null)) {
         // Fill with background if specified, note that this disables
         // the alpha saving
         imagefilledrectangle($hreflect, 0, 0, imagesx($hreflect), imagesy($hreflect), new Color($this->_os->get('background')));
     } else {
         // Disable alphablending and enable saving of the alpha channel
         imagealphablending($hreflect, false);
         imagesavealpha($hreflect, true);
     }
     imagecopy($hreflect, $himage, 0, 0, 0, 0, $iwidth, $iheight);
     $as = 80 / $rheight;
     $sc = $this->_os->get('scale', 2);
     for ($y = 1; $y <= $rheight; $y++) {
         for ($x = 0; $x < $iwidth; $x++) {
             $rgba = imagecolorat($himage, $x, $offs - $y * $sc);
             $alpha = max($rgba >> 24 & 0x7f, 47 + $y * $as);
             $rgba = imagecolorallocatealpha($hreflect, $rgba >> 16 & 0xff, $rgba >> 8 & 0xff, $rgba & 0xff, $alpha);
             imagesetpixel($hreflect, $x, $offs + $y - 1, $rgba);
         }
     }
     return $hreflect;
 }
Example #20
0
 function draw(Canvas $dest, $x = null, $y = null, $width = null, $height = null)
 {
     $hi = $dest->getImage();
     $str = '*' . $this->_text . '*';
     if ($x && $y && $width && $height) {
         // Each character is 12 units wide, so let's figure out how wide
         // we should make the output. We add 2 for the padding.
         $outwidth = strlen($str) * 14;
         $unitwidth = (int) ($width / $outwidth);
         $rx = 0;
         for ($i = 0; $i < strlen($str); $i++) {
             $charbin = $this->getCharacter($str[$i]);
             for ($j = 0; $j < 9; $j++) {
                 $bw = $charbin[$j] == '1' ? 1 : 0;
                 imagefilledrectangle($hi, $x + $rx * $unitwidth, $y, $x + ($rx + $bw + 1) * $unitwidth, $y + $height, $j % 2 ? 0xffffff : 0x0);
                 $rx = $rx + 2 + $bw;
             }
             $rx = $rx + 2;
         }
     } else {
         new BadArgumentException();
     }
 }
Example #21
0
 /**
  * Executa o upload do arquivo
  * @return boolean
  */
 public function execute()
 {
     $this->width = \Local\Config::$cms_image_width;
     $this->height = \Local\Config::$cms_image_heigth;
     if (\Local\Config::$cms_image_size_reverse_direction) {
         if ($this->info[0] < $this->info[1]) {
             $this->width = \Local\Config::$cms_image_heigth;
             $this->height = \Local\Config::$cms_image_width;
         }
     }
     $upload = \Canvas::Instance(parent::getTmpName());
     $upload->redimensiona($this->width, $this->height, \Local\Config::$cms_image_type);
     return $upload->grava($this->detination);
 }
 public function deletePortletAction()
 {
     $id = $this->request->getPost("id");
     $canvas = Canvas::findFirstByid($id);
     $widgets = $canvas->Widget;
     foreach ($widgets as $widget) {
         $widget->delete();
     }
     if (!$canvas->delete()) {
         foreach ($canvas->getMessages() as $message) {
             $this->flash->error($message);
         }
     } else {
         $this->flash->success("Portlet was deleted successfully");
     }
     return $this->dispatcher->forward(array("controller" => "dashboard", "action" => "edit", "params" => array('id' => $canvas->dashboard_id)));
 }
Example #23
0
File: test.php Project: dns/libcaca
 function __construct()
 {
     parent::__construct();
     $this->startTime = gettimeofday(true);
     $message = " --- POWERED BY LIBCACA --- OLDSCHOOL TEXT EFFECTS ARE 100% PURE WIN";
     $this->scroll = new Canvas(strlen($message), 1);
     $this->scroll->setColorAnsi(AnsiColor::WHITE, AnsiColor::TRANSPARENT);
     $this->scroll->putStr(0, 0, $message);
     $fontList = Font::getList();
     $f = new Font($fontList[1]);
     $w = $f->getWidth() * strlen($message);
     $h = $f->getHeight();
     $this->image = imagecreatetruecolor($w, $h);
     imagealphablending($this->image, false);
     imagesavealpha($this->image, true);
     $this->d = new Dither($this->image);
     $f->Render($this->scroll, $this->image);
 }
Example #24
0
}
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array($contextpage));
$extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
$extralabels = $extrafields->fetch_name_optionals_label('product');
$search_array_options = $extrafields->getOptionalsFromPost($extralabels, '', 'search_');
if (empty($action)) {
    $action = 'list';
}
// Get object canvas (By default, this is not defined, so standard usage of dolibarr)
$canvas = GETPOST("canvas");
$objcanvas = null;
if (!empty($canvas)) {
    require_once DOL_DOCUMENT_ROOT . '/core/class/canvas.class.php';
    $objcanvas = new Canvas($db, $action);
    $objcanvas->getCanvas('product', 'list', $canvas);
}
// Security check
if ($type == '0') {
    $result = restrictedArea($user, 'produit', '', '', '', '', '', $objcanvas);
} else {
    if ($type == '1') {
        $result = restrictedArea($user, 'service', '', '', '', '', '', $objcanvas);
    } else {
        $result = restrictedArea($user, 'produit|service', '', '', '', '', '', $objcanvas);
    }
}
// List of fields to search into when doing a "search in all"
$fieldstosearchall = array('p.ref' => "Ref", 'pfp.ref_fourn' => "RefSupplier", 'p.label' => "ProductLabel", 'p.description' => "Description", "p.note" => "Note");
// multilang
Example #25
0
function showUmlImage($json)
{
    $title = "View As UML Image";
    $icon = "png.png";
    ?>
  <html>
  <head>
    <title> <?php 
    echo $title;
    ?>
 </title>
    <link rel="shortcut icon" href=<?php 
    echo $icon;
    ?>
 type="image/x-icon" />
  </head>
  </html>
  <?php 
    header("Content-type: image/png");
    require_once "canvas.php";
    $canvas = new Canvas(950, 350);
    $diagram = $canvas->createDiagram();
    $classIds = array();
    foreach ($json->umpleClasses as $umpleClass) {
        $umplePosition = $umpleClass->position;
        $classEntity = new ClassEntity($umpleClass->name, new Position($umplePosition->x, $umplePosition->y, $umplePosition->width, $umplePosition->height));
        $classIds[$umpleClass->id] = $classEntity;
        $classEntity->draw($diagram);
    }
    foreach ($json->umpleAssociations as $umpleAssociation) {
        $classEntity1 = $classIds[$umpleAssociation->classOneId];
        $classEntity2 = $classIds[$umpleAssociation->classTwoId];
        $mult1 = new MultiplicityEnd($classEntity1);
        $mult2 = new MultiplicityEnd($classEntity2);
        $association = new Association($mult1, $mult2);
        $c1Position = $classEntity1->getPosition();
        $c1Offset = $umpleAssociation->offsetOnePosition;
        $c2Position = $classEntity2->getPosition();
        $c2Offset = $umpleAssociation->offsetTwoPosition;
        $p1 = new Point($c1Position->getX() + $c1Offset->x, $c1Position->getY() + $c1Offset->y);
        $p2 = new Point($c2Position->getX() + $c2Offset->x, $c2Position->getY() + $c2Offset->y);
        $association->addConnector($p1);
        $association->addConnector($p2);
        $association->draw($diagram);
    }
    ImagePng($diagram);
    ImageDestroy($diagram);
}
Example #26
0
$action		= (GETPOST('action') ? GETPOST('action') : 'view');
$confirm	= GETPOST('confirm');
$socid		= GETPOST('socid');
if ($user->societe_id) $socid=$user->societe_id;

$object = new Societe($db);
$extrafields = new ExtraFields($db);

// Get object canvas (By default, this is not defined, so standard usage of dolibarr)
$object->getCanvas($socid);
$canvas = $object->canvas?$object->canvas:GETPOST("canvas");
if (! empty($canvas))
{
    require_once(DOL_DOCUMENT_ROOT."/core/class/canvas.class.php");
    $objcanvas = new Canvas($db, $action);
    $objcanvas->getCanvas('thirdparty', 'card', $canvas);
}

// Security check
$result = restrictedArea($user, 'societe', $socid, '&societe', '', 'fk_soc', 'rowid', $objcanvas);

// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
include_once(DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php');
$hookmanager=new HookManager($db);
$hookmanager->initHooks(array('thirdpartycard'));


/*
 * Actions
 */
 protected function _border_double($x, $y, $length, $color, $widths, $side, $corner_style = "bevel")
 {
     list($top, $right, $bottom, $left) = $widths;
     $line_width = ${$side} / 4;
     // We draw the outermost edge first. Points are ordered: outer left,
     // outer right, inner right, inner left, or outer top, outer bottom,
     // inner bottom, inner top.
     switch ($side) {
         case "top":
             if ($corner_style === "bevel") {
                 $left_line_width = $left / 4;
                 $right_line_width = $right / 4;
                 $points = array($x, $y, $x + $length, $y, $x + $length - $right_line_width, $y + $line_width, $x + $left_line_width, $y + $line_width);
                 $this->_canvas->polygon($points, $color, null, null, true);
                 $points = array($x + $left - $left_line_width, $y + $top - $line_width, $x + $length - $right + $right_line_width, $y + $top - $line_width, $x + $length - $right, $y + $top, $x + $left, $y + $top);
                 $this->_canvas->polygon($points, $color, null, null, true);
             } else {
                 $this->_canvas->filled_rectangle($x, $y, $length, $line_width, $color);
                 $this->_canvas->filled_rectangle($x, $y + $top - $line_width, $length, $line_width, $color);
             }
             break;
         case "bottom":
             if ($corner_style === "bevel") {
                 $left_line_width = $left / 4;
                 $right_line_width = $right / 4;
                 $points = array($x, $y, $x + $length, $y, $x + $length - $right_line_width, $y - $line_width, $x + $left_line_width, $y - $line_width);
                 $this->_canvas->polygon($points, $color, null, null, true);
                 $points = array($x + $left - $left_line_width, $y - $bottom + $line_width, $x + $length - $right + $right_line_width, $y - $bottom + $line_width, $x + $length - $right, $y - $bottom, $x + $left, $y - $bottom);
                 $this->_canvas->polygon($points, $color, null, null, true);
             } else {
                 $this->_canvas->filled_rectangle($x, $y - $line_width, $length, $line_width, $color);
                 $this->_canvas->filled_rectangle($x, $y - $bottom, $length, $line_width, $color);
             }
             break;
         case "left":
             if ($corner_style === "bevel") {
                 $top_line_width = $top / 4;
                 $bottom_line_width = $bottom / 4;
                 $points = array($x, $y, $x, $y + $length, $x + $line_width, $y + $length - $bottom_line_width, $x + $line_width, $y + $top_line_width);
                 $this->_canvas->polygon($points, $color, null, null, true);
                 $points = array($x + $left - $line_width, $y + $top - $top_line_width, $x + $left - $line_width, $y + $length - $bottom + $bottom_line_width, $x + $left, $y + $length - $bottom, $x + $left, $y + $top);
                 $this->_canvas->polygon($points, $color, null, null, true);
             } else {
                 $this->_canvas->filled_rectangle($x, $y, $line_width, $length, $color);
                 $this->_canvas->filled_rectangle($x + $left - $line_width, $y, $line_width, $length, $color);
             }
             break;
         case "right":
             if ($corner_style === "bevel") {
                 $top_line_width = $top / 4;
                 $bottom_line_width = $bottom / 4;
                 $points = array($x, $y, $x, $y + $length, $x - $line_width, $y + $length - $bottom_line_width, $x - $line_width, $y + $top_line_width);
                 $this->_canvas->polygon($points, $color, null, null, true);
                 $points = array($x - $right + $line_width, $y + $top - $top_line_width, $x - $right + $line_width, $y + $length - $bottom + $bottom_line_width, $x - $right, $y + $length - $bottom, $x - $right, $y + $top);
                 $this->_canvas->polygon($points, $color, null, null, true);
             } else {
                 $this->_canvas->filled_rectangle($x - $line_width, $y, $line_width, $length, $color);
                 $this->_canvas->filled_rectangle($x - $right, $y, $line_width, $length, $color);
             }
             break;
         default:
             return;
     }
 }
Example #28
0
<?php

require_once 'config.php';
require_once 'functions.php';
require_once '../common/db.php';
try {
    // Database connection first.
    $db = new CompactDB($mt_dbhost, $mt_dbname, $mt_dbuser, $mt_dbpass);
    $q = new Query($db);
    $chunks = $q->select('id,content')->from('track')->where("processed=0")->run();
    // Required objects and set up
    $c = new Canvas(thisURL());
    $c->common->addScriptRef(APP_URL . 'files/jquery.js');
    $c->common->addScriptRef(APP_URL . 'files/jquery-effects.js');
    switch ($c->getMode()) {
        /* --------------------------------------------------------------------------------------------------------- */
        case 'show':
        default:
            // We create the toolbar
            $t = new Toolbar();
            $c->register($t);
            // If there are chunks to process, we display a button.
            if (count($chunks) > 0) {
                $t->addAction('Process ' . count($chunks) . ' tracks', "doConfirm('This action may take a long time and make the browser\\nto timeout. Are you sure you want to do this?','process')", 'go-jump');
            }
            // We retrieve all the tracks we have stored in a pretty table.
            $mtrx = $db->qSelect("select t.id, t.name, t.pid, from_unixtime(t.offset/1000) as t_start, round(max(e.t)/1000,1) as t_duration " . "from track as t, event as e where t.id=e.track_id and t.processed=1 group by e.track_id;");
            $tab = new Table($mtrx);
            $tab->setProperty('highlight', true);
            $tab->setProperty('numbering', true);
            $tab->setProperty('id', 'id');
 /**
  * Calculates font height
  *
  * @param string $font
  * @param float $size
  * @return float
  */
 static function get_font_height($font, $size)
 {
     return self::$_pdf->get_font_height($font, $size);
 }
 /**
  * Returns the PDF as a string
  *
  * The file will open a download dialog by default.  The options
  * parameter controls the output.  Accepted options are:
  *
  *
  * 'compress' = > 1 or 0 - apply content stream compression, this is
  *    on (1) by default
  *
  *
  * @param array  $options options (see above)
  * @return string
  */
 function output($options = null)
 {
     if (is_null($this->_pdf)) {
         return null;
     }
     return $this->_pdf->output($options);
 }