Wrapper taking custom units and margins into account
@see \ZendPdf\Page::drawRectangle() for documentation
178314
public function drawRectangle($x1, $y1, $x2, $y2, $fillType = \ZendPdf\Page::SHAPE_DRAW_FILL_AND_STROKE)
    {
        $this->convertCoordinatesFromUserSpace($x1, $y1);
        $this->convertCoordinatesFromUserSpace($x2, $y2);
        list($y1, $y2) = array($y2, $y1);
        return parent::drawRectangle($x1, $y1, $x2, $y2, $fillType);
    }
1113880
public function draw()
    {
        $numberLen = strlen(' 100%');
        $complete = round($this->_progress / $this->_total, 2);
        $barLen = ($this->_width - $numberLen) * ($this->_progress / $this->_total);
        $bar = '';
        if ($barLen > 1) {
            $bar = str_repeat('=', $barLen - 1) . '>';
        }

        $pad = ceil($this->_width - $numberLen - $barLen);
        if ($pad > 0) {
            $bar .= str_repeat(' ', $pad);
        }
        $percent = ($complete * 100) . '%';
        $bar .= str_pad($percent, $numberLen, ' ', STR_PAD_LEFT);

        $this->_io->overwrite($bar, 0);

        return $this;
    }
15524
public function drawCircle($x, $y, $radius, $param4 = null, $param5 = null, $param6 = null)
    {
        // Don't convert units and call parent::drawCircle(), since it calls drawEllipse which will convert units twice!
        return $this->drawEllipse($x - $radius, $y - $radius, $x + $radius, $y + $radius, $param4, $param5, $param6);
    }
850539
function plot($x, $y, $type, $size, $colour, $offset) {
      //print("drawing point of type: $type, at offset: $offset");
      $u = $x + $offset;
      $v = $this->calculated['inner_border']['bottom'] - $y + $offset;
      $half = $size / 2;

      switch ($type) {
        case 'square':
          ImageFilledRectangle($this->image, $u-$half, $v-$half, $u+$half, $v+$half, $this->colour[$colour]);
          break;
        case 'square-open':
          ImageRectangle($this->image, $u-$half, $v-$half, $u+$half, $v+$half, $this->colour[$colour]);
          break;
        case 'circle':
          ImageArc($this->image, $u, $v, $size, $size, 0, 360, $this->colour[$colour]);
          ImageFillToBorder($this->image, $u, $v, $this->colour[$colour], $this->colour[$colour]);
          break;
        case 'circle-open':
          ImageArc($this->image, $u, $v, $size, $size, 0, 360, $this->colour[$colour]);
          break;
        case 'diamond':
          ImageFilledPolygon($this->image, array($u, $v-$half, $u+$half, $v, $u, $v+$half, $u-$half, $v), 4, $this->colour[$colour]);
          break;
        case 'diamond-open':
          ImagePolygon($this->image, array($u, $v-$half, $u+$half, $v, $u, $v+$half, $u-$half, $v), 4, $this->colour[$colour]);
          break;
        case 'triangle':
          ImageFilledPolygon($this->image, array($u, $v-$half, $u+$half, $v+$half, $u-$half, $v+$half), 3, $this->colour[$colour]);
          break;
        case 'triangle-open':
          ImagePolygon($this->image, array($u, $v-$half, $u+$half, $v+$half, $u-$half, $v+$half), 3, $this->colour[$colour]);
          break;
        case 'dot':
          ImageSetPixel($this->image, $u, $v, $this->colour[$colour]);
          break;
      }
    }
918556
public function draw(Image $Object, $Value, $X, $Y, $Format = [])
    {
        $this->pChartObject = $Object;

        $R = isset($Format["R"]) ? $Format["R"] : 0;
        $G = isset($Format["G"]) ? $Format["G"] : 0;
        $B = isset($Format["B"]) ? $Format["B"] : 0;
        $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 100;
        $Height = isset($Format["Height"]) ? $Format["Height"] : 30;
        $Angle = isset($Format["Angle"]) ? $Format["Angle"] : 0;
        $ShowLegend = isset($Format["ShowLegend"]) ? $Format["ShowLegend"] : false;
        $LegendOffset = isset($Format["LegendOffset"]) ? $Format["LegendOffset"] : 5;
        $DrawArea = isset($Format["DrawArea"]) ? $Format["DrawArea"] : false;
        $AreaR = isset($Format["AreaR"]) ? $Format["AreaR"] : 255;
        $AreaG = isset($Format["AreaG"]) ? $Format["AreaG"] : 255;
        $AreaB = isset($Format["AreaB"]) ? $Format["AreaB"] : 255;
        $AreaBorderR = isset($Format["AreaBorderR"]) ? $Format["AreaBorderR"] : $AreaR;
        $AreaBorderG = isset($Format["AreaBorderG"]) ? $Format["AreaBorderG"] : $AreaG;
        $AreaBorderB = isset($Format["AreaBorderB"]) ? $Format["AreaBorderB"] : $AreaB;

        $TextString = $this->encode128($Value);

        if ($DrawArea) {
            $X1 = $X + cos(($Angle - 135) * PI / 180) * 10;
            $Y1 = $Y + sin(($Angle - 135) * PI / 180) * 10;

            $X2 = $X1 + cos($Angle * PI / 180) * (strlen($this->Result) + 20);
            $Y2 = $Y1 + sin($Angle * PI / 180) * (strlen($this->Result) + 20);

            if ($ShowLegend) {
                $X3 = $X2
                    + cos(($Angle + 90) * PI / 180)
                    * ($Height + $LegendOffset + $this->pChartObject->FontSize + 10)
                ;
                $Y3 = $Y2
                    + sin(($Angle + 90) * PI / 180)
                    * ($Height + $LegendOffset + $this->pChartObject->FontSize + 10)
                ;
            } else {
                $X3 = $X2 + cos(($Angle + 90) * PI / 180) * ($Height + 20);
                $Y3 = $Y2 + sin(($Angle + 90) * PI / 180) * ($Height + 20);
            }

            $X4 = $X3 + cos(($Angle + 180) * PI / 180) * (strlen($this->Result) + 20);
            $Y4 = $Y3 + sin(($Angle + 180) * PI / 180) * (strlen($this->Result) + 20);

            $Polygon = [$X1, $Y1, $X2, $Y2, $X3, $Y3, $X4, $Y4];
            $Settings = [
                "R" => $AreaR,
                "G" => $AreaG,
                "B" => $AreaB,
                "BorderR" => $AreaBorderR,
                "BorderG" => $AreaBorderG,
                "BorderB" => $AreaBorderB
            ];
            $this->pChartObject->drawPolygon($Polygon, $Settings);
        }

        for ($i = 1; $i <= strlen($this->Result); $i++) {
            if ($this->mid($this->Result, $i, 1) == 1) {
                $X1 = $X + cos($Angle * PI / 180) * $i;
                $Y1 = $Y + sin($Angle * PI / 180) * $i;
                $X2 = $X1 + cos(($Angle + 90) * PI / 180) * $Height;
                $Y2 = $Y1 + sin(($Angle + 90) * PI / 180) * $Height;

                $Settings = ["R" => $R, "G" => $G, "B" => $B, "Alpha" => $Alpha];
                $this->pChartObject->drawLine($X1, $Y1, $X2, $Y2, $Settings);
            }
        }

        if ($ShowLegend) {
            $X1 = $X + cos($Angle * PI / 180) * (strlen($this->Result) / 2);
            $Y1 = $Y + sin($Angle * PI / 180) * (strlen($this->Result) / 2);

            $LegendX = $X1 + cos(($Angle + 90) * PI / 180) * ($Height + $LegendOffset);
            $LegendY = $Y1 + sin(($Angle + 90) * PI / 180) * ($Height + $LegendOffset);

            $Settings = [
                "R" => $R,
                "G" => $G,
                "B" => $B,
                "Alpha" => $Alpha,
                "Angle" => -$Angle,
                "Align" => TEXT_ALIGN_TOPMIDDLE
            ];
            $this->pChartObject->drawText($LegendX, $LegendY, $TextString, $Settings);
        }
    }
1315423
function drawLinearUnits(context, options) {
    if (!options.units) return ;

    let {isVertical, width, length, baseX, baseY, unitsMargin} =
        context.barDimensions;
    let textHeight = options.fontUnitsSize * width / 200;
    //noinspection JSUnresolvedFunction
    let textX = round(baseX + (isVertical ? width : length) / 2);
    //noinspection JSUnresolvedFunction
    let textY = round(baseY + (isVertical ? length : width) +
        unitsMargin / 2 - textHeight / 2);

    context.save();
    context.textAlign = 'center';
    context.fillStyle = options.colorUnits;
    context.font = drawings.font(options, 'Units', width / 200);
    context.lineWidth = 0;
    context.fillText(options.units, textX, textY, isVertical ? width : length);
}
1306062
function DrawPlotBorder() {
    switch ($this->plot_border_type) {
      case "left" :
        ImageLine($this->img, $this->plot_area[0],$this->ytr($this->plot_min_y),
          $this->plot_area[0],$this->ytr($this->plot_max_y),$this->ndx_grid_color);
      break;
      case "none":
        //Draw No Border
      break;
      default:
        ImageRectangle($this->img, $this->plot_area[0],$this->ytr($this->plot_min_y),
          $this->plot_area[2],$this->ytr($this->plot_max_y),$this->ndx_grid_color);
      break;
    }
    $this->DrawYAxis();
    $this->DrawXAxis();
    return true;
  }
958448
void drawDivider(Canvas canvas, Rect bounds, int childIndex) {
        final Drawable divider = getDivider();
        divider.setBounds(bounds);
        divider.draw(canvas);
    }
479032
def draw_foreground
      case @justify
        when :left
          rel_x = 0.0
          draw_x = x + padding_left

        when :right
          rel_x = 1.0
          draw_x = x + rect.width - padding_right

        when :center
          rel_x = 0.5
          draw_x = (x + padding_left) + (rect.width - padding_right - padding_left) / 2.0
      end

      font.draw_rel(@text, draw_x, y + padding_top, z, rel_x, 0, 1, 1, color)
    end
530526
private function drawRectangle(
    CanvasInterface $canvas, StyleInterface $style = null, $filled = false)
    {

        $x = $this->getStart()->getX();
        $y = $this->getStart()->getY();
        $color = (!is_null($style)) ?
                $style->apply($canvas, $this)->getValue() :
                $this->getColor()->getValue();

        $result = false;

        if (true === $filled) {
            $result = @imagefilledrectangle(
                            $canvas->getHandler()
                            , $x
                            , $y
                            , $this->getDimension()->getWidth() + $x
                            , $this->getDimension()->getHeight() + $y
                            , $color
            );
        } else {
            $result = @imagerectangle(
                            $canvas->getHandler()
                            , $x
                            , $y
                            , $this->getDimension()->getWidth() + $x
                            , $this->getDimension()->getHeight() + $y
                            , $color
            );
        }

        if (false == $result) {
            throw new DrawableException(sprintf(
                    'Faild To Draw The Rectangle "%s"', (string) $this
            ));
        }
    }
1356575
def render(self, rectangle, data):
        """"""

        size = (1.0 - 2.0*self.margin) * rectangle.h
        offset = self.margin * rectangle.h
        per_mark = 1.0 / float(self.total)
        bottom = offset + size * float(self.index) * per_mark
        top = bottom + per_mark * size

        c = data['output']
        with c:
            c.translate(rectangle.x, rectangle.y)
            c.draw_polygon(
                0, top, -self.width, bottom, self.width, bottom,
                fill=self.color
                )
1306376
public function drawRectangle($X1, $Y1, $X2, $Y2, array $Format = [])
    {
        $R = isset($Format["R"]) ? $Format["R"] : 0;
        $G = isset($Format["G"]) ? $Format["G"] : 0;
        $B = isset($Format["B"]) ? $Format["B"] : 0;
        $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 100;
        $Ticks = isset($Format["Ticks"]) ? $Format["Ticks"] : null;
        $NoAngle = isset($Format["NoAngle"]) ? $Format["NoAngle"] : false;

        if ($X1 > $X2) {
            list($X1, $X2) = [$X2, $X1];
        }
        if ($Y1 > $Y2) {
            list($Y1, $Y2) = [$Y2, $Y1];
        }

        if ($this->Antialias) {
            if ($NoAngle) {
                $this->drawLine(
                    $X1 + 1,
                    $Y1,
                    $X2 - 1,
                    $Y1,
                    ["R" => $R, "G" => $G, "B" => $B, "Alpha" => $Alpha, "Ticks" => $Ticks]
                );
                $this->drawLine(
                    $X2,
                    $Y1 + 1,
                    $X2,
                    $Y2 - 1,
                    ["R" => $R, "G" => $G, "B" => $B, "Alpha" => $Alpha, "Ticks" => $Ticks]
                );
                $this->drawLine(
                    $X2 - 1,
                    $Y2,
                    $X1 + 1,
                    $Y2,
                    ["R" => $R, "G" => $G, "B" => $B, "Alpha" => $Alpha, "Ticks" => $Ticks]
                );
                $this->drawLine(
                    $X1,
                    $Y1 + 1,
                    $X1,
                    $Y2 - 1,
                    ["R" => $R, "G" => $G, "B" => $B, "Alpha" => $Alpha, "Ticks" => $Ticks]
                );
            } else {
                $this->drawLine(
                    $X1 + 1,
                    $Y1,
                    $X2 - 1,
                    $Y1,
                    ["R" => $R, "G" => $G, "B" => $B, "Alpha" => $Alpha, "Ticks" => $Ticks]
                );
                $this->drawLine(
                    $X2,
                    $Y1,
                    $X2,
                    $Y2,
                    ["R" => $R, "G" => $G, "B" => $B, "Alpha" => $Alpha, "Ticks" => $Ticks]
                );
                $this->drawLine(
                    $X2 - 1,
                    $Y2,
                    $X1 + 1,
                    $Y2,
                    ["R" => $R, "G" => $G, "B" => $B, "Alpha" => $Alpha, "Ticks" => $Ticks]
                );
                $this->drawLine(
                    $X1,
                    $Y1,
                    $X1,
                    $Y2,
                    ["R" => $R, "G" => $G, "B" => $B, "Alpha" => $Alpha, "Ticks" => $Ticks]
                );
            }
        } else {
            $Color = $this->allocateColor($this->Picture, $R, $G, $B, $Alpha);
            imagerectangle($this->Picture, $X1, $Y1, $X2, $Y2, $Color);
        }
    }
1025971
function(r, n) {
  /* the Raphael set is obligatory, containing all you want to display */
  var set = r.set().push(
    /* custom objects go here */
    r.rect(n.point[0]-30, n.point[1]-13, 50, 50)
    .attr({"fill": "#fa8", "stroke-width": 2, r: 9}))
    .push(r.text(n.point[0], n.point[1] + 15, n.id)
          .attr({"font-size":"20px"}));
          return set;
}
977180
public /*internal*/ function draw($im, $x1, $y1, $x2, $y2) {
        $x = 0;
        $y = 0;

        $fontDimension = $this->font->getDimension();

        if ($this->position === self::POSITION_TOP || $this->position === self::POSITION_BOTTOM) {
            if ($this->position === self::POSITION_TOP) {
                $y = $y1 - $this->spacing - $fontDimension[1];
            } elseif ($this->position === self::POSITION_BOTTOM) {
                $y = $y2 + $this->spacing;
            }

            if ($this->alignment === self::ALIGN_CENTER) {
                $x = ($x2 - $x1) / 2 + $x1 - $fontDimension[0] / 2 + $this->offset;
            } elseif ($this->alignment === self::ALIGN_LEFT)  {
                $x = $x1 + $this->offset;
            } else {
                $x = $x2 + $this->offset - $fontDimension[0];
            }
        } else {
            if ($this->position === self::POSITION_LEFT) {
                $x = $x1 - $this->spacing - $fontDimension[0];
            } elseif ($this->position === self::POSITION_RIGHT) {
                $x = $x2 + $this->spacing;
            }

            if ($this->alignment === self::ALIGN_CENTER) {
                $y = ($y2 - $y1) / 2 + $y1 - $fontDimension[1] / 2 + $this->offset;
            } elseif ($this->alignment === self::ALIGN_TOP)  {
                $y = $y1 + $this->offset;
            } else {
                $y = $y2 + $this->offset - $fontDimension[1];
            }
        }

        $this->font->setText($this->text);
        $this->font->draw($im, $x, $y);
    }
1328867
function DrawGraph() {

    if (($this->img) == "") {
      $this->DrawError('No Image Defined: DrawGraph');
            //$this->PHPlot();
        }

    if (! is_array($this->data_values)) {
      $this->DrawBackground();
      $this->DrawError("No array of data in \$data_values");
    } else {
      if (!$this->data_color) {
        $this->SetDataColors(array('blue','green','yellow','red','orange','blue'),array('black'));
      }

      $this->FindDataLimits();  //Get maxima and minima for scaling

      $this->SetXLabelHeight();		//Get data for bottom margin

      $this->SetYLabelWidth();		//Get data for left margin

      if (!$this->plot_area_width) {
        $this->SetPlotAreaPixels('','','','');		//Set Margins
      }

      if (!$this->plot_max_y) {  //If not set by user call SetPlotAreaWorld,
        $this->SetPlotAreaWorld('','','','');
      }

      if ($this->data_type == "text-data") {
        $this->SetEqualXCoord();
      }

      $this->SetPointSize($this->point_size);

      $this->DrawBackground();
      $this->DrawImageBorder();

      $this->SetTranslation();

      if ($this->draw_plot_area_background == 1) {
        $this->DrawPlotAreaBackground();
      }
//$foo = "$this->max_y, $this->min_y, $new_miny, $new_maxy, $this->x_label_height";
//ImageString($this->img, 4, 20, 20, $foo, $this->ndx_text_color);

      switch ($this->plot_type) {
        case "bars":
          $this->DrawPlotBorder();
          $this->DrawLabels();
          $this->DrawBars();
          $this->DrawXAxis();
          break;
        case "thinbarline":
          $this->DrawPlotBorder();
          $this->DrawLabels();
          $this->DrawThinBarLines();
          break;
        case "lines":
          $this->DrawPlotBorder();
          $this->DrawLabels();
          if ( $this->data_type == "text-data") {
            $this->DrawLines();
          } elseif ( $this->data_type == "data-data-error") {
            $this->DrawLinesError();
          } else {
            $this->DrawLines();
          }
          break;
        case "area":
          $this->DrawPlotBorder();
          $this->DrawLabels();
          if ( $this->data_type == "text-data") {
            $this->DrawAreaSeries();
          } else {
            $this->DrawArea();
          }
          break;
        case "linepoints":
          $this->DrawPlotBorder();
          $this->DrawLabels();
          if ( $this->data_type == "text-data") {
            $this->DrawLines();
            $this->DrawDots();
          } elseif ( $this->data_type == "data-data-error") {
            $this->DrawLinesError();
            $this->DrawDotsError();
          } else {
            $this->DrawLines();
            $this->DrawDots();
          }
          break;
        case "points";
          $this->DrawPlotBorder();
          $this->DrawLabels();
          if ( $this->data_type == "text-data") {
            $this->DrawDots();
          } elseif ( $this->data_type == "data-data-error") {
            $this->DrawDotsError();
          } else {
            $this->DrawDots();
          }
          break;
        case "pie":
          $this->DrawPieChart();
          $this->DrawLabels();
          break;
        default:
          $this->DrawPlotBorder();
          $this->DrawLabels();
          $this->DrawBars();
          break;
      }

      if ($this->legend) {
        $this->DrawLegend($this->legend_x_pos,$this->legend_y_pos,'');
      }

    }
    if ($this->print_image == 1) {
      $this->PrintImage();
    }
  }
195860
public function drawBezier($X1, $Y1, $X2, $Y2, $Xv1, $Yv1, $Xv2, $Yv2, array $Format = [])
    {
        $R = isset($Format["R"]) ? $Format["R"] : 0;
        $G = isset($Format["G"]) ? $Format["G"] : 0;
        $B = isset($Format["B"]) ? $Format["B"] : 0;
        $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 100;
        $ShowC = isset($Format["ShowControl"]) ? $Format["ShowControl"] : false;
        $Segments = isset($Format["Segments"]) ? $Format["Segments"] : null;
        $Ticks = isset($Format["Ticks"]) ? $Format["Ticks"] : null;
        $NoDraw = isset($Format["NoDraw"]) ? $Format["NoDraw"] : false;
        $PathOnly = isset($Format["PathOnly"]) ? $Format["PathOnly"] : false;
        $Weight = isset($Format["Weight"]) ? $Format["Weight"] : null;
        $DrawArrow = isset($Format["DrawArrow"]) ? $Format["DrawArrow"] : false;
        $ArrowSize = isset($Format["ArrowSize"]) ? $Format["ArrowSize"] : 10;
        $ArrowRatio = isset($Format["ArrowRatio"]) ? $Format["ArrowRatio"] : .5;
        $ArrowTwoHeads = isset($Format["ArrowTwoHeads"]) ? $Format["ArrowTwoHeads"] : false;

        if ($Segments == null) {
            $Length = $this->getLength($X1, $Y1, $X2, $Y2);
            $Precision = ($Length * 125) / 1000;
        } else {
            $Precision = $Segments;
        }
        $P[0]["X"] = $X1;
        $P[0]["Y"] = $Y1;
        $P[1]["X"] = $Xv1;
        $P[1]["Y"] = $Yv1;
        $P[2]["X"] = $Xv2;
        $P[2]["Y"] = $Yv2;
        $P[3]["X"] = $X2;
        $P[3]["Y"] = $Y2;

        /* Compute the bezier points */
        $Q = [];
        $ID = 0;
        for ($i = 0; $i <= $Precision; $i = $i + 1) {
            $u = $i / $Precision;

            $C = [];
            $C[0] = (1 - $u) * (1 - $u) * (1 - $u);
            $C[1] = ($u * 3) * (1 - $u) * (1 - $u);
            $C[2] = 3 * $u * $u * (1 - $u);
            $C[3] = $u * $u * $u;

            for ($j = 0; $j <= 3; $j++) {
                if (!isset($Q[$ID])) {
                    $Q[$ID] = [];
                }
                if (!isset($Q[$ID]["X"])) {
                    $Q[$ID]["X"] = 0;
                }
                if (!isset($Q[$ID]["Y"])) {
                    $Q[$ID]["Y"] = 0;
                }

                $Q[$ID]["X"] = $Q[$ID]["X"] + $P[$j]["X"] * $C[$j];
                $Q[$ID]["Y"] = $Q[$ID]["Y"] + $P[$j]["Y"] * $C[$j];
            }
            $ID++;
        }
        $Q[$ID]["X"] = $X2;
        $Q[$ID]["Y"] = $Y2;

        if (!$NoDraw) {
            /* Display the control points */
            if ($ShowC && !$PathOnly) {
                $Xv1 = floor($Xv1);
                $Yv1 = floor($Yv1);
                $Xv2 = floor($Xv2);
                $Yv2 = floor($Yv2);

                $this->drawLine($X1, $Y1, $X2, $Y2, ["R" => 0, "G" => 0, "B" => 0, "Alpha" => 30]);

                $MyMarkerSettings = [
                    "R" => 255,
                    "G" => 0,
                    "B" => 0,
                    "BorderR" => 255,
                    "BorderB" => 255,
                    "BorderG" => 255,
                    "Size" => 4
                ];
                $this->drawRectangleMarker($Xv1, $Yv1, $MyMarkerSettings);
                $this->drawText($Xv1 + 4, $Yv1, "v1");
                $MyMarkerSettings = [
                    "R" => 0,
                    "G" => 0,
                    "B" => 255,
                    "BorderR" => 255,
                    "BorderB" => 255,
                    "BorderG" => 255,
                    "Size" => 4
                ];
                $this->drawRectangleMarker($Xv2, $Yv2, $MyMarkerSettings);
                $this->drawText($Xv2 + 4, $Yv2, "v2");
            }

            /* Draw the bezier */
            $LastX = null;
            $LastY = null;
            $Cpt = null;
            $Mode = null;
            $ArrowS = [];
            foreach ($Q as $Point) {
                $X = $Point["X"];
                $Y = $Point["Y"];

                /* Get the first segment */
                if (!count($ArrowS) && $LastX != null && $LastY != null) {
                    $ArrowS["X2"] = $LastX;
                    $ArrowS["Y2"] = $LastY;
                    $ArrowS["X1"] = $X;
                    $ArrowS["Y1"] = $Y;
                }

                if ($LastX != null && $LastY != null && !$PathOnly) {
                    list($Cpt, $Mode) = $this->drawLine(
                        $LastX,
                        $LastY,
                        $X,
                        $Y,
                        [
                            "R" => $R,
                            "G" => $G,
                            "B" => $B,
                            "Alpha" => $Alpha,
                            "Ticks" => $Ticks,
                            "Cpt" => $Cpt,
                            "Mode" => $Mode,
                            "Weight" => $Weight
                        ]
                    );
                }
                /* Get the last segment */
                $ArrowE["X1"] = $LastX;
                $ArrowE["Y1"] = $LastY;
                $ArrowE["X2"] = $X;
                $ArrowE["Y2"] = $Y;

                $LastX = $X;
                $LastY = $Y;
            }

            if ($DrawArrow && !$PathOnly) {
                $ArrowSettings = [
                    "FillR" => $R,
                    "FillG" => $G,
                    "FillB" => $B,
                    "Alpha" => $Alpha,
                    "Size" => $ArrowSize,
                    "Ratio" => $ArrowRatio
                ];
                if ($ArrowTwoHeads) {
                    $this->drawArrow($ArrowS["X1"], $ArrowS["Y1"], $ArrowS["X2"], $ArrowS["Y2"], $ArrowSettings);
                }
                $this->drawArrow($ArrowE["X1"], $ArrowE["Y1"], $ArrowE["X2"], $ArrowE["Y2"], $ArrowSettings);
            }
        }
        return $Q;
    }
160452
function filled_rectangle($x1, $y1, $w, $h, $color) {

    $this->_set_fill_colour($color);
    
    // FIXME: ugh, need to handle styles here
    $this->_pdf->rect($x1, $y1, $w, $h, "F");
  }