superwaba.ext.xplat.io.print
Class Graphics

java.lang.Object
  |
  +--superwaba.ext.xplat.io.print.Graphics

public abstract class Graphics
extends Object

This class is used to send graphic command to the printer. You can get an instance of it with the PrintManager.getGraphics method.

Very important! Some printers will not support drawing in an alleatory way. Try always to draw things from top to bottom.


Constructor Summary
protected Graphics()
          Package accessed constructor.
 
Method Summary
abstract  void drawImage(Image img, int x, int y)
          Draws an image as in the given position.
abstract  void drawImage(Image img, int x, int y, float scale)
          Draws an image scaled with the given scale.
abstract  void drawLine(int ax, int ay, int bx, int by)
          Draws a line from ax,ay to bx,by using the current foreground color.
abstract  void drawRect(int x, int y, int width, int height)
          Draws a rectangle with the given parameters using the current foreground color.
abstract  void drawRoundRect(int x, int y, int width, int height, int r)
          Draws a round rectangle with the given parameters using the current foreground color.
abstract  void drawText(String text, int x, int y)
          Draws the given text in the given position, using the currently selected font and using the current foreground color.
abstract  void fillRect(int x, int y, int width, int height)
          Fills a rectangle with the given parameters using the current background color.
abstract  void fillRoundRect(int x, int y, int width, int height, int r)
          Fills a round rectangle with the given parameters using the current background color.
abstract  void setBackColor(Color c)
          In most printers, setting from anything than Color.BLACK will turn gray what you draw.
abstract  void setFont(Font font)
          Sets the font to the given font.
abstract  void setForeColor(Color c)
          In most printers, setting from anything than Color.BLACK will turn gray what you draw.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, toString, wait, wait
 

Constructor Detail

Graphics

protected Graphics()
            throws NotSupportedException
Package accessed constructor. Use PrintManager.getGraphics() to get an instance of this object.
Method Detail

setFont

public abstract void setFont(Font font)
                      throws PrinterException,
                             NotSupportedException
Sets the font to the given font.

drawImage

public abstract void drawImage(Image img,
                               int x,
                               int y)
                        throws PrinterException,
                               NotSupportedException
Draws an image as in the given position. Note that in Palm OS < 3.5, the image is converted to black and white before printing. Also, some printers may not support grayscale or color images even in newer Palm OS versions.

drawImage

public abstract void drawImage(Image img,
                               int x,
                               int y,
                               float scale)
                        throws PrinterException,
                               NotSupportedException
Draws an image scaled with the given scale. You may use values like 2 or 0.5. Not all printers support this feature

drawText

public abstract void drawText(String text,
                              int x,
                              int y)
                       throws PrinterException,
                              NotSupportedException
Draws the given text in the given position, using the currently selected font and using the current foreground color.

setForeColor

public abstract void setForeColor(Color c)
In most printers, setting from anything than Color.BLACK will turn gray what you draw.

setBackColor

public abstract void setBackColor(Color c)
In most printers, setting from anything than Color.BLACK will turn gray what you draw.

drawLine

public abstract void drawLine(int ax,
                              int ay,
                              int bx,
                              int by)
                       throws PrinterException,
                              NotSupportedException
Draws a line from ax,ay to bx,by using the current foreground color. Note that some printers do not support diagonal lines.

drawRoundRect

public abstract void drawRoundRect(int x,
                                   int y,
                                   int width,
                                   int height,
                                   int r)
                            throws PrinterException,
                                   NotSupportedException
Draws a round rectangle with the given parameters using the current foreground color.

drawRect

public abstract void drawRect(int x,
                              int y,
                              int width,
                              int height)
                       throws PrinterException,
                              NotSupportedException
Draws a rectangle with the given parameters using the current foreground color.

fillRoundRect

public abstract void fillRoundRect(int x,
                                   int y,
                                   int width,
                                   int height,
                                   int r)
                            throws PrinterException,
                                   NotSupportedException
Fills a round rectangle with the given parameters using the current background color.

fillRect

public abstract void fillRect(int x,
                              int y,
                              int width,
                              int height)
                       throws PrinterException,
                              NotSupportedException
Fills a rectangle with the given parameters using the current background color.