< prev index next >

src/java.desktop/share/classes/sun/print/PSPathGraphics.java

Print this page




 109      * @see         java.awt.Graphics#drawBytes
 110      * @see         java.awt.Graphics#drawChars
 111      * @since       1.0
 112      */
 113     public void drawString(String str, int x, int y) {
 114         drawString(str, (float) x, (float) y);
 115     }
 116 
 117     /**
 118      * Renders the text specified by the specified <code>String</code>,
 119      * using the current <code>Font</code> and <code>Paint</code> attributes
 120      * in the <code>Graphics2D</code> context.
 121      * The baseline of the first character is at position
 122      * (<i>x</i>,&nbsp;<i>y</i>) in the User Space.
 123      * The rendering attributes applied include the <code>Clip</code>,
 124      * <code>Transform</code>, <code>Paint</code>, <code>Font</code> and
 125      * <code>Composite</code> attributes. For characters in script systems
 126      * such as Hebrew and Arabic, the glyphs can be rendered from right to
 127      * left, in which case the coordinate supplied is the location of the
 128      * leftmost character on the baseline.
 129      * @param s the <code>String</code> to be rendered
 130      * @param x,&nbsp;y the coordinates where the <code>String</code>
 131      * should be rendered
 132      * @see #setPaint
 133      * @see java.awt.Graphics#setColor
 134      * @see java.awt.Graphics#setFont
 135      * @see #setTransform
 136      * @see #setComposite
 137      * @see #setClip
 138      */
 139      public void drawString(String str, float x, float y) {
 140          drawString(str, x, y, getFont(), getFontRenderContext(), 0f);
 141      }
 142 
 143 
 144     protected boolean canDrawStringToWidth() {
 145         return true;
 146     }
 147 
 148     protected int platformFontCount(Font font, String str) {
 149         PSPrinterJob psPrinterJob = (PSPrinterJob) getPrinterJob();


 239                 setFont(oldFont);
 240                 oldFont = null;
 241             }
 242             super.drawString(str, x, y, font, frc, w);
 243         }
 244 
 245         if (oldFont != null) {
 246             setFont(oldFont);
 247         }
 248     }
 249 
 250     /**
 251      * The various <code>drawImage()</code> methods for
 252      * <code>WPathGraphics</code> are all decomposed
 253      * into an invocation of <code>drawImageToPlatform</code>.
 254      * The portion of the passed in image defined by
 255      * <code>srcX, srcY, srcWidth, and srcHeight</code>
 256      * is transformed by the supplied AffineTransform and
 257      * drawn using PS to the printer context.
 258      *
 259      * @param   img     The image to be drawn.
 260      *                  This method does nothing if <code>img</code> is null.
 261      * @param   xform   Used to transform the image before drawing.
 262      *                  This can be null.
 263      * @param   bgcolor This color is drawn where the image has transparent
 264      *                  pixels. If this parameter is null then the
 265      *                  pixels already in the destination should show
 266      *                  through.
 267      * @param   srcX    With srcY this defines the upper-left corner
 268      *                  of the portion of the image to be drawn.
 269      *
 270      * @param   srcY    With srcX this defines the upper-left corner
 271      *                  of the portion of the image to be drawn.
 272      * @param   srcWidth    The width of the portion of the image to
 273      *                      be drawn.
 274      * @param   srcHeight   The height of the portion of the image to
 275      *                      be drawn.
 276      * @param   handlingTransparency if being recursively called to
 277      *                    print opaque region of transparent image
 278      */
 279     protected boolean drawImageToPlatform(Image image, AffineTransform xform,




 109      * @see         java.awt.Graphics#drawBytes
 110      * @see         java.awt.Graphics#drawChars
 111      * @since       1.0
 112      */
 113     public void drawString(String str, int x, int y) {
 114         drawString(str, (float) x, (float) y);
 115     }
 116 
 117     /**
 118      * Renders the text specified by the specified <code>String</code>,
 119      * using the current <code>Font</code> and <code>Paint</code> attributes
 120      * in the <code>Graphics2D</code> context.
 121      * The baseline of the first character is at position
 122      * (<i>x</i>,&nbsp;<i>y</i>) in the User Space.
 123      * The rendering attributes applied include the <code>Clip</code>,
 124      * <code>Transform</code>, <code>Paint</code>, <code>Font</code> and
 125      * <code>Composite</code> attributes. For characters in script systems
 126      * such as Hebrew and Arabic, the glyphs can be rendered from right to
 127      * left, in which case the coordinate supplied is the location of the
 128      * leftmost character on the baseline.
 129      * @param str the <code>String</code> to be rendered
 130      * @param x,&nbsp;y the coordinates where the <code>String</code>
 131      * should be rendered
 132      * @see #setPaint
 133      * @see java.awt.Graphics#setColor
 134      * @see java.awt.Graphics#setFont
 135      * @see #setTransform
 136      * @see #setComposite
 137      * @see #setClip
 138      */
 139      public void drawString(String str, float x, float y) {
 140          drawString(str, x, y, getFont(), getFontRenderContext(), 0f);
 141      }
 142 
 143 
 144     protected boolean canDrawStringToWidth() {
 145         return true;
 146     }
 147 
 148     protected int platformFontCount(Font font, String str) {
 149         PSPrinterJob psPrinterJob = (PSPrinterJob) getPrinterJob();


 239                 setFont(oldFont);
 240                 oldFont = null;
 241             }
 242             super.drawString(str, x, y, font, frc, w);
 243         }
 244 
 245         if (oldFont != null) {
 246             setFont(oldFont);
 247         }
 248     }
 249 
 250     /**
 251      * The various <code>drawImage()</code> methods for
 252      * <code>WPathGraphics</code> are all decomposed
 253      * into an invocation of <code>drawImageToPlatform</code>.
 254      * The portion of the passed in image defined by
 255      * <code>srcX, srcY, srcWidth, and srcHeight</code>
 256      * is transformed by the supplied AffineTransform and
 257      * drawn using PS to the printer context.
 258      *
 259      * @param   image   The image to be drawn.
 260      *                  This method does nothing if <code>img</code> is null.
 261      * @param   xform   Used to transform the image before drawing.
 262      *                  This can be null.
 263      * @param   bgcolor This color is drawn where the image has transparent
 264      *                  pixels. If this parameter is null then the
 265      *                  pixels already in the destination should show
 266      *                  through.
 267      * @param   srcX    With srcY this defines the upper-left corner
 268      *                  of the portion of the image to be drawn.
 269      *
 270      * @param   srcY    With srcX this defines the upper-left corner
 271      *                  of the portion of the image to be drawn.
 272      * @param   srcWidth    The width of the portion of the image to
 273      *                      be drawn.
 274      * @param   srcHeight   The height of the portion of the image to
 275      *                      be drawn.
 276      * @param   handlingTransparency if being recursively called to
 277      *                    print opaque region of transparent image
 278      */
 279     protected boolean drawImageToPlatform(Image image, AffineTransform xform,


< prev index next >