Java Code Examples for processing.core.PGraphics#popStyle()

The following examples show how to use processing.core.PGraphics#popStyle() . 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: ConstellationLineMarker.java    From constellation with Apache License 2.0 6 votes vote down vote up
@Override
public boolean draw(final PGraphics graphics, final List<MapPosition> positions, final UnfoldingMap map) {
    if (positions.isEmpty() || isHidden()) {
        return false;
    }

    graphics.pushStyle();
    graphics.noFill();
    graphics.strokeWeight(size == MarkerUtilities.DEFAULT_SIZE ? strokeWeight : size);
    graphics.stroke(getFillColor());
    graphics.smooth();

    graphics.beginShape(PConstants.LINES);
    for (int i = 0; i < positions.size() - 1; ++i) {
        final MapPosition lastPosition = positions.get(i);
        final MapPosition currentPosition = positions.get(i + 1);
        graphics.vertex(lastPosition.x, lastPosition.y);
        graphics.vertex(currentPosition.x, currentPosition.y);
    }
    graphics.endShape();
    graphics.popStyle();

    return true;
}
 
Example 2
Source File: ConstellationPolygonMarker.java    From constellation with Apache License 2.0 6 votes vote down vote up
@Override
public boolean draw(final PGraphics graphics, final List<MapPosition> positions, final UnfoldingMap map) {
    if (positions.isEmpty() || isHidden()) {
        return false;
    }

    graphics.pushStyle();
    graphics.strokeWeight(size == MarkerUtilities.DEFAULT_SIZE ? strokeWeight : size);
    graphics.stroke(strokeColor);
    graphics.fill(getFillColor());
    graphics.beginShape();
    positions.forEach(position -> {
        graphics.vertex(position.x, position.y);
    });
    graphics.endShape(PConstants.CLOSE);
    graphics.popStyle();

    return true;
}
 
Example 3
Source File: ConstellationPointMarker.java    From constellation with Apache License 2.0 5 votes vote down vote up
@Override
public boolean draw(final PGraphics graphics, final List<MapPosition> positions, final UnfoldingMap map) {
    if (positions.isEmpty() || isHidden()) {
        return false;
    }

    final float x = positions.get(0).x;
    final float y = positions.get(0).y;

    graphics.pushStyle();

    if (size > MarkerUtilities.DEFAULT_SIZE) {
        graphics.strokeWeight(strokeWeight);
        graphics.stroke(strokeColor);
        graphics.fill(getFillColor());
        graphics.ellipseMode(PConstants.RADIUS);
        graphics.ellipse(x, y, size, size);
    } else {
        TEMPLATE_IMAGE.loadPixels();
        for (int i = 0; i < TEMPLATE_IMAGE.width * TEMPLATE_IMAGE.height; i++) {
            final int[] pixelArgb = MarkerUtilities.argb(TEMPLATE_IMAGE.pixels[i]);
            if (!(pixelArgb[0] == 0 || (pixelArgb[1] == 0 && pixelArgb[2] == 0 && pixelArgb[3] == 0))) {
                TEMPLATE_IMAGE.pixels[i] = getFillColor();
            }
        }
        TEMPLATE_IMAGE.updatePixels();

        graphics.imageMode(PConstants.CORNER);
        graphics.image(TEMPLATE_IMAGE, x - POINT_X_OFFSET, y - POINT_Y_OFFSET);
    }

    graphics.popStyle();

    return true;
}
 
Example 4
Source File: DwUtils.java    From PixelFlow with MIT License 5 votes vote down vote up
static public void endScreen2D(PGraphics pg){
  if(pg.isGL() && pg.is3D()){
    PGraphicsOpenGL pgl = (PGraphicsOpenGL)pg;
    pgl.popProjection();
    pgl.lights = pushed_lights;
  }
  pg.popMatrix();
  pg.hint(PConstants.ENABLE_DEPTH_TEST);
  pg.popStyle();
}
 
Example 5
Source File: PG.java    From haxademic with MIT License 4 votes vote down vote up
public static void pop(PGraphics pg) {
	pg.popStyle();
	pg.popMatrix();
}