Draw a string

@param x
The x position to draw the string
@param y
The y position to draw the string
@param whatchars
The string to draw
191226
public void drawString(float x, float y, String whatchars) {
		drawString(x, y, whatchars, org.newdawn.slick.Color.white);
	}
1213647
private static void drawLine(int... widths) {
    for (int width : widths) {
      for (int i = 1; i < width; i++) {
        System.out.print('-');
      }
      System.out.print('+');
    }
    System.out.println();
  }
49231
private void drawXLabel(Graphics2D chartGraphics) {
    if (xAxisLabel != null) {
      // Strings are drawn from the baseline position of the leftmost char.
      int yPosXAxisLabel = chartSize.height - (margin / 2) - xAxisLabelDescent;
      // TODO This will need to be updated if the y-axis values/label can be moved to the right.
      int xPosXAxisLabel = heatMapC.x - (xAxisLabelSize.width / 2);

      chartGraphics.setFont(axisLabelsFont);
      chartGraphics.setColor(axisLabelColour);
      chartGraphics.drawString(xAxisLabel, xPosXAxisLabel, yPosXAxisLabel);
    }
  }
745068
private void drawXValues(Graphics2D chartGraphics) {
    if (!showXAxisValues) {
      return;
    }

    chartGraphics.setColor(axisValuesColour);

    for (int i = 0; i < xValues.length; i++) {
      if (i % xAxisValuesFrequency != 0) {
        continue;
      }

      String xValueStr = xValues[i].toString();

      chartGraphics.setFont(axisValuesFont);
      FontMetrics metrics = chartGraphics.getFontMetrics();

      int valueWidth = metrics.stringWidth(xValueStr);

      if (xValuesHorizontal) {
        // Draw the value with whatever font is now set.
        int valueXPos = (i * cellSize.width) + ((cellSize.width / 2) - (valueWidth / 2));
        valueXPos += heatMapTL.x;
        int valueYPos = heatMapBR.y + metrics.getAscent() + 1;

        chartGraphics.drawString(xValueStr, valueXPos, valueYPos);
      }
      else {
        int valueXPos = heatMapTL.x + (i * cellSize.width)
            + ((cellSize.width / 2) + (xAxisValuesHeight / 2));
        int valueYPos = heatMapBR.y + axisThickness + valueWidth;

        // Create 270 degree rotated transform.
        AffineTransform transform = chartGraphics.getTransform();
        AffineTransform originalTransform = (AffineTransform) transform.clone();
        transform.rotate(Math.toRadians(270), valueXPos, valueYPos);
        chartGraphics.setTransform(transform);

        // Draw the string.
        chartGraphics.drawString(xValueStr, valueXPos, valueYPos);

        // Revert to original transform before rotation.
        chartGraphics.setTransform(originalTransform);
      }
    }
  }
1075871
@Override
    public void drawText(Graphics2D graphics, int width, int height) {
        int textLength = (int) (width * textWidthPercent);
        // 计算水印字体大小
        int fontsize = textLength / text.length();
        if(fontsize < minFontSize) {
            return ;
        }

        graphics.setFont(new Font(defaultFont.getFontName(), Font.PLAIN, fontsize));
        graphics.setColor(fontColor);
        graphics.drawString(text, (int)(width * xFactor), (int)(height * yFactor));
    }
149305
def draw(self, y, **kwargs):
        

        # draw the histogram
        hist, bin_edges = np.histogram(y, bins=self.bins)
        self.bin_edges_ = bin_edges
        self.ax.hist(y, bins=self.bins, color=kwargs.pop("color", "#6897bb"), **kwargs)

        # add vetical line with binning reference values
        plt.vlines(bin_edges,0,max(hist),colors=kwargs.pop("colors", "r"))
630765
void draw(Canvas canvas) {
        mCanvasRect.set(0.0f, 0.0f, canvas.getWidth(), canvas.getHeight());
        switch (mShape) {
            case SHAPE_RECTANGLE:
                canvas.drawRect(mCanvasRect, mCanvasPaint);
                break;
            case SHAPE_OVAL:
                canvas.drawOval(mCanvasRect, mCanvasPaint);
                break;
            case SHAPE_STAR_3_VERTICES:
            case SHAPE_STAR_4_VERTICES:
            case SHAPE_STAR_5_VERTICES:
            case SHAPE_STAR_6_VERTICES:
                drawStar(canvas, mShape);
                break;
            case SHAPE_HEART:
                drawHeart(canvas);
                break;
        }
    }
1182603
def display_char(self,x,y,char):
	
	self.send_cmd("T"+str(x+1)+","+str(y+1)+","+char)
502318
protected void drawBase (Graphics2D gfx, int x, int y)
    {
        gfx.fillRoundRect(
            x, y, _size.width - 1, _size.height - 1, _dia, _dia);
    }
229957
public Canvas draw (Drawable image, float x, float y, float w, float h) {
    image.draw(gc(), x, y, w, h);
    isDirty = true;
    return this;
  }
1364435
function drawLinearTickStroke(context, sX, sY, eX, eY) {
    context.beginPath();
    context.moveTo(sX, sY);
    context.lineTo(eX, eY);
    context.stroke();
    context.closePath();
}
38848
public function drawText($X, $Y, $Text, array $Format = [])
    {
        $R = isset($Format["R"]) ? $Format["R"] : $this->FontColorR;
        $G = isset($Format["G"]) ? $Format["G"] : $this->FontColorG;
        $B = isset($Format["B"]) ? $Format["B"] : $this->FontColorB;
        $Angle = isset($Format["Angle"]) ? $Format["Angle"] : 0;
        $Align = isset($Format["Align"]) ? $Format["Align"] : TEXT_ALIGN_BOTTOMLEFT;
        $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : $this->FontColorA;
        $FontName = isset($Format["FontName"]) ? $this->loadFont($Format["FontName"], 'fonts') : $this->FontName;
        $FontSize = isset($Format["FontSize"]) ? $Format["FontSize"] : $this->FontSize;
        $ShowOrigine = isset($Format["ShowOrigine"]) ? $Format["ShowOrigine"] : false;
        $TOffset = isset($Format["TOffset"]) ? $Format["TOffset"] : 2;
        $DrawBox = isset($Format["DrawBox"]) ? $Format["DrawBox"] : false;
        $BorderOffset = isset($Format["BorderOffset"]) ? $Format["BorderOffset"] : 6;
        $BoxRounded = isset($Format["BoxRounded"]) ? $Format["BoxRounded"] : false;
        $RoundedRadius = isset($Format["RoundedRadius"]) ? $Format["RoundedRadius"] : 6;
        $BoxR = isset($Format["BoxR"]) ? $Format["BoxR"] : 255;
        $BoxG = isset($Format["BoxG"]) ? $Format["BoxG"] : 255;
        $BoxB = isset($Format["BoxB"]) ? $Format["BoxB"] : 255;
        $BoxAlpha = isset($Format["BoxAlpha"]) ? $Format["BoxAlpha"] : 50;
        $BoxSurrounding = isset($Format["BoxSurrounding"]) ? $Format["BoxSurrounding"] : "";
        $BoxBorderR = isset($Format["BoxR"]) ? $Format["BoxR"] : 0;
        $BoxBorderG = isset($Format["BoxG"]) ? $Format["BoxG"] : 0;
        $BoxBorderB = isset($Format["BoxB"]) ? $Format["BoxB"] : 0;
        $BoxBorderAlpha = isset($Format["BoxAlpha"]) ? $Format["BoxAlpha"] : 50;
        $NoShadow = isset($Format["NoShadow"]) ? $Format["NoShadow"] : false;

        $Shadow = $this->Shadow;
        if ($NoShadow) {
            $this->Shadow = false;
        }

        if ($BoxSurrounding != "") {
            $BoxBorderR = $BoxR - $BoxSurrounding;
            $BoxBorderG = $BoxG - $BoxSurrounding;
            $BoxBorderB = $BoxB - $BoxSurrounding;
            $BoxBorderAlpha = $BoxAlpha;
        }

        if ($ShowOrigine) {
            $MyMarkerSettings = [
                "R" => 255,
                "G" => 0,
                "B" => 0,
                "BorderR" => 255,
                "BorderB" => 255,
                "BorderG" => 255,
                "Size" => 4
            ];
            $this->drawRectangleMarker($X, $Y, $MyMarkerSettings);
        }

        $TxtPos = $this->getTextBox($X, $Y, $FontName, $FontSize, $Angle, $Text);

        if ($DrawBox && ($Angle == 0 || $Angle == 90 || $Angle == 180 || $Angle == 270)) {
            $T[0]["X"] = 0;
            $T[0]["Y"] = 0;
            $T[1]["X"] = 0;
            $T[1]["Y"] = 0;
            $T[2]["X"] = 0;
            $T[2]["Y"] = 0;
            $T[3]["X"] = 0;
            $T[3]["Y"] = 0;
            if ($Angle == 0) {
                $T[0]["X"] = -$TOffset;
                $T[0]["Y"] = $TOffset;
                $T[1]["X"] = $TOffset;
                $T[1]["Y"] = $TOffset;
                $T[2]["X"] = $TOffset;
                $T[2]["Y"] = -$TOffset;
                $T[3]["X"] = -$TOffset;
                $T[3]["Y"] = -$TOffset;
            }

            $X1 = min($TxtPos[0]["X"], $TxtPos[1]["X"], $TxtPos[2]["X"], $TxtPos[3]["X"]) - $BorderOffset + 3;
            $Y1 = min($TxtPos[0]["Y"], $TxtPos[1]["Y"], $TxtPos[2]["Y"], $TxtPos[3]["Y"]) - $BorderOffset;
            $X2 = max($TxtPos[0]["X"], $TxtPos[1]["X"], $TxtPos[2]["X"], $TxtPos[3]["X"]) + $BorderOffset + 3;
            $Y2 = max($TxtPos[0]["Y"], $TxtPos[1]["Y"], $TxtPos[2]["Y"], $TxtPos[3]["Y"]) + $BorderOffset - 3;

            $X1 = $X1 - $TxtPos[$Align]["X"] + $X + $T[0]["X"];
            $Y1 = $Y1 - $TxtPos[$Align]["Y"] + $Y + $T[0]["Y"];
            $X2 = $X2 - $TxtPos[$Align]["X"] + $X + $T[0]["X"];
            $Y2 = $Y2 - $TxtPos[$Align]["Y"] + $Y + $T[0]["Y"];

            $Settings = [
                "R" => $BoxR,
                "G" => $BoxG,
                "B" => $BoxB,
                "Alpha" => $BoxAlpha,
                "BorderR" => $BoxBorderR,
                "BorderG" => $BoxBorderG,
                "BorderB" => $BoxBorderB,
                "BorderAlpha" => $BoxBorderAlpha
            ];

            if ($BoxRounded) {
                $this->drawRoundedFilledRectangle($X1, $Y1, $X2, $Y2, $RoundedRadius, $Settings);
            } else {
                $this->drawFilledRectangle($X1, $Y1, $X2, $Y2, $Settings);
            }
        }

        $X = $X - $TxtPos[$Align]["X"] + $X;
        $Y = $Y - $TxtPos[$Align]["Y"] + $Y;

        if ($this->Shadow && $this->ShadowX != 0 && $this->ShadowY != 0) {
            $C_ShadowColor = $this->allocateColor(
                $this->Picture,
                $this->ShadowR,
                $this->ShadowG,
                $this->ShadowB,
                $this->Shadowa
            );
            imagettftext(
                $this->Picture,
                $FontSize,
                $Angle,
                $X + $this->ShadowX,
                $Y + $this->ShadowY,
                $C_ShadowColor,
                $FontName,
                $Text
            );
        }

        $C_TextColor = $this->AllocateColor($this->Picture, $R, $G, $B, $Alpha);
        imagettftext($this->Picture, $FontSize, $Angle, $X, $Y, $C_TextColor, $FontName, $Text);

        $this->Shadow = $Shadow;

        return $TxtPos;
    }
620120
@Override
    public void renderCharset( PositionedText target, double x, double y, String text, String set )
    {
        target.add( x, y, text );
    }
630278
private void yAxis(Graphics g) {
        // y-axis
        g.setColor(Color.BLACK);
        g.drawLine(X_OFFSET_LEFT, calcY(0), X_OFFSET_LEFT, Y_OFFSET_TOP);

        // center horizontal line
        g.setColor(new Color(220, 220, 220));
        g.drawLine(X_OFFSET_LEFT, height / 2 + Y_OFFSET_TOP, getWidth(),
                height / 2 + Y_OFFSET_TOP);

        g.setColor(Color.BLACK);

        // y-achsis markers + labels
        DecimalFormat d = new DecimalFormat("0.00");

        double numLabels = Math.min(Math.pow(2, y_resolution), 32);
        /*
         * technically, this is numLabels-1, but as we're iterating 0 <= i <=
         * numLabels, we need the extra label. Also don't draw more than 32
         * labels.
         */

        for (int i = 0; i <= numLabels; i++) {
            double fraction = i / numLabels;
            double value = fraction * upper_y_value;
            g.drawString(d.format(value), 1,
                    (int) ((1 - fraction) * height) + Y_OFFSET_TOP + 5);
            g.drawLine(X_OFFSET_LEFT - 5,
                    (int) ((1 - fraction) * height) + Y_OFFSET_TOP,
                    X_OFFSET_LEFT,
                    (int) ((1 - fraction) * height) + Y_OFFSET_TOP);
        }

    }
783623
public void writeCharacters(char[] text, int start, int len)
			throws XMLStreamException {
		this.writeCharacters(new String(text, start, len));
	}
1121167
private void paintBackgroundSolid(Graphics2D g, JComponent c, int x, int y, int width, int height) {
        Color color = c.getBackground();

        if (type == CommonControlState.DISABLED) {
            color = new Color(color.getRed(), color.getGreen(), color.getBlue(), 0x80);
        }

        Shape s = shapeGenerator.createRoundRectangle(x-2, y-2, width+4, height+4, CornerSize.BORDER);
        g.setPaint(color);
        g.fill(s);
        if (isPaintLineSeperators(c)) {
            paintLineSeparator(g, c, width, height);
        }
        
    }
842590
def draw_char(self, char, x, y, framebuffer, color):
        # pylint: disable=too-many-arguments
        """"""
        # Don't draw the character if it will be clipped off the visible area.
        #if x < -self.font_width or x >= framebuffer.width or \
        #   y < -self.font_height or y >= framebuffer.height:
        #    return
        # Go through each column of the character.
        for char_x in range(self.font_width):
            # Grab the byte for the current column of font data.
            self._font.seek(2 + (ord(char) * self.font_width) + char_x)
            try:
                line = struct.unpack('B', self._font.read(1))[0]
            except RuntimeError:
                continue # maybe character isnt there? go to next
            # Go through each row in the column byte.
            for char_y in range(self.font_height):
                # Draw a pixel for each bit that's flipped on.
                if (line >> char_y) & 0x1:
                    framebuffer.pixel(x + char_x, y + char_y, color)