Example usage for java.awt.geom PathIterator WIND_NON_ZERO

List of usage examples for java.awt.geom PathIterator WIND_NON_ZERO

Introduction

In this page you can find the example usage for java.awt.geom PathIterator WIND_NON_ZERO.

Prototype

int WIND_NON_ZERO

To view the source code for java.awt.geom PathIterator WIND_NON_ZERO.

Click Source Link

Document

The winding rule constant for specifying a non-zero rule for determining the interior of a path.

Usage

From source file:fi.nls.oskari.printout.printing.PDPageContentStream.java

/**
 * Draw a rectangle on the page using the current non stroking color.
 * //from  w  w  w .  j a va 2 s.  c o m
 * @param x
 *            The lower left x coordinate.
 * @param y
 *            The lower left y coordinate.
 * @param width
 *            The width of the rectangle.
 * @param height
 *            The height of the rectangle.
 * @throws IOException
 *             If there is an error while drawing on the screen.
 */
public void fillRect(float x, float y, float width, float height) throws IOException {
    if (inTextMode) {
        throw new IOException("Error: fillRect is not allowed within a text block.");
    }
    addRect(x, y, width, height);
    fill(PathIterator.WIND_NON_ZERO);
}

From source file:fi.nls.oskari.printout.printing.PDPageContentStream.java

/**
 * Draw and fill a polygon on the page using the current non stroking color.
 * //  w  w w.j av  a 2 s.  com
 * @param x
 *            x coordinate of each points
 * @param y
 *            y coordinate of each points
 * @throws IOException
 *             If there is an error while drawing on the screen.
 */
public void fillPolygon(float[] x, float[] y) throws IOException {
    if (inTextMode) {
        throw new IOException("Error: fillPolygon is not allowed within a text block.");
    }
    addPolygon(x, y);
    fill(PathIterator.WIND_NON_ZERO);
}

From source file:fi.nls.oskari.printout.printing.PDPageContentStream.java

/**
 * Fill the path./*from w ww.j av a 2 s  .  c  o m*/
 * 
 * @param windingRule
 *            the winding rule to be used for filling
 * 
 * @throws IOException
 *             If there is an error while filling the path.
 */
public void fill(int windingRule) throws IOException {
    if (inTextMode) {
        throw new IOException("Error: fill is not allowed within a text block.");
    }
    if (windingRule == PathIterator.WIND_NON_ZERO) {
        appendRawCommands(FILL_NON_ZERO);
    } else if (windingRule == PathIterator.WIND_EVEN_ODD) {
        appendRawCommands(FILL_EVEN_ODD);
    } else {
        throw new IOException("Error: unknown value for winding rule");
    }

}

From source file:fi.nls.oskari.printout.printing.PDPageContentStream.java

/**
 * Clip path./*from   w  w  w.  j  av a 2  s.  co  m*/
 * 
 * @param windingRule
 *            the winding rule to be used for clipping
 * 
 * @throws IOException
 *             If there is an error while clipping the path.
 */
public void clipPath(int windingRule) throws IOException {
    if (inTextMode) {
        throw new IOException("Error: clipPath is not allowed within a text block.");
    }
    if (windingRule == PathIterator.WIND_NON_ZERO) {
        appendRawCommands(CLIP_PATH_NON_ZERO);
        appendRawCommands(NOP);
    } else if (windingRule == PathIterator.WIND_EVEN_ODD) {
        appendRawCommands(CLIP_PATH_EVEN_ODD);
        appendRawCommands(NOP);
    } else {
        throw new IOException("Error: unknown value for winding rule");
    }
}

From source file:org.apache.pdfbox.pdmodel.edit.PDPageContentStream.java

/**
 * Draw a rectangle on the page using the current non stroking color.
 *
 * @param x The lower left x coordinate.
 * @param y The lower left y coordinate.
 * @param width The width of the rectangle.
 * @param height The height of the rectangle.
 * @throws IOException If there is an error while drawing on the screen.
 *//*from  w ww .  j  av a2s .  co  m*/
public void fillRect(float x, float y, float width, float height) throws IOException {
    addRect(x, y, width, height);
    fill(PathIterator.WIND_NON_ZERO);
}

From source file:org.apache.pdfbox.pdmodel.edit.PDPageContentStream.java

/**
 * Draw and fill a polygon on the page using the current non stroking color.
 * @param x x coordinate of each points//from ww w.  j  av a  2 s .  c o m
 * @param y y coordinate of each points
 * @throws IOException If there is an error while drawing on the screen.
 */
public void fillPolygon(float[] x, float[] y) throws IOException {
    addPolygon(x, y);
    fill(PathIterator.WIND_NON_ZERO);
}

From source file:org.apache.pdfbox.pdmodel.edit.PDPageContentStream.java

/**
 * Fill the path.//  w ww  . j  av a2 s .c om
 * 
 * @param windingRule the winding rule to be used for filling 
 * 
 * @throws IOException If there is an error while filling the path.
 */
public void fill(int windingRule) throws IOException {
    if (windingRule == PathIterator.WIND_NON_ZERO) {
        appendRawCommands(FILL_NON_ZERO);
    } else if (windingRule == PathIterator.WIND_EVEN_ODD) {
        appendRawCommands(FILL_EVEN_ODD);
    } else {
        throw new IOException("Error: unknown value for winding rule");
    }

}

From source file:org.apache.pdfbox.pdmodel.edit.PDPageContentStream.java

/**
 * Clip path./*from   w  w w  .  ja v a2 s.  c  o  m*/
 * 
 * @param windingRule the winding rule to be used for clipping
 *  
 * @throws IOException If there is an error while clipping the path.
 */
public void clipPath(int windingRule) throws IOException {
    if (windingRule == PathIterator.WIND_NON_ZERO) {
        appendRawCommands(CLIP_PATH_NON_ZERO);
        appendRawCommands(NOP);
    } else if (windingRule == PathIterator.WIND_EVEN_ODD) {
        appendRawCommands(CLIP_PATH_EVEN_ODD);
        appendRawCommands(NOP);
    } else {
        throw new IOException("Error: unknown value for winding rule");
    }
}

From source file:org.apache.pdfbox.pdmodel.PDPageContentStream.java

/**
 * Fill the path./*from   w  w w  .  j  a  v a  2  s.  c  om*/
 * 
 * @param windingRule the winding rule to be used for filling
 * @throws IOException If the content stream could not be written
 * @throws IllegalArgumentException If the parameter is not a valid winding rule.
 * @deprecated Use {@link #fill()} or {@link #fillEvenOdd} instead.
 */
@Deprecated
public void fill(int windingRule) throws IOException {
    if (windingRule == PathIterator.WIND_NON_ZERO) {
        fill();
    } else if (windingRule == PathIterator.WIND_EVEN_ODD) {
        fillEvenOdd();
    } else {
        throw new IllegalArgumentException("Error: unknown value for winding rule");
    }
}

From source file:org.apache.pdfbox.pdmodel.PDPageContentStream.java

/**
 * Clip path./*  w ww . j  ava2  s.  c om*/
 * 
 * @param windingRule the winding rule to be used for clipping
 * @throws IOException If there is an error while clipping the path.
 * @throws IllegalStateException If the method was called within a text block.
 * @deprecated Use {@link #clip()} or {@link #clipEvenOdd} instead.
 */
@Deprecated
public void clipPath(int windingRule) throws IOException {
    if (inTextMode) {
        throw new IllegalStateException("Error: clipPath is not allowed within a text block.");
    }
    if (windingRule == PathIterator.WIND_NON_ZERO) {
        writeOperator("W");
    } else if (windingRule == PathIterator.WIND_EVEN_ODD) {
        writeOperator("W*");
    } else {
        throw new IllegalArgumentException("Error: unknown value for winding rule");
    }
    writeOperator("n");
}