draw a curve (for border radius)

@access protected
@param  array $pt
@param  array $color
480163
protected function _drawCurve($pt, $color)
    {
        $this->pdf->SetFillColorArray($color);

        if (count($pt) == 10) {
            $this->pdf->drawCurve($pt[0], $pt[1], $pt[2], $pt[3], $pt[4], $pt[5], $pt[6], $pt[7], $pt[8], $pt[9]);
        } else {
            $this->pdf->drawCorner($pt[0], $pt[1], $pt[2], $pt[3], $pt[4], $pt[5], $pt[6], $pt[7]);
        }
    }
933262
public function color($color)
    {
        if (is_array($color)) { // rgb
            [$r, $g, $b] = $color;
            $r = substr('0' . dechex($r), -2);
            $g = substr('0' . dechex($g), -2);
            $b = substr('0' . dechex($b), -2);
            $color = '#' . $r . $g . $b;
        }
        $this->color = $color;
        return $this;
    }
1091523
public static void fillCircle(Graphics g, Point center, int diameter, Color color){
		fillCircle(g, (int) center.x, (int) center.y, diameter, color);
	}
1210966
private void drawPixel(Color color, long fileOffset) {
		long size = withMinLength(0);
		drawPixels(color, fileOffset, size);
	}
864996
public function _roundedCorners(int $radius, string $background_color, int $aa_level = 4)
    {
        if ($aa_level > 1) {
            $radius *= $aa_level;
        }

        $ih_corner = imagecreatetruecolor($radius, $radius);

        $r_dec = hexdec($background_color[0] . $background_color[1]);
        $g_dec = hexdec($background_color[2] . $background_color[3]);
        $b_dec = hexdec($background_color[4] . $background_color[5]);

        $cr_clear = imagecolorallocate($ih_corner, ($r_dec ? $r_dec - 1 : 1), ($g_dec ? $g_dec - 1 : 1), ($b_dec ? $b_dec - 1 : 1));
        $cr_solid = imagecolorallocate($ih_corner, $r_dec, $g_dec, $b_dec);
        imagecolortransparent($ih_corner, $cr_clear);

        imagefill($ih_corner, 0, 0, $cr_solid);
        imagefilledellipse($ih_corner, $radius, $radius, $radius * 2, $radius * 2, $cr_clear);

        if ($aa_level > 1) {
            $new_radius = $radius / $aa_level;
            $res = imagecreatetruecolor($new_radius, $new_radius);

            if ($this->image_type == 3) {
                imagealphablending($res, false);
                imagesavealpha($res, true);
            }

            imagecolortransparent($res, $cr_clear);
            imagecopyresampled($res, $ih_corner, 0, 0, 0, 0, $new_radius, $new_radius, $radius, $radius);
            imagedestroy($ih_corner);
            $ih_corner = $res;
            $radius = $new_radius;
        }

        $this->image_height = imagesy($this->image_resource);
        $this->image_width = imagesx($this->image_resource);

        imagecopymerge($this->image_resource, $ih_corner, 0, 0, 0, 0, $radius, $radius, 100);

        $ih_corner = imagerotate($ih_corner, 90, 0);
        imagecopymerge($this->image_resource, $ih_corner, 0, $this->image_height - $radius, 0, 0, $radius, $radius, 100);

        $ih_corner = imagerotate($ih_corner, 90, 0);
        imagecopymerge($this->image_resource, $ih_corner, $this->image_width - $radius, $this->image_height - $radius, 0, 0, $radius, $radius, 100);

        $ih_corner = imagerotate($ih_corner, 90, 0);
        imagecopymerge($this->image_resource, $ih_corner, $this->image_width - $radius, 0, 0, 0, $radius, $radius, 100);

        return $this;
    }
597303
public void drawLine(int x0, int y0, int x1, int y1, Color c) {
        int colorRGB = c.getRGB();
        int dy = y1 - y0;
        int dx = x1 - x0;
        int stepx, stepy;
        int fraction;


        if (dy < 0) {
            dy = -dy;
            stepy = -1;
        } else {
            stepy = 1;
        }
        if (dx < 0) {
            dx = -dx;
            stepx = -1;
        } else {
            stepx = 1;
        }
        dy <<= 1;                            // dy is now 2*dy
        dx <<= 1;                            // dx is now 2*dx

        setIntColor(x0, y0, colorRGB);

        if (dx > dy) {
            fraction = dy - (dx >> 1);    // same as 2*dy - dx
            while (x0 != x1) {
                if (fraction >= 0) {
                    y0 += stepy;
                    fraction -= dx;        // same as fraction -= 2*dx
                }
                x0 += stepx;
                fraction += dy;                // same as fraction -= 2*dy
                setIntColor(x0, y0, colorRGB);
            }
        } else {
            fraction = dx - (dy >> 1);
            while (y0 != y1) {
                if (fraction >= 0) {
                    x0 += stepx;
                    fraction -= dy;
                }
                y0 += stepy;
                fraction += dx;
                setIntColor(x0, y0, colorRGB);
            }
        }
    }
100680
public void setPointerColor(final ColorDef POINTER_COLOR) {
        getModel().setPointerColor(POINTER_COLOR);
        init(getInnerBounds().width, getInnerBounds().height);
        repaint(getInnerBounds());
    }
564390
public void drawRect(int x, int y, int w, int h, Color c) {
        int color = c.getRGB();
        for (int i = x; i < x + w; i++) {
            setIntColor(i, y, color);
            setIntColor(i, y + (h - 1), color);
        }

        for (int i = y; i < y + h; i++) {
            setIntColor(x, i, color);
            setIntColor(x + (w - 1), i, color);
        }
    }
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();
    }
  }
1248725
function(geometry, style, featureId) {
        if(style.graphic !== false) {
            if(style.externalGraphic) {
                this.drawExternalGraphic(geometry, style, featureId);
            } else if (style.graphicName && (style.graphicName != "circle")) {
                this.drawNamedSymbol(geometry, style, featureId);
            } else {
                var pt = this.getLocalXY(geometry);
                var p0 = pt[0];
                var p1 = pt[1];
                if(!isNaN(p0) && !isNaN(p1)) {
                    var twoPi = Math.PI*2;
                    var radius = style.pointRadius;
                    if(style.fill !== false) {
                        this.setCanvasStyle("fill", style);
                        this.canvas.beginPath();
                        this.canvas.arc(p0, p1, radius, 0, twoPi, true);
                        this.canvas.fill();
                        if (this.hitDetection) {
                            this.setHitContextStyle("fill", featureId, style);
                            this.hitContext.beginPath();
                            this.hitContext.arc(p0, p1, radius, 0, twoPi, true);
                            this.hitContext.fill();
                        }
                    }

                    if(style.stroke !== false) {
                        this.setCanvasStyle("stroke", style);
                        this.canvas.beginPath();
                        this.canvas.arc(p0, p1, radius, 0, twoPi, true);
                        this.canvas.stroke();
                        if (this.hitDetection) {
                            this.setHitContextStyle("stroke", featureId, style);
                            this.hitContext.beginPath();
                            this.hitContext.arc(p0, p1, radius, 0, twoPi, true);
                            this.hitContext.stroke();
                        }
                        this.setCanvasStyle("reset");
                    }
                }
            }
        }
    }
1057071
public function border($color = '#000', $thickness = 5): Image
	{
		$this->processor->border($color, $thickness);

		return $this;
	}
708456
public function line($x1, $y1, $x2, $y2, $color, $width, $style = array())
    {
        $this->_set_stroke_color($color);
        $this->_set_line_style($width, "butt", "", $style);

        $this->_pdf->line($x1, $this->y($y1),
            $x2, $this->y($y2));
        $this->_set_line_transparency("Normal", $this->_current_opacity);
    }
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;
    }
1181535
private void drawCircle(Canvas canvas, float x, float y, int color, float circleScale) {
        dayPaint.setColor(color);
        if (animationStatus == ANIMATE_INDICATORS) {
            float maxRadius = circleScale * bigCircleIndicatorRadius * 1.4f;
            drawCircle(canvas, growfactorIndicator > maxRadius ? maxRadius: growfactorIndicator, x, y - (textHeight / 6));
        } else {
            drawCircle(canvas, circleScale * bigCircleIndicatorRadius, x, y - (textHeight / 6));
        }
    }
942388
protected function _set_fill_colour($colour) {
    $colour[0] = round(255 * $colour[0]);
    $colour[1] = round(255 * $colour[1]);
    $colour[2] = round(255 * $colour[2]);

    if ( is_null($this->_last_fill_color) || $color != $this->_last_fill_color ) {
      $this->_pdf->SetDrawColor($color[0],$color[1],$color[2]);
      $this->_last_fill_color = $color;
    }

  }
757066
public function draw(int $from = 5): void
	{
		$dots = 0;

		$fromLength = strlen($from);

		$totalLength = $fromLength + 5;

		do
		{
			do
			{
				$numbers = str_pad($from, $fromLength, '0', STR_PAD_LEFT);

				$this->output->write("\r" . str_pad($numbers . ' ' . str_repeat('.', $dots) . ' ', $totalLength, ' '));

				$this->sleep();
			}
			while($dots++ < 3);

			$dots = 0;
		}
		while($from-- > 1);

		$this->output->write("\r" . str_repeat(' ', $totalLength) . "\r");
	}
478096
def draw_circle(self, color, world_loc, world_radius, thickness=0):
    """"""
    if world_radius > 0:
      center = self.world_to_surf.fwd_pt(world_loc).round()
      radius = max(1, int(self.world_to_surf.fwd_dist(world_radius)))
      pygame.draw.circle(self.surf, color, center, radius,
                         thickness if thickness < radius else 0)