Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6498340

Java 2D Printing: Peek does not check for translucent colours and paints in AttributedString.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 7
    • 1.2.2
    • client-libs
    • 2d
    • b08
    • generic
    • generic
    • Verified

      The code that 'peeks' at all print rendering to see if it needs to be handled as
      a raster does not (and never has) checked to see if there is a translucent Color :
      eg
             Color c = new Color(0,0,0,64);
      or Paint, eg :
              Paint p = new GradientPaint(0f, 0f, Color.green, 10f, 10f, Color.red, true);

      used : eg
              AttributedString as = new AttributedString("Sample Text");
              as.addAttribute(TextAttribute.FOREGROUND, p);
              graphics.drawString(as.getIterator(), 20, 50);

      In the case of a translucent colour, then the translucency is lost.
      In the case of a Paint: an exception is thrown, eg :

              at sun.print.PathGraphics.fill(PathGraphics.java:929)
              at sun.print.PathGraphics.drawGlyphVector(PathGraphics.java:614)
              at sun.font.ExtendedTextSourceLabel.handleDraw(ExtendedTextSourceLabel.java:131)
              at sun.font.Decoration$DecorationImpl.drawTextAndEmbellishments(Decoration.java:235)
              at sun.font.Decoration$DecorationImpl.drawTextAndDecorations(Decoration.java:300)
              at sun.font.ExtendedTextSourceLabel.draw(ExtendedTextSourceLabel.java:135)
              at java.awt.font.TextLine.draw(TextLine.java:550)
              at java.awt.font.TextLayout.draw(TextLayout.java:2699)
              at sun.print.PathGraphics.drawString(PathGraphics.java:590)
              at sun.print.PathGraphics.drawString(PathGraphics.java:580)
              at PAS.paint(PAS.java:85)
              at PAS.print(PAS.java:64)
              at sun.print.RasterPrinterJob.printPage(RasterPrinterJob.java:1811)
              at sun.print.RasterPrinterJob.print(RasterPrinterJob.java:1334)
              at sun.print.RasterPrinterJob.print(RasterPrinterJob.java:1196)
              at PAS.main(PAS.java:43)

            prr Philip Race
            prr Philip Race
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: