Package java.awt

Examples of java.awt.Graphics2D.drawPolygon()


                gr.setColor(Color.DARK_GRAY);
                gr.setStroke(new BasicStroke(border_add));
                gr.addRenderingHints(new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON));
                int[] xvals = { TEXSIZE/4, 3*TEXSIZE/4-1, TEXSIZE-1, 3*TEXSIZE/4-1, TEXSIZE/4, 0, TEXSIZE/4 };
                int[] yvals = { 0, 0, TEXSIZE/2, TEXSIZE-1, TEXSIZE-1, TEXSIZE/2, 0 };
                gr.drawPolygon(xvals, yvals, xvals.length);
            }
           
            if (alpha < 1.0f) {
                WritableRaster wr = src.getAlphaRaster();
                for (int y = 0; y < src.getHeight(); y++) {
View Full Code Here


                g2d.setTransform(new AffineTransform());
                g2d.setColor(fo1.color);               
                g2d.translate((fo1.getPosition().x*scaleFactor-viewCoordUL.x), (fo1.getPosition().y*scaleFactor-viewCoordUL.y));
                g2d.rotate(theta);
                g2d.scale(scaleFactor, scaleFactor);
                g2d.drawPolygon(ship);
               
                // POSITION
                g2d.setTransform(new AffineTransform());
                g2d.setColor(Color.BLUE);               
                 g2d.drawString("X: "+ (int)fo1.getPosition().x + " Y: "+ (int)fo1.getPosition().y,
View Full Code Here

                // ENEMY
                g2d.setTransform(new AffineTransform());
                g2d.setColor(fo2.color);
                g2d.translate((fo2.getPosition().x*scaleFactor-viewCoordUL.x), (fo2.getPosition().y*scaleFactor-viewCoordUL.y));
                g2d.scale(scaleFactor, scaleFactor);
                g2d.drawPolygon(enemy);               

                // BULLET
              g2d.setColor(Color.YELLOW);
                for (Iterator i = bullets.iterator(); i.hasNext(); ) {
                    g2d.setTransform(new AffineTransform());
View Full Code Here

                // PLANET
                g2d.setTransform(new AffineTransform());
                g2d.setColor(planet.color);
                g2d.translate((planet.getPosition().x*scaleFactor-viewCoordUL.x), (planet.getPosition().y*scaleFactor-viewCoordUL.y));
                g2d.scale(scaleFactor, scaleFactor);
                g2d.drawPolygon(planetCircle);
       
                // MOON
                g2d.setTransform(new AffineTransform());
                g2d.setColor(moon.color);
                g2d.translate((moon.getPosition().x*scaleFactor-viewCoordUL.x), (moon.getPosition().y*scaleFactor-viewCoordUL.y));
 
View Full Code Here

                // MOON
                g2d.setTransform(new AffineTransform());
                g2d.setColor(moon.color);
                g2d.translate((moon.getPosition().x*scaleFactor-viewCoordUL.x), (moon.getPosition().y*scaleFactor-viewCoordUL.y));
                g2d.scale(scaleFactor, scaleFactor);
                g2d.drawPolygon(moonCircle);               
               
                // Engine Dust
                Vector dustToRemove = new Vector();
                for (Iterator i = dustVector.iterator(); i.hasNext(); ) {
                    g2d.setTransform(new AffineTransform());
View Full Code Here

                    g2d.setTransform(new AffineTransform());
                  DustObject dustObj = (DustObject) i.next();
                  g2d.translate((dustObj.fo.getPosition().x*scaleFactor-viewCoordUL.x), (dustObj.fo.getPosition().y*scaleFactor-viewCoordUL.y));
                  g2d.setColor(dustColor[(dustObj.time/10)]);
                  g2d.scale(scaleFactor, scaleFactor);
                  g2d.drawPolygon(engineDust);                 
                  dustObj.time--;
                  if(dustObj.time<=0){
                    dustToRemove.add(dustObj);
                  }
                  if(dustObj.time == 32){
View Full Code Here

                    p.add(new Vector2D(v1.x + this.heightProfileGridWidth, v1.y + this.heightProfileGridHeight));
                    p.add(new Vector2D(v1.x + this.heightProfileGridWidth, v1.y));
                    p = this.getPolygonInVisualization(p);
                    Polygon pol = p.toPol();
                   
                    g.drawPolygon(pol);
                    g.fillPolygon(pol);
                    g.drawLine(pol.xpoints[0], pol.ypoints[0], pol.xpoints[2], pol.ypoints[2]);
                }
            }
           
View Full Code Here

        this.drawPixel2D.clear();

        int i = 23;
        for (Polygon2D p : this.zuZeichnen) {
            g.setColor(new Color(120, 180, i));
            g.drawPolygon(p.toPol());
            i = (i + 101) % 256;
        }
        this.zuZeichnen.clear();
       
//        return super.generateEnvironmentView();
View Full Code Here

                   
                    g2.fillPolygon((Polygon) obj);
                }
                if (rahmenDrucken) {
                    g2.setColor(rahmenFarbe);
                    g2.drawPolygon((Polygon) obj);
                }
            } else if (obj.getClass().equals(Kreis2D.class)) {
                kreis = (Kreis2D) obj;
                if (fuellungDrucken) {
                    if (gp == null) {
View Full Code Here

        float epsilon = (float) 0.5;
       
        Rectangle2D r = new Rectangle2D(new Vector2D(0 - epsilon, 0 - epsilon), new Vector2D(width - epsilon, height - epsilon));
        LineSegment2D l = new LineSegment2D(new Vector2D(0 - epsilon, heightGO + epsilon), new Vector2D(this.getWidth() - epsilon, heightGO + epsilon));
        g.setColor(Color.red);
        g.drawPolygon(this.getPolygonInVisualization(l.toPol2D()).toPol());
        g.setStroke(new BasicStroke(5));
        g.setColor(Color.orange);
        g.drawPolygon(this.getPolygonInVisualization(r.toPol2D()).toPol());
       
        g.setColor(Color.black);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.