Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.java4less.rchart.gc
Class ChartGraphics

    java.lang.Object
      |
      +--com.java4less.rchart.gc.ChartGraphics

public abstract class ChartGraphics
extends java.lang.Object

    Wrapper for the AWT or SWT Graphic context class. Use GraphicsProvider.getGraphics() to create an instance of this class.
     This class allows rchart to work independtly from AWT and SWT.

Field Summary
`static int` | `ROTATE_CENTER` rotation center for rotating images
`static int` | `ROTATE_LEFTTOP`
`static int` | `STROKE_DASHED` style of line
`static int` | `STROKE_DOTTED` style of line
`static int` | `STROKE_NORMAL` style of line

Constructor Summary
`ChartGraphics()`

Method Summary
`void` | `createFadeArea(ChartColor colorFrom, ChartColor colorUntil, int x, int y, int w, int h, boolean vertical, boolean cyclic)` creates a gradient filling
`void` | `dispose()` dispose graphic context.
`void` | `drawArc(int x, int y, int w, int h, int a1, int a2)` paints an arc
`void` | `drawImage(ChartImage image, int x, int y)` paint image at given position
`void` | `drawImage(ChartImage image, int x1Dest, int y1Dest, int x2Dest, int y2Dest, int x1Source, int y1Source, int x2Source, int y2Source)` paint image from source position to destination position
`void` | `drawLine(int x1, int y1, int x2, int y2)` paint a line
`void` | `drawLineWithStyle(int x1, int y1, int x2, int y2)`
`void` | `drawPolygon(int[] x1, int[] y1, int count)` draw polygon
`void` | `drawRect(int x1, int y1, int w, int h)` draw rectangle
`boolean` | `drawRotatedText(ChartFont descFont, ChartColor descColor, java.lang.String txt, int angle, int x, int y, boolean b)` paint rotated text
`void` | `drawRoundedRect(int x1, int y1, int w, int h)` draw rounded rectangle
`void` | `drawString(java.lang.String s, int x, int y)` draw string at position x,y
`void` | `fillArc(int x, int y, int w, int h, int a1, int a2)` Fills an arc
`void` | `fillPolygon(int[] x1, int[] y1, int count)` fill polygon
`void` | `fillRect(int x1, int y1, int w, int h)` fill rectangle
`void` | `fillRoundRect(int x1, int y1, int w, int h)` fill rectangle with rounded corners
`java.lang.Object` | `getAlphaComposite()` get transparency value
`ChartColor` | `getColor()` get current color in context
`ChartFont` | `getFont()` get current font in context
`int` | `getFontHeight()` get the height of the current font
`int` | `getFontHeight(ChartFont font)` get the height of the current font
`int` | `getFontWidth(ChartFont font, java.lang.String s)` get the width of a string using the provided font
`int` | `getFontWidth(java.lang.String s)` get the width of a string using the current font
`void` | `paintRotatedImage(ChartImage srcImage, int angle, int x, int y, int alginment)` rotate image and paint it
`void` | `setAlpha(float a)` set transparency value
`void` | `setAlphaComposite(java.lang.Object a)` set transparency value
`void` | `setColor(ChartColor color)` set current color in context
`void` | `setFont(ChartFont font)` set current font in context
`void` | `setLineStyle(int style)` sets style of line
`void` | `setLineWidth(int w)` sets style of line
`void` | `setTexture(ChartImage image)` image for texture painting.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### STROKE_NORMAL

    public static int STROKE_NORMAL

  style of line

### STROKE_DOTTED

    public static int STROKE_DOTTED

  style of line

### STROKE_DASHED

    public static int STROKE_DASHED

  style of line

### ROTATE_CENTER

    public static int ROTATE_CENTER

  rotation center for rotating images

### ROTATE_LEFTTOP

    public static int ROTATE_LEFTTOP

Constructor Detail

### ChartGraphics

    public ChartGraphics()

Method Detail

### setColor

    public void setColor(ChartColor color)

  set current color in context

  Parameters:
    `color` -

### setFont

    public void setFont(ChartFont font)

  set current font in context

### getColor

    public ChartColor getColor()

  get current color in context

  Returns:
    color

### getFont

    public ChartFont getFont()

  get current font in context

  Returns:
    f

### setTexture

    public void setTexture(ChartImage image)

  image for texture painting. This texture will be used for the next filling operation

### drawArc

    public void drawArc(int x,
                        int y,
                        int w,
                        int h,
                        int a1,
                        int a2)

  paints an arc

  Parameters:
    `x` - top left corner of the rectangle
    `y` - top left corner of the rectangle
    `w` - width of the rectngle
    `h` - height of the rectangle
    `a1` - start arc
    `a2` - end arc

### drawLine

    public void drawLine(int x1,
                         int y1,
                         int x2,
                         int y2)

  paint a line

  Parameters:
    `x1` - start position
    `y1` - start position
    `x2` - end position
    `y2` - end position

### getFontHeight

    public int getFontHeight()

  get the height of the current font

  Returns:

### getFontHeight

    public int getFontHeight(ChartFont font)

  get the height of the current font

  Returns:

### getFontWidth

    public int getFontWidth(ChartFont font,
                            java.lang.String s)

  get the width of a string using the provided font

  Returns:

### getFontWidth

    public int getFontWidth(java.lang.String s)

  get the width of a string using the current font

  Returns:

### drawRotatedText

    public boolean drawRotatedText(ChartFont descFont,
                                   ChartColor descColor,
                                   java.lang.String txt,
                                   int angle,
                                   int x,
                                   int y,
                                   boolean b)

  paint rotated text

  Parameters:
    `txt` -
    `angle` -
    `x` -
    `y` -
    `b` -

### drawString

    public void drawString(java.lang.String s,
                           int x,
                           int y)

  draw string at position x,y

  Parameters:
    `s` - value to paint
    `x` - position
    `y` - position

### drawImage

    public void drawImage(ChartImage image,
                          int x,
                          int y)

  paint image at given position

  Parameters:
    `image` - image to paint
    `x` - position
    `y` - position

### drawImage

    public void drawImage(ChartImage image,
                          int x1Dest,
                          int y1Dest,
                          int x2Dest,
                          int y2Dest,
                          int x1Source,
                          int y1Source,
                          int x2Source,
                          int y2Source)

  paint image from source position to destination position

  Parameters:
    `image` -
    `x1Dest` -
    `y1Dest` -
    `x2Dest` -
    `y2Dest` -
    `x1Source` -
    `y1Source` -
    `x2Source` -
    `y2Source` -

### fillPolygon

    public void fillPolygon(int[] x1,
                            int[] y1,
                            int count)

  fill polygon

  Parameters:
    `x1` - array of X values
    `y1` - array of Y values
    `count` - number of points

### fillRect

    public void fillRect(int x1,
                         int y1,
                         int w,
                         int h)

  fill rectangle

  Parameters:
    `x1` - top left corner position
    `y1` - top left corner position
    `w` - with of rectangle
    `h` - height of rectangle

### fillRoundRect

    public void fillRoundRect(int x1,
                              int y1,
                              int w,
                              int h)

  fill rectangle with rounded corners

  Parameters:
    `x1` - top left corner position
    `y1` - top left corner position
    `w` - with of rectangle
    `h` - height of rectangle

### drawPolygon

    public void drawPolygon(int[] x1,
                            int[] y1,
                            int count)

  draw polygon

  Parameters:
    `x1` - array of X values
    `y1` - array of Y values
    `count` - number of points

### drawRect

    public void drawRect(int x1,
                         int y1,
                         int w,
                         int h)

  draw rectangle

  Parameters:
    `x1` - top left corner position
    `y1` - top left corner position
    `w` - with of rectangle
    `h` - height of rectangle

### drawRoundedRect

    public void drawRoundedRect(int x1,
                                int y1,
                                int w,
                                int h)

  draw rounded rectangle

  Parameters:
    `x1` - top left corner position
    `y1` - top left corner position
    `w` - with of rectangle
    `h` - height of rectangle

### createFadeArea

    public void createFadeArea(ChartColor colorFrom,
                               ChartColor colorUntil,
                               int x,
                               int y,
                               int w,
                               int h,
                               boolean vertical,
                               boolean cyclic)

  creates a gradient filling

  Parameters:
    `colorFrom` -
    `colorUntil` -
    `x` - top left corner position
    `y` - top left corner position
    `w` - with of rectangle
    `h` - height of rectangle
    `vertical` - vertical gradient?

### fillArc

    public void fillArc(int x,
                        int y,
                        int w,
                        int h,
                        int a1,
                        int a2)

  Fills an arc

  Parameters:
    `x` - top left corner of the rectangle
    `y` - top left corner of the rectangle
    `w` - width of the rectngle
    `h` - height of the rectangle
    `a1` - start arc
    `a2` - end arc

### setAlpha

    public void setAlpha(float a)

  set transparency value

### setAlphaComposite

    public void setAlphaComposite(java.lang.Object a)

  set transparency value

### getAlphaComposite

    public java.lang.Object getAlphaComposite()

  get transparency value

  Returns:
    alpha current AWT Alpha Composite value

### setLineStyle

    public void setLineStyle(int style)

  sets style of line

  Parameters:
    `style` -

### setLineWidth

    public void setLineWidth(int w)

  sets style of line

### dispose

    public void dispose()

  dispose graphic context. You need to call this if you use SWT.

### paintRotatedImage

    public void paintRotatedImage(ChartImage srcImage,
                                  int angle,
                                  int x,
                                  int y,
                                  int alginment)

  rotate image and paint it

  Parameters:
    `srcImage` - source image (must be a square, width=height)
    `angle` - angle
    `x` - position where image must be painted
    `y` - position where image must be painted

### drawLineWithStyle

    public void drawLineWithStyle(int x1,
                                  int y1,
                                  int x2,
                                  int y2)

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD