0 Replies Latest reply: Apr 1, 2013 1:28 AM by 1000229 RSS

    ugly shapes&strokes when scaling Graphics g in printing...

    1000229
      in my application i have to print viewports which I position and size on paper layout by transforming the graphics context given to the print function as follows

      public int print(Graphics g,PageFormat pf,int pageIndex)
      {
      if( 0 == pageIndex )
      {
      Graphics2D g2d = (Graphics2D)g;

      g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
      g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
      g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
      g2d.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE);
      g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION,RenderingHints.VALUE_INTERPOLATION_BICUBIC);
      .
      .
      .
      .
      .
      g2d.scale(scale,scale);
      g2d.translate(xo, yo);

      ...printViewports( g2d );
      return Printable.PAGE_EXISTS;
      }
      return Printable.NO_SUCH_PAGE;
      }

      by the scaling I get ugly shapes and strokes e.g. circles outlines look very segmented etc., so what is wrong ?