Examples of PSGraphics2D


Examples of org.apache.xmlgraphics.java2d.ps.PSGraphics2D

     * Draw a string to the PostScript document. The text is painted using
     * text operations.
     * {@inheritDoc}
     */
    public void drawString(Graphics2D g, String s, float x, float y) throws IOException {
        PSGraphics2D g2d = (PSGraphics2D)g;
        g2d.preparePainting();
        if (this.overrideFont == null) {
            java.awt.Font awtFont = g2d.getFont();
            this.font = createFont(awtFont);
        } else {
            this.font = this.overrideFont;
            this.overrideFont = null;
        }

        //Color and Font state
        g2d.establishColor(g2d.getColor());
        establishCurrentFont();

        PSGenerator gen = getPSGenerator();
        gen.saveGraphicsState();

        //Clip
        Shape imclip = g2d.getClip();
        g2d.writeClip(imclip);

        //Prepare correct transformation
        AffineTransform trans = g2d.getTransform();
        gen.concatMatrix(trans);
        gen.writeln(gen.formatDouble(x) + " "
                  + gen.formatDouble(y) + " moveto ");
        gen.writeln("1 -1 scale");

View Full Code Here

Examples of org.foray.graphic.batik.PSGraphics2D

        GraphicsNode root;
        root = builder.build(ctx, doc);
        ctx = null;
        builder = null;

        final PSGraphics2D graphics = new PSGraphics2D(false, cos, this.getLogger());
        graphics.setGraphicContext(new GraphicContext());
        root.paint(graphics);
    }
View Full Code Here

Examples of org.freehep.graphicsio.ps.PSGraphics2D

      else if (e.getActionCommand().equals("SUsave"))
      {
        Properties p = new Properties();
        p.setProperty("PageSize","A5");
        try{
          VectorGraphics g = new PSGraphics2D(new File("pics/SU_"+subexpNames.getString(currExp)+"_Pic"+picture+".eps"), new java.awt.Dimension(800,800));
          g.setProperties(p);
          g.startExport();
          //jpanel.print(g);
          Rectangle2D r2D = new Rectangle2D.Double(0,0, 800,800);
          chartsave.draw(g, r2D);
          g.endExport();
          picture++;
        }catch(Exception x)
        {
          x.printStackTrace();
          System.exit(-1);
        }
      }
      else if (e.getActionCommand().equals("MUsave"))
      {
        Properties p = new Properties();
        p.setProperty("PageSize","A5");
        try{
          VectorGraphics g = new PSGraphics2D(new File("pics/MU_"+subexpNames.getString(currExp)+"_Pic"+picture+".eps"), new java.awt.Dimension(800,800));
          g.setProperties(p);
          g.startExport();
          //jpanel.print(g);
          Rectangle2D r2D = new Rectangle2D.Double(0,0, 800,800);
          chartsave.draw(g, r2D);
          g.endExport();
          picture++;
        }catch(Exception x)
        {
          x.printStackTrace();
          System.exit(-1);
        }
      }
      else if (e.getActionCommand().equals("Fieldsave"))
      {
        Properties p = new Properties();
        p.setProperty("PageSize","A5");
        try{
          VectorGraphics g = new PSGraphics2D(new File("pics/Field_"+subexpNames.getString(currExp)+"_ID"+currField+"_Pic"+picture+".eps"), new java.awt.Dimension(800,800));
          g.setProperties(p);
          g.startExport();
          //jpanel.print(g);
          Rectangle2D r2D = new Rectangle2D.Double(0,0, 800,800);
          chartsave.draw(g, r2D);
          g.endExport();
          picture++;
        }catch(Exception x)
        {
          x.printStackTrace();
          System.exit(-1);
        }
      }
      else if (e.getActionCommand().equals("Vectorsave"))
      {
        Properties p = new Properties();
        p.setProperty("PageSize","A5");
        try{
          VectorGraphics g = new PSGraphics2D(new File("pics/Vector_"+subexpNames.getString(currExp)+"_ID"+currField+"_Pic"+picture+".eps"), new java.awt.Dimension(800,800));
          g.setProperties(p);
          g.startExport();
          //jpanel.print(g);
          Rectangle2D r2D = new Rectangle2D.Double(0,0, 800,800);
          chartsave.draw(g, r2D);
          g.endExport();
          picture++;
        }catch(Exception x)
        {
          x.printStackTrace();
          System.exit(-1);
        }
      }
      else if (e.getActionCommand().equals("Intrasave"))
      {
          Properties p = new Properties();
          p.setProperty("PageSize","A5");
          try{
            VectorGraphics g = new PSGraphics2D(new File("pics/Intracellular_"+subexpNames.getString(currExp)+"_ID"+currIntra+"_Pic"+picture+".eps"), new java.awt.Dimension(800,800));
            g.setProperties(p);
            g.startExport();
            Rectangle2D r2D = new Rectangle2D.Double(0,0, 800,800);
            chartsave.draw(g, r2D);
            g.endExport();
            picture++;
          }catch(Exception x)
          {
            x.printStackTrace();
            System.exit(-1);
View Full Code Here

Examples of org.freehep.graphicsio.ps.PSGraphics2D

      //JPanel jpanel = createMUPanel(0);
      for(int i = 0 ; i < numExp; i++)
      {
        PlotResult frame = new PlotResult("SU Raster SubExp "+i);
        JFreeChart jfreechart = frame.createSUChart(frame.readSu(i));
        VectorGraphics g = new PSGraphics2D(new File("pics/SU_sub"+i+".eps"), new java.awt.Dimension(xEdge+50,yEdge+50));
        g.setProperties(p);
        g.startExport();
        //jpanel.print(g);
        Rectangle2D r2D = new Rectangle2D.Double(0,0, xEdge+50,yEdge+50);
        jfreechart.draw(g, r2D);
        g.endExport();
      }

      for(int i = 0 ; i < numExp; i++)
      {
        PlotResult frame = new PlotResult("MU Rateplot SubExp "+i);
        JFreeChart jfreechart = frame.createMUChart(frame.readMU(i),i);
        VectorGraphics g = new PSGraphics2D(new File("pics/MU_sub"+i+".eps"), new java.awt.Dimension(xEdge+50,yEdge+50));
        g.setProperties(p);
        g.startExport();
        //jpanel.print(g);
        Rectangle2D r2D = new Rectangle2D.Double(0,0, xEdge+50,yEdge+50);
        jfreechart.draw(g, r2D);
        g.endExport();
      }

      for(int i = 0 ; i< numExp; i++)
      {
        for(int j=0; j< numField; j++)
        {
          PlotResult frame = new PlotResult("FieldPlot SubExp "+i+" Id "+j);
          frame.readField(i,j);
          frame.titleField= frame.fieldNames.getString(j);

          for(int k=0; k< frame.dataField.length; k++)
          {
            frame.currFrame = k;
            JFreeChart jfreechart = frame.createFieldChart();
            VectorGraphics g = new PSGraphics2D(new File("pics/field_sub"+i+"_id"+j+"_t"+k+".eps"), new java.awt.Dimension(xEdge+50,yEdge+50));
            g.setProperties(p);
            g.startExport();
            //jpanel.print(g);
            Rectangle2D r2D = new Rectangle2D.Double(0,0, xEdge+50,yEdge+50);
            jfreechart.draw(g, r2D);
            g.endExport();
          }
        }
      }


      for(int i = 0 ; i< numExp; i++)
      {
        for(int j=0; j< numVector; j++)
        {
          PlotResult frame = new PlotResult("VectorPlot SubExp "+i+" Id "+j);
          frame.readVector(i,j);

          frame.titleField= frame.vectorNames.getString(j);

          for(int k=0; k< frame.vectorDataField.length; k++)
          {
            frame.currFrame = k;
            JFreeChart jfreechart = frame.createVectorChart();
            VectorGraphics g = new PSGraphics2D(new File("pics/vector_sub"+i+"_id"+j+"_t"+k+".eps"), new java.awt.Dimension(xEdge+50,yEdge+50));
            g.setProperties(p);
            g.startExport();
            //jpanel.print(g);
            Rectangle2D r2D = new Rectangle2D.Double(0,0, xEdge+50,yEdge+50);
            jfreechart.draw(g, r2D);
            g.endExport();
          }
        }
      }
     
      for(int i = 0 ; i< numExp; i++)
      {
        for(int j=0; j< numIntra; j++)
        {
          PlotResult frame = new PlotResult("IntraPlot SubExp "+i+" Id "+j);
          frame.readIntra(i,j);

          frame.titleField= frame.intraNames.getString(j);

          JFreeChart jfreechart = frame.createIntraChart();
          VectorGraphics g = new PSGraphics2D(new File("pics/intra_sub"+i+"_id"+j+".eps"), new java.awt.Dimension(xEdge+50,yEdge+50));
          g.setProperties(p);
          g.startExport();
          //jpanel.print(g);
          Rectangle2D r2D = new Rectangle2D.Double(0,0, xEdge+50,yEdge+50);
          jfreechart.draw(g, r2D);
          g.endExport();
        }
      }


    }
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.