コード例 #1
0
 private void drawOuterBorder(
     Context2D context, Paint borderPaint, BasicStroke borderStroke, double width, double height) {
   float borderWidth = borderStroke.getLineWidth();
   context.setStroke(borderStroke);
   context.setPaint(borderPaint);
   context.draw(
       new Rectangle2D.Double(
           borderWidth / 2, borderWidth / 2, width - borderWidth, height - borderWidth));
 }
コード例 #2
0
 private void drawCenteredText(
     Context2D context,
     String text,
     double width,
     Font textFont,
     Color textColor,
     double maxWidth) {
   context.setFont(textFont);
   context.setPaint(textColor);
   context.drawText(
       text,
       width / 2,
       0,
       Context2D.HORIZONTAL_ALIGN_CENTER,
       Context2D.VERTICAL_ALIGN_TOP,
       maxWidth);
 }
コード例 #3
0
 private void fillBackground(
     Context2D context, Paint backgroundPaint, double width, double height) {
   context.setPaint(backgroundPaint);
   context.fill(new Rectangle2D.Double(0, 0, width, height));
 }