Java Code Examples for java.awt.geom.Path2D#closePath()

The following examples show how to use java.awt.geom.Path2D#closePath() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MainPanel.java    From java-swing-tips with MIT License 6 votes vote down vote up
protected Shape makeShape(Container parent, Component c, int x, int y) {
  int w = c.getWidth() - 1;
  int h = c.getHeight() - 1;
  double h2 = Math.round(h * .5);
  double w2 = TH;
  Path2D p = new Path2D.Double();
  p.moveTo(0d, 0d);
  p.lineTo(w - w2, 0d);
  p.lineTo(w, h2);
  p.lineTo(w - w2, h);
  p.lineTo(0d, h);
  if (c != parent.getComponent(0)) {
    p.lineTo(w2, h2);
  }
  p.closePath();
  return AffineTransform.getTranslateInstance(x, y).createTransformedShape(p);
}
 
Example 2
Source File: BpmnJsonConverterTest.java    From flowable-engine with Apache License 2.0 6 votes vote down vote up
@Test
public void testLineCircleIntersections() {
    // Arrange
    Path2D line = new Path2D.Double(Path2D.WIND_NON_ZERO, 3);
    line.moveTo(1, 10);
    line.lineTo(20 - 1, 10);
    line.lineTo(20 - 1 + SMALL_DELTA, 10 + SMALL_DELTA);
    line.closePath();
    Ellipse2D.Double circle = new Ellipse2D.Double(4, 8, 4, 4);

    // Act
    Area intersectionArea = new Area(line);
    intersectionArea.intersect(new Area(circle));

    // Assert
    assertThat(intersectionArea.isEmpty()).isFalse();
    Rectangle2D bounds2D = intersectionArea.getBounds2D();
    assertThat(bounds2D.getX()).isCloseTo(4d, offset(PRECISION));
    assertThat(bounds2D.getY()).isCloseTo(10d, offset(PRECISION));
    assertThat(bounds2D.getX() + bounds2D.getWidth()).isCloseTo(8d, offset(PRECISION));
    assertThat(bounds2D.getY() + bounds2D.getHeight()).isCloseTo(10d, offset(PRECISION));
}
 
Example 3
Source File: AbstractBeamInter.java    From audiveris with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * Define lookup area around the beam for potential stems
 *
 * @return the look up area
 */
private Area getLookupArea (Scale scale)
{
    final Line2D top = getBorder(VerticalSide.TOP);
    final Line2D bottom = getBorder(VerticalSide.BOTTOM);
    final int xOut = scale.toPixels(BeamStemRelation.getXOutGapMaximum(manual));
    final int yGap = scale.toPixels(BeamStemRelation.getYGapMaximum(manual));

    final Path2D lu = new Path2D.Double();
    double xMin = top.getX1() - xOut;
    double xMax = top.getX2() + xOut;
    Point2D topLeft = LineUtil.intersectionAtX(top, xMin);
    lu.moveTo(topLeft.getX(), topLeft.getY() - yGap);

    Point2D topRight = LineUtil.intersectionAtX(top, xMax);
    lu.lineTo(topRight.getX(), topRight.getY() - yGap);

    Point2D bottomRight = LineUtil.intersectionAtX(bottom, xMax);
    lu.lineTo(bottomRight.getX(), bottomRight.getY() + yGap);

    Point2D bottomLeft = LineUtil.intersectionAtX(bottom, xMin);
    lu.lineTo(bottomLeft.getX(), bottomLeft.getY() + yGap);
    lu.closePath();

    return new Area(lu);
}
 
Example 4
Source File: DG_KGrid_KPolygonWithLabelledKGridInsideIt.java    From Geom_Kisrhombille with GNU General Public License v3.0 6 votes vote down vote up
private void renderNorthArrow(double[] pt0,double[] pt1){
//
double 
  da=GD.getDirection_PointPoint(pt0[0],pt0[1],pt1[0],pt1[1]),
  dright=GD.normalizeDirection(da+GD.HALFPI),
  dleft=GD.normalizeDirection(da-GD.HALFPI);
double[] 
  p0=GD.getPoint_PointDirectionInterval(pt0[0],pt0[1],da,ARROWOFFSET0),
  p1=GD.getPoint_PointDirectionInterval(p0[0],p0[1],da,ARROWSHAFTLENGTH),
  p2=GD.getPoint_PointDirectionInterval(p1[0],p1[1],da,ARROWHEADLENGTH),
  pleft=GD.getPoint_PointDirectionInterval(p1[0],p1[1],dleft,ARROWHEADWIDTH),
  pright=GD.getPoint_PointDirectionInterval(p1[0],p1[1],dright,ARROWHEADWIDTH);
Path2D path=new Path2D.Double();
path.moveTo(p0[0],p0[1]);
path.lineTo(p1[0],p1[1]);
graphics.setStroke(createStroke(STROKETHICKNESS2*imagescale));
graphics.draw(path);
path=new Path2D.Double();
path.moveTo(p2[0],p2[1]);
path.lineTo(pleft[0],pleft[1]);
path.lineTo(pright[0],pright[1]);
path.closePath();
graphics.fill(path);}
 
Example 5
Source File: VirtualNodeGeometry.java    From amodeus with GNU General Public License v2.0 6 votes vote down vote up
static Shape createShapePixel(AmodeusComponent amodeusComponent, Tensor hull) {
    if (Tensors.isEmpty(hull))
        return new Ellipse2D.Double(0, 0, 0, 0);
    Path2D path2d = new Path2D.Double();
    boolean init = false;
    for (Tensor vector : hull)
        if (!init) {
            init = true;
            path2d.moveTo( //
                    vector.Get(0).number().doubleValue(), //
                    vector.Get(1).number().doubleValue());
        } else
            path2d.lineTo( //
                    vector.Get(0).number().doubleValue(), //
                    vector.Get(1).number().doubleValue());
    path2d.closePath();
    return path2d;
}
 
Example 6
Source File: MainPanel.java    From java-swing-tips with MIT License 6 votes vote down vote up
public Path2D makeStar(int r1, int r2, int vc) {
  double or = Math.max(r1, r2);
  double ir = Math.min(r1, r2);
  double agl = 0d;
  double add = Math.PI / vc;
  Path2D p = new Path2D.Double();
  p.moveTo(or, 0d);
  for (int i = 0; i < vc * 2 - 1; i++) {
    agl += add;
    double r = i % 2 == 0 ? ir : or;
    p.lineTo(r * Math.cos(agl), r * Math.sin(agl));
  }
  p.closePath();
  AffineTransform at = AffineTransform.getRotateInstance(-Math.PI / 2d, or, 0d);
  return new Path2D.Double(p, at);
}
 
Example 7
Source File: VisualCreditComponent.java    From workcraft with MIT License 6 votes vote down vote up
@Override
public Shape getShape() {
    Path2D shape = new Path2D.Double();

    shape.moveTo(-0.5 * SIZE, -0.4 * SIZE);
    shape.lineTo(-0.5 * SIZE, +0.4 * SIZE);
    shape.lineTo(+0.5 * SIZE, +0.4 * SIZE);
    shape.lineTo(+0.5 * SIZE, -0.4 * SIZE);
    shape.closePath();

    shape.moveTo(0.0, -0.4 * SIZE);
    shape.lineTo(0.0, +0.4 * SIZE);

    double tokenSize = SIZE / 10.0;
    for (int i = 0; i < 4; i++) {
        shape.append(new Ellipse2D.Double(-0.2 * SIZE - 0.5 * tokenSize, -0.5 * tokenSize, tokenSize, tokenSize), false);
        shape.append(new Ellipse2D.Double(+0.2 * SIZE - 0.5 * tokenSize, -0.5 * tokenSize, tokenSize, tokenSize), false);
        tokenSize /= 3.0;
    }

    return shape;
}
 
Example 8
Source File: MainPanel.java    From java-swing-tips with MIT License 6 votes vote down vote up
public Path2D makeStar(int r1, int r2, int vc) {
  double or = Math.max(r1, r2);
  double ir = Math.min(r1, r2);
  double agl = 0d;
  double add = Math.PI / vc;
  Path2D p = new Path2D.Double();
  p.moveTo(or, 0d);
  for (int i = 0; i < vc * 2 - 1; i++) {
    agl += add;
    double r = i % 2 == 0 ? ir : or;
    p.lineTo(r * Math.cos(agl), r * Math.sin(agl));
  }
  p.closePath();
  AffineTransform at = AffineTransform.getRotateInstance(-Math.PI / 2d, or, 0d);
  return new Path2D.Double(p, at);
}
 
Example 9
Source File: SigPainter.java    From audiveris with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public void visit (HeadInter head)
{
    final Line2D midLine = head.getMidLine();

    if (midLine != null) {
        if (splitMirrors()) {
            // Draw head proper half
            int width = head.getBounds().width;
            int xDir = midLine.getY2() > midLine.getY1() ? -1 : +1;
            Path2D p = new Path2D.Double();
            p.append(midLine, false);
            p.lineTo(midLine.getX2() + xDir * width, midLine.getY2());
            p.lineTo(midLine.getX1() + xDir * width, midLine.getY1());
            p.closePath();

            java.awt.Shape oldClip = g.getClip();
            g.clip(p);
            visit((Inter) head);
            g.setClip(oldClip);
        } else {
            visit((Inter) head);
        }

        // Draw midLine using complementary color of head
        Color compColor = UIUtil.complementaryColor(g.getColor());
        Stroke oldStroke = UIUtil.setAbsoluteStroke(g, 1f);
        g.setColor(compColor);
        g.draw(midLine);
        g.setStroke(oldStroke);
    } else {
        visit((Inter) head);
    }
}
 
Example 10
Source File: VisualMergeComponent.java    From workcraft with MIT License 5 votes vote down vote up
@Override
public Shape getShape() {
    Path2D shape = new Path2D.Double();

    shape.moveTo(-0.50 * SIZE, -0.50 * SIZE);
    shape.lineTo(-0.08, -0.50 * SIZE);

    shape.moveTo(-0.50 * SIZE, +0.50 * SIZE);
    shape.lineTo(-0.08, +0.50 * SIZE);

    shape.moveTo(+0.00, -0.60 * SIZE);
    shape.lineTo(+0.00, +0.60 * SIZE);

    shape.moveTo(+0.00, +0.00);
    shape.lineTo(+0.50 * SIZE, +0.00);

    // Arrows
    shape.moveTo(-0.15 * SIZE, -0.55 * SIZE);
    shape.lineTo(-0.05 * SIZE, -0.50 * SIZE);
    shape.lineTo(-0.15 * SIZE, -0.45 * SIZE);
    shape.closePath();

    shape.moveTo(-0.15 * SIZE, +0.55 * SIZE);
    shape.lineTo(-0.05 * SIZE, +0.50 * SIZE);
    shape.lineTo(-0.15 * SIZE, +0.45 * SIZE);
    shape.closePath();

    return shape;
}
 
Example 11
Source File: DarculaUIUtil.java    From consulo with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("SuspiciousNameCombination")
public static void doPaint(Graphics2D g, int width, int height, float arc, boolean symmetric) {
  float bw = UIUtil.isUnderDefaultMacTheme() ? JBUI.scale(3) : BW.getFloat();
  float lw = UIUtil.isUnderDefaultMacTheme() ? JBUI.scale(UIUtil.isRetina(g) ? 0.5f : 1.0f) : LW.getFloat();

  g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
  g.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, MacUIUtil.USE_QUARTZ ? RenderingHints.VALUE_STROKE_PURE : RenderingHints.VALUE_STROKE_NORMALIZE);

  float outerArc = arc > 0 ? arc + bw - JBUI.scale(2f) : bw;
  float rightOuterArc = symmetric ? outerArc : JBUI.scale(6f);
  Path2D outerRect = new Path2D.Float(Path2D.WIND_EVEN_ODD);
  outerRect.moveTo(width - rightOuterArc, 0);
  outerRect.quadTo(width, 0, width, rightOuterArc);
  outerRect.lineTo(width, height - rightOuterArc);
  outerRect.quadTo(width, height, width - rightOuterArc, height);
  outerRect.lineTo(outerArc, height);
  outerRect.quadTo(0, height, 0, height - outerArc);
  outerRect.lineTo(0, outerArc);
  outerRect.quadTo(0, 0, outerArc, 0);
  outerRect.closePath();

  bw += lw;
  float rightInnerArc = symmetric ? outerArc : JBUI.scale(7f);
  Path2D innerRect = new Path2D.Float(Path2D.WIND_EVEN_ODD);
  innerRect.moveTo(width - rightInnerArc, bw);
  innerRect.quadTo(width - bw, bw, width - bw, rightInnerArc);
  innerRect.lineTo(width - bw, height - rightInnerArc);
  innerRect.quadTo(width - bw, height - bw, width - rightInnerArc, height - bw);
  innerRect.lineTo(outerArc, height - bw);
  innerRect.quadTo(bw, height - bw, bw, height - outerArc);
  innerRect.lineTo(bw, outerArc);
  innerRect.quadTo(bw, bw, outerArc, bw);
  innerRect.closePath();

  Path2D path = new Path2D.Float(Path2D.WIND_EVEN_ODD);
  path.append(outerRect, false);
  path.append(innerRect, false);
  g.fill(path);
}
 
Example 12
Source File: StemsBuilder.java    From audiveris with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Define the lookup area on given corner, knowing the reference point of the
 * entity (head).
 * Global slope is used (plus and minus slopeMargin).
 *
 * @return the lookup area
 */
private Area getLuArea ()
{
    final double slope = skew.getSlope();
    final double dSlope = -xDir * yDir * params.slopeMargin;

    final Point2D outPt = getOutPoint();
    final Point2D inPt = getInPoint();

    // Look Up path, start by head horizontal segment
    final Path2D lu = new Path2D.Double();
    lu.moveTo(outPt.getX(), outPt.getY());
    lu.lineTo(inPt.getX(), inPt.getY());

    // Then segment away from head (system limit)
    final Rectangle systemBox = system.getBounds();
    final double yLimit = (yDir > 0) ? systemBox.getMaxY() : systemBox.getMinY();
    final double dy = yLimit - outPt.getY();
    lu.lineTo(inPt.getX() + ((slope + dSlope) * dy), yLimit);
    lu.lineTo(outPt.getX() + ((slope - dSlope) * dy), yLimit);
    lu.closePath();

    // Attachment
    StringBuilder sb = new StringBuilder();
    sb.append((corner.vSide == TOP) ? "T" : "B");
    sb.append((corner.hSide == LEFT) ? "L" : "R");
    head.addAttachment(sb.toString(), lu);

    return new Area(lu);
}
 
Example 13
Source File: MainPanel.java    From java-swing-tips with MIT License 5 votes vote down vote up
protected StarIcon2() {
  double agl = 0d;
  double add = Math.PI / VC;
  Path2D p = new Path2D.Double();
  p.moveTo(R2, 0d);
  for (int i = 0; i < VC * 2 - 1; i++) {
    agl += add;
    int r = i % 2 == 0 ? R1 : R2;
    p.lineTo(r * Math.cos(agl), r * Math.sin(agl));
  }
  p.closePath();
  AffineTransform at = AffineTransform.getRotateInstance(-Math.PI / 2d, R2, 0d);
  star = new Path2D.Double(p, at);
}
 
Example 14
Source File: DocGraphics.java    From Geom_Kisrhombille with GNU General Public License v3.0 5 votes vote down vote up
void strokePolygon(DPolygon polygon,double strokethickness,Color color){
Path2D path=new Path2D.Double();
int s=polygon.size();
DPoint p=polygon.get(0);
path.moveTo(p.x,p.y);
for(int i=1;i<s;i++){
  p=polygon.get(i);
  path.lineTo(p.x,p.y);}
path.closePath();
graphics.setStroke(createStroke(strokethickness));
graphics.setPaint(color);
graphics.draw(path); }
 
Example 15
Source File: DarculaComboBoxUI.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
protected JButton createArrowButton() {
  Color bg = comboBox.getBackground();
  Color fg = comboBox.getForeground();
  JButton button = new BasicArrowButton(SwingConstants.SOUTH, bg, fg, fg, fg) {

    @Override
    public void paint(Graphics g) {
      Graphics2D g2 = (Graphics2D)g.create();
      Rectangle r = new Rectangle(getSize());
      JBInsets.removeFrom(r, JBUI.insets(1, 0, 1, 1));

      try {
        g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
        g2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE);
        g2.translate(r.x, r.y);

        float bw = BW.getFloat();
        float lw = LW.getFloat();
        float arc = COMPONENT_ARC.getFloat();
        arc = arc > bw + lw ? arc - bw - lw : 0.0f;

        Path2D innerShape = new Path2D.Float();
        innerShape.moveTo(lw, bw + lw);
        innerShape.lineTo(r.width - bw - lw - arc, bw + lw);
        innerShape.quadTo(r.width - bw - lw, bw + lw, r.width - bw - lw, bw + lw + arc);
        innerShape.lineTo(r.width - bw - lw, r.height - bw - lw - arc);
        innerShape.quadTo(r.width - bw - lw, r.height - bw - lw, r.width - bw - lw - arc, r.height - bw - lw);
        innerShape.lineTo(lw, r.height - bw - lw);
        innerShape.closePath();

        g2.setColor(JBUI.CurrentTheme.Arrow.backgroundColor(comboBox.isEnabled(), comboBox.isEditable()));
        g2.fill(innerShape);

        // Paint vertical line
        if (comboBox.isEditable()) {
          g2.setColor(getOutlineColor(comboBox.isEnabled(), false));
          g2.fill(new Rectangle2D.Float(0, bw + lw, LW.getFloat(), r.height - (bw + lw) * 2));
        }

        g2.setColor(JBUI.CurrentTheme.Arrow.foregroundColor(comboBox.isEnabled()));
        g2.fill(getArrowShape(this));
      }
      finally {
        g2.dispose();
      }
    }

    @Override
    public Dimension getPreferredSize() {
      return getArrowButtonPreferredSize(comboBox);
    }
  };
  button.setBorder(JBUI.Borders.empty());
  button.setOpaque(false);
  return button;
}
 
Example 16
Source File: Path2DCopyConstructor.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
static Path2D addClose(Path2D p2d) {
    p2d.closePath();
    return p2d;
}
 
Example 17
Source File: PointsToRegion.java    From data-polygamy with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
private void readData(FSDataInputStream fis) throws IOException {
    
    ArrayList<Path2D.Double> allPolygons = new ArrayList<Path2D.Double>();
    /*Set<String> regionNames;
    JSONParser parser = new JSONParser();*/
    
    int id = 0;
    
    try {
        BufferedReader buff = new BufferedReader(new InputStreamReader(fis));
        String line = buff.readLine();
        
        ArrayList<Double> xPoints = new ArrayList<Double>();
        ArrayList<Double> yPoints = new ArrayList<Double>();
        
        while (line != null) {
            String region = line;
            buff.readLine();
            Integer nbPoints = Integer.parseInt(buff.readLine());
            
            xPoints = new ArrayList<Double>(nbPoints);
            yPoints = new ArrayList<Double>(nbPoints);
            for (int i = 0; i < nbPoints; i++) {
                String[] points = buff.readLine().split(" ");
                xPoints.add(Double.parseDouble(points[0]));
                yPoints.add(Double.parseDouble(points[1]));
            }
            
            // creating polygon
            Path2D polygon = new Path2D.Double();
            polygon.moveTo(xPoints.get(0), yPoints.get(0));
            for (int i = 1; i < xPoints.size(); ++i) {
                polygon.lineTo(xPoints.get(i), yPoints.get(i));
            }
            polygon.closePath();
          
            allPolygons.add((Path2D.Double) polygon);
            if (useMapping) {
                polyRegionNames.add(id);
                id++;
            } else
                polyRegionNames.add(Integer.parseInt(region));
            
            line = buff.readLine();
        }
        
        buff.close();
        
        grid.buildGrid(allPolygons, useBoundingCircle);
        
    } catch (Exception e) {
        e.printStackTrace();
        System.exit(1);
    } finally {
        fis.close();
    }
}
 
Example 18
Source File: AbstractDataView.java    From ET_Redux with Apache License 2.0 4 votes vote down vote up
protected void generateEllipsePathIII(
            ETFractionInterface f,
            ValueModel xAxisRatio,
            ValueModel yAxisRatio,
            double ellipseSize) {

        ValueModel correlationCoefficient;
//
//        xAxisRatio = f.getLegacyActivityRatioByName(UThAnalysisMeasures.ar230Th_238Ufc.getName());
//        yAxisRatio = f.getLegacyActivityRatioByName(UThAnalysisMeasures.ar234U_238Ufc.getName());

        correlationCoefficient = new ValueModel(); // fake zero for now

        Path2D ellipse = new Path2D.Double(Path2D.WIND_NON_ZERO);// null;

        double aspectRatio = ((getRangeY_Display() / (double) graphHeight) / (getRangeX_Display() / (double) graphWidth));

        if ((correlationCoefficient.getValue().doubleValue() >= -1.0)
                && (correlationCoefficient.getValue().doubleValue() <= 1.0)) {

            ErrorEllipse ee = new ErrorEllipse(
                    xAxisRatio,
                    yAxisRatio,
                    correlationCoefficient,
                    aspectRatio,
                    ellipseSize);

            int pointCount = 13;

            Matrix ellipseXY = ee.getEllipseControlPoints();

            ellipse.moveTo(
                    mapX(ellipseXY.get(0, 0)),
                    mapY(ellipseXY.get(0, 1)));

            for (int i = 1; i < pointCount; i += 3) {
                ellipse.curveTo(
                        mapX(ellipseXY.get(i, 0)),
                        mapY(ellipseXY.get(i, 1)),
                        mapX(ellipseXY.get(i + 1, 0)),
                        mapY(ellipseXY.get(i + 1, 1)),
                        mapX(ellipseXY.get(i + 2, 0)),
                        mapY(ellipseXY.get(i + 2, 1)));
            }
            ellipse.closePath();

            // june 2010 if any part of bounds in view, then display
            if (ellipse.getBounds().intersects(//
                    leftMargin - 1, topMargin - 1, (int) graphWidth + 2, (int) graphHeight + 2)) {

                f.setErrorEllipsePath(ellipse);
                // used for placing ellipse label
                f.setEllipseRho(correlationCoefficient.getValue().doubleValue());

            } else {
                f.setErrorEllipsePath(null);
            }
        } else {
            // bad boy
            f.setErrorEllipsePath(null);
        }
    }
 
Example 19
Source File: Path2DGrow.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
static void addClose(Path2D p2d) {
    p2d.closePath();
}
 
Example 20
Source File: CorrectedRatioDataView.java    From ET_Redux with Apache License 2.0 4 votes vote down vote up
/**
 *
 * @param g2d
 */
@Override
public void paint(Graphics2D g2d) {
    //super.paint( g2d );

    paintInit(g2d);

    double mean = ((RawRatioDataModel) rawRatioDataModel).getMeanOfCorrectedRatios();
    double sigma = ((RawRatioDataModel) rawRatioDataModel).getStdDevOfCorrectedRatios();
    double stdErr = ((RawRatioDataModel) rawRatioDataModel).getStdErrOfMeanCorrectedRatios();

    //draw two-sigma
    Path2D twoSigmaArea = new Path2D.Double();
    twoSigmaArea.moveTo(mapX(minX), mapY(mean - 2.0 * sigma));
    twoSigmaArea.lineTo(mapX(minX), mapY(mean + 2.0 * sigma));
    twoSigmaArea.lineTo(mapX(maxX), mapY(mean + 2.0 * sigma));
    twoSigmaArea.lineTo(mapX(maxX), mapY(mean - 2.0 * sigma));
    twoSigmaArea.closePath();
    // pale red
    g2d.setColor(new Color(255, 233, 235));
    g2d.fill(twoSigmaArea);

    //draw one-sigma
    Path2D oneSigmaArea = new Path2D.Double();
    oneSigmaArea.moveTo(mapX(minX), mapY(mean - sigma));
    oneSigmaArea.lineTo(mapX(minX), mapY(mean + sigma));
    oneSigmaArea.lineTo(mapX(maxX), mapY(mean + sigma));
    oneSigmaArea.lineTo(mapX(maxX), mapY(mean - sigma));
    oneSigmaArea.closePath();
    // pale yellow
    g2d.setColor(new Color(254, 255, 233));
    g2d.fill(oneSigmaArea);

    //draw std err
    Path2D stdErrArea = new Path2D.Double();
    stdErrArea.moveTo(mapX(minX), mapY(mean - stdErr));
    stdErrArea.lineTo(mapX(minX), mapY(mean + stdErr));
    stdErrArea.lineTo(mapX(maxX), mapY(mean + stdErr));
    stdErrArea.lineTo(mapX(maxX), mapY(mean - stdErr));
    stdErrArea.closePath();
    // pale blue
    g2d.setColor(new Color(208, 222, 254));
    g2d.fill(stdErrArea);

    // draw mean
    Path2D meanLine = new Path2D.Double();
    meanLine.moveTo(mapX(minX), mapY(mean));
    meanLine.lineTo(mapX(maxX), mapY(mean));
    g2d.setPaint(Color.black);
    g2d.setStroke(new BasicStroke(1.0f));
    g2d.draw(meanLine);

    drawTicsYAxisInBackground(g2d);

    if (tripoliFraction != null) {
        if (tripoliFraction.isColorMeExcluded()) {
            paintFractionExcludedColor(g2d);
        }

        int chosenDatumIndex = tripoliFraction.getShowVerticalLineAtThisIndex();
        if (chosenDatumIndex > -1) {
            int secondChoiceIndex = tripoliFraction.getShowSecondVerticalLineAtThisIndex();
            highlightSelectedData(g2d, chosenDatumIndex, secondChoiceIndex);
        }

        if (!tripoliFraction.isStandard()) {
            setBackground(new Color(245, 251, 252));
        }
    }

    // draw data points
    for (int i = 0; i < myOnPeakData.length; i++) {
        Shape rawRatioPoint = new java.awt.geom.Ellipse2D.Double( //
                mapX(myOnPeakNormalizedAquireTimes[i]), mapY(myOnPeakData[i]), 1.0, 1.0);
        g2d.setPaint(determineDataColor(i, Color.black));
        g2d.draw(rawRatioPoint);
    }

}