Draws a filled rectangle at x1,y1 with width w and height h

See {@link Style::munge_colour()} for the format of the colour array.

@param float $x1
@param float $y1
@param float $w
@param float $h
@param array $color
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");
  }
562680
private function getPixel($x, $y, Color $color)
    {
        return (new Rectangle($x * 80 + 40, $y * 80 + 40, 80, 80))
            ->setFillColor($color)
            ->setStrokeWidth(0);
    }
198971
protected void drawCheckedState(Canvas canvas, int w, int h) {
        int x = w / 2;
        int y = h / 2;

        canvas.drawCircle(x, y,
                mRadius - (mShadowRadius * 1.5f),
                mCheckedBackgroundPaint);
        canvas.save();

        int shortStrokeHeight = (int) (mLongStrokeHeight * .4f);
        int halfH = (int) (mLongStrokeHeight * .5f);
        int offset = (int)(shortStrokeHeight * .3f);
        int sx = x + offset;
        int sy = y - offset;
        mPath.reset();
        mPath.moveTo(sx, sy - halfH);
        mPath.lineTo(sx, sy + halfH); // draw long stroke
        mPath.moveTo(sx + (getCheckMarkStrokeWidthInPixels() * .5f), sy + halfH);
        mPath.lineTo(sx - shortStrokeHeight, sy + halfH); // draw short stroke

        // Rotates the canvas to draw an angled check mark
        canvas.rotate(45f, x, y);
        canvas.drawPath(mPath, mCheckMarkPaint);
        // Restore the canvas to previously saved state
        canvas.restore();
    }
951916
public function drawBox($x1, $y1, $z1, $x2, $y2, $z2)
	{
		$this->setCode("(box)");
		$this->setCode("G0 X{$x1} Y{$y1} Z{$this->spindleAxisStartPosition} (move to spindle axis start position)");
		$this->setCode("G1 Z{$z1}");
		$this->setCode("G1 X{$x1} Y{$y1} Z{$z1}");
		$this->setCode("G1 Y{$y2}");
		$this->setCode("G1 X{$x2}");
		$this->setCode("G1 Y{$y1}");
		$this->setCode("G1 X{$x1}");
		$this->setCode("G0 Z{$z2}");
		$this->setCode("(/box)\n");

		return $this;
	}
708448
public function drawCell($w, $h = 0, $txt = '', $implied_styles = "PBF", $ln = 0, $align = '', $valign = "T", $link = '')
    {
        // If a cell contains a line break like a "<BR>" then convert it to new line
        $txt = preg_replace("/<BR>/i", "\n", $txt);
        // Calculate cell height as string width divided by width
        $str_width = $this->document->GetStringWidth($txt);
        $numlines = ceil($this->document->GetStringWidth($txt) / ($w - 1));
        $numlines = $this->document->NbLines($w, $txt);
        $cellheight = ceil($numlines * $h);

        if ($this->draw_mode == "CALCULATE") {
            if ($cellheight > $this->calculated_line_height) {
                $this->calculated_line_height = $cellheight;
            }

        }

        // Add padding
        $toppad = 0;
        $bottompad = 0;
        if (strstr($implied_styles, "P")) {
            $padding = end($this->stylestack["padding"]);
            $toppad = $padding[0];
            $bottompad = $padding[2];
        }

        $fill = false;
        if (strstr($implied_styles, "F")) {
            // Add border and bg color
            $fill = end($this->stylestack["isfilling"]);
        }

        $borderwidth = false;
        if (strstr($implied_styles, "B")) {
            $borderwidth = end($this->stylestack["border-width"]);
            $border = end($this->stylestack["border-style"]);
            if ($border != "none") {
                $border = 1;
            } else {
                $borderwidth = "false";
            }

        }

        // Store current position so we can jump back after cell draw
        $y = $this->document->GetY();

        // To cater for multiline values, jump to bottom of line + padding -
        // cell height
        if ($valign == "T") {
            $jumpy = $toppad;
        } else if ($valign == "B") {
            $jumpy = $toppad + $this->calculated_line_height - $cellheight;
        } else if ($valign == "C") {
            $jumpy = (($toppad + $this->calculated_line_height + $bottompad) - $cellheight) / 2;
        }

        if ($this->draw_mode == "CALCULATE") {
            $fill_line_height = $toppad + $this->calculated_line_height + $bottompad;
            if ($this->max_line_height < $fill_line_height) {
                $this->max_line_height = $fill_line_height;
            }

            return;
        }

        if ($toppad) {
            $tmpborder = "";
            if (preg_match("/T/", $borderwidth)) {
                $tmpborder = preg_replace("/B/", "", $borderwidth);
                $borderwidth = preg_replace("/T/", "", $borderwidth);
            }

            $prevx = $this->document->GetX();
            $this->document->MultiCell($w, $toppad, "", $tmpborder, $align, $fill, $link);
            $this->setPosition($prevx, false);
        }

        if ($bottompad) {
            $tmpborder = "";
            if (preg_match("/B/", $borderwidth)) {
                $tmpborder = preg_replace("/T/", "", $borderwidth);
                $borderwidth = preg_replace("/B/", "", $borderwidth);
            }

            $prevx = $this->document->GetX();
            $this->document->MultiCell($w, $h + $bottompad, "", $tmpborder, $align, $fill, $link);
            $this->setPosition($prevx, false);
        }

        $this->setPosition(false, $y + $jumpy);

        // Link in a PDF must include a full URL contain http:// element
        // drilldown link of web url can be relative .. so prepend required elements
        if ($link) {
            if (!preg_match("/^http:\/\//", $link) && !preg_match("/^\//", $link)) {
                $link = "http://" . $_SERVER["HTTP_HOST"] . dirname($this->query->url_path_to_reportico_runner) . "/" . $link;
            }

            if (preg_match("/^\//", $link)) {
                $link = ReporticoApp::getConfig("http_urlhost"). "/" . $link;
            }

        }
        $this->document->MultiCell($w, $h, $txt, $borderwidth, $align, $fill, $link);
        $cell_height = $this->document->GetY() - $y;

        if ($cell_height > $this->current_line_height) {
            $this->current_line_height = $cell_height;
        }

        // Jump back
        $this->setPosition(false, $y);
    }
583074
@Override public void layoutChildren(double x, double y, double w, double h) {
        super.layoutChildren(x, y, w, h);
        if(Double.compare(bars[0].getLayoutBounds().getWidth(), 0) == 0) resize();
    }
453957
public function drawRoundedFilledRectangle($X1, $Y1, $X2, $Y2, $Radius, array $Format = [])
    {
        $R = isset($Format["R"]) ? $Format["R"] : 0;
        $G = isset($Format["G"]) ? $Format["G"] : 0;
        $B = isset($Format["B"]) ? $Format["B"] : 0;
        $BorderR = isset($Format["BorderR"]) ? $Format["BorderR"] : -1;
        $BorderG = isset($Format["BorderG"]) ? $Format["BorderG"] : -1;
        $BorderB = isset($Format["BorderB"]) ? $Format["BorderB"] : -1;
        $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 100;
        $Surrounding = isset($Format["Surrounding"]) ? $Format["Surrounding"] : null;

        /* Temporary fix for AA issue */
        $Y1 = floor($Y1);
        $Y2 = floor($Y2);
        $X1 = floor($X1);
        $X2 = floor($X2);

        if ($Surrounding != null) {
            $BorderR = $R + $Surrounding;
            $BorderG = $G + $Surrounding;
            $BorderB = $B + $Surrounding;
        }
        if ($BorderR == -1) {
            $BorderR = $R;
            $BorderG = $G;
            $BorderB = $B;
        }

        list($X1, $Y1, $X2, $Y2) = $this->fixBoxCoordinates($X1, $Y1, $X2, $Y2);

        if ($X2 - $X1 < $Radius * 2) {
            $Radius = floor((($X2 - $X1)) / 4);
        }
        if ($Y2 - $Y1 < $Radius * 2) {
            $Radius = floor((($Y2 - $Y1)) / 4);
        }

        $RestoreShadow = $this->Shadow;
        if ($this->Shadow && $this->ShadowX != 0 && $this->ShadowY != 0) {
            $this->Shadow = false;
            $this->drawRoundedFilledRectangle(
                $X1 + $this->ShadowX,
                $Y1 + $this->ShadowY,
                $X2 + $this->ShadowX,
                $Y2 + $this->ShadowY,
                $Radius,
                [
                    "R" => $this->ShadowR,
                    "G" => $this->ShadowG,
                    "B" => $this->ShadowB,
                    "Alpha" => $this->Shadowa
                ]
            );
        }

        $Color = ["R" => $R, "G" => $G, "B" => $B, "Alpha" => $Alpha, "NoBorder" => true];

        if ($Radius <= 0) {
            $this->drawFilledRectangle($X1, $Y1, $X2, $Y2, $Color);
            return 0;
        }

        $YTop = $Y1 + $Radius;
        $YBottom = $Y2 - $Radius;

        $Step = 360 / (2 * PI * $Radius);
        $Positions = [];
        $Radius--;
        $MinY = null;
        $MaxY = null;
        for ($i = 0; $i <= 90; $i = $i + $Step) {
            $Xp1 = cos(($i + 180) * PI / 180) * $Radius + $X1 + $Radius;
            $Xp2 = cos(((90 - $i) + 270) * PI / 180) * $Radius + $X2 - $Radius;
            $Yp = floor(sin(($i + 180) * PI / 180) * $Radius + $YTop);
            if (null === $MinY || $Yp > $MinY) {
                $MinY = $Yp;
            }

            if ($Xp1 <= floor($X1)) {
                $Xp1++;
            }
            if ($Xp2 >= floor($X2)) {
                $Xp2--;
            }
            $Xp1++;

            if (!isset($Positions[$Yp])) {
                $Positions[$Yp]["X1"] = $Xp1;
                $Positions[$Yp]["X2"] = $Xp2;
            } else {
                $Positions[$Yp]["X1"] = ($Positions[$Yp]["X1"] + $Xp1) / 2;
                $Positions[$Yp]["X2"] = ($Positions[$Yp]["X2"] + $Xp2) / 2;
            }

            $Xp1 = cos(($i + 90) * PI / 180) * $Radius + $X1 + $Radius;
            $Xp2 = cos((90 - $i) * PI / 180) * $Radius + $X2 - $Radius;
            $Yp = floor(sin(($i + 90) * PI / 180) * $Radius + $YBottom);
            if (null === $MaxY || $Yp < $MaxY) {
                $MaxY = $Yp;
            }

            if ($Xp1 <= floor($X1)) {
                $Xp1++;
            }
            if ($Xp2 >= floor($X2)) {
                $Xp2--;
            }
            $Xp1++;

            if (!isset($Positions[$Yp])) {
                $Positions[$Yp]["X1"] = $Xp1;
                $Positions[$Yp]["X2"] = $Xp2;
            } else {
                $Positions[$Yp]["X1"] = ($Positions[$Yp]["X1"] + $Xp1) / 2;
                $Positions[$Yp]["X2"] = ($Positions[$Yp]["X2"] + $Xp2) / 2;
            }
        }

        $ManualColor = $this->allocateColor($this->Picture, $R, $G, $B, $Alpha);
        foreach ($Positions as $Yp => $Bounds) {
            $X1 = $Bounds["X1"];
            $X1Dec = $this->getFirstDecimal($X1);
            if ($X1Dec != 0) {
                $X1 = floor($X1) + 1;
            }
            $X2 = $Bounds["X2"];
            $X2Dec = $this->getFirstDecimal($X2);
            if ($X2Dec != 0) {
                $X2 = floor($X2) - 1;
            }
            imageline($this->Picture, $X1, $Yp, $X2, $Yp, $ManualColor);
        }
        $this->drawFilledRectangle($X1, $MinY + 1, floor($X2), $MaxY - 1, $Color);

        $Radius++;
        $this->drawRoundedRectangle(
            $X1,
            $Y1,
            $X2 + 1,
            $Y2 - 1,
            $Radius,
            ["R" => $BorderR, "G" => $BorderG, "B" => $BorderB, "Alpha" => $Alpha]
        );

        $this->Shadow = $RestoreShadow;
    }
322962
public boolean intersects(double x, double y, double w, double h) {
		return intersects(new Rectangle2D.Double(x, y, w, h));
	}
336790
protected function drawSingleBar($im, $color) {
        $this->drawFilledRectangle($im, $this->positionX, 0, $this->positionX, $this->thickness - 1, $color);
    }
1028842
public static function Init( int $x, int $y, int $width, int $height ) : Rectangle
   {

      return new Rectangle(
         new Point( $x, $y ),
         new Size( $width, $height )
      );

   }
568738
public static Element svgRect(Document document, double x, double y, double w, double h) {
    Element rect = SVGUtil.svgElement(document, SVGConstants.SVG_RECT_TAG);
    SVGUtil.setAtt(rect, SVGConstants.SVG_X_ATTRIBUTE, x);
    SVGUtil.setAtt(rect, SVGConstants.SVG_Y_ATTRIBUTE, y);
    SVGUtil.setAtt(rect, SVGConstants.SVG_WIDTH_ATTRIBUTE, w);
    SVGUtil.setAtt(rect, SVGConstants.SVG_HEIGHT_ATTRIBUTE, h);
    return rect;
  }
889727
public function getDimension($w, $h) {
        $w += 65 * 3;
        $h += $this->thickness;

        // We remove the white on the right
        $w -= 1.56;

        if ($this->quietZone) {
            $w += 18;
            $h += 4;
        }

        return parent::getDimension($w, $h);
    }
1298114
public void drawRect(float x1, float y1, float width, float height) {
		float lineWidth = getLineWidth();
		
		drawLine(x1,y1,x1+width,y1);
		drawLine(x1+width,y1,x1+width,y1+height);
		drawLine(x1+width,y1+height,x1,y1+height);
		drawLine(x1,y1+height,x1,y1);
	}
1257928
@Override
	public void draw(float x,float y,float width,float height) {
		init();
		draw(x,y,width,height,Color.white);
	}
970867
function (x1, y1, w, h, color, c)
    {
        _c = c || _c
        if (color)
        {
            _c.fillStyle = color
        }
        box(x1 * _scale, y1 * _scale, w * _scale, h * _scale)
    }
217043
function filledRectangle($x1, $y1, $width, $height)
    {
        $this->addContent(sprintf("\n%.3F %.3F %.3F %.3F re f", $x1, $y1, $width, $height));
    }
696181
public function drawLine($x1, $y1, $x2, $y2)
    {
        $this->convertCoordinatesFromUserSpace($x1, $y1);
        $this->convertCoordinatesFromUserSpace($x2, $y2);
        list($y1, $y2) = array($y2, $y1);
        return parent::drawLine($x1, $y1, $x2, $y2);
    }