# Class JsG2D

java.lang.Object
jspecview.js2d.JsG2D

All Implemented Interfaces:
  `GenericGraphics`

public class JsG2D extends Object implements GenericGraphics
generic 2D drawing methods for JSpecView -- JavaScript version

Author:
  Bob Hanson hansonr@stolaf.edu

## Constructor Summary

Constructors
Constructor
Description
`JsG2D()`

## Method Summary

Modifier and Type
Method
Description
`boolean`
`canDoLineTo()`
`void`
`doStroke(Object g, boolean isBegin)`
`void`
`drawCircle(Object g, int x, int y, int diameter)`
`void`
`drawGrayScaleImage(Object g, Object image, int destX0, int destY0, int destX1, int destY1, int srcX0, int srcY0, int srcX1, int srcY1)`
`void`
`drawLine(Object g, int x0, int y0, int x1, int y1)`
`void`
`drawPolygon(Object g, int[] ayPoints, int[] axPoints, int nPoints)`
`void`
`drawRect(Object g, int x, int y, int width, int height)`
`void`
`drawString(Object g, String s, int x, int y)`
`void`
`drawStringRotated(Object g, String s, int x, int y, double angle)`
`void`
`fillBackground(Object g, GenericColor bgcolor)`
`void`
`fillCircle(Object g, int x, int y, int diameter)`
`void`
`fillPolygon(Object g, int[] ayPoints, int[] axPoints, int nPoints)`
`void`
`fillRect(Object g, int x, int y, int width, int height)`
`GenericColor`
`getColor1(int rgb)`
`GenericColor`
`getColor3(int r, int g, int b)`
`GenericColor`
`getColor4(int r, int g, int b, int a)`
`void`
`lineTo(Object g, int x2, int y2)`
`Object`
`newGrayScaleImage(Object context, Object image, int width, int height, int[] grayBuffer)`
`Font`
`setFont(Object g, Font font)`
`void`
`setGraphicsColor(Object g, GenericColor c)`
`void`
`setStrokeBold(Object g, boolean tf)`
`void`
`setWindowParameters(int width, int height)`
`void`
`translateScale(Object g, double x, double y, double scale)`

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### JsG2D

public JsG2D()

## Method Details

### getColor4

public GenericColor getColor4(int r, int g, int b, int a)

Specified by:
  `getColor4` in interface `GenericGraphics`

### getColor3

public GenericColor getColor3(int r, int g, int b)

Specified by:
  `getColor3` in interface `GenericGraphics`

### getColor1

public GenericColor getColor1(int rgb)

Specified by:
  `getColor1` in interface `GenericGraphics`

### newGrayScaleImage

public Object newGrayScaleImage(Object context, Object image, int width, int height, int[] grayBuffer)

Specified by:
  `newGrayScaleImage` in interface `GenericGraphics`

### drawGrayScaleImage

public void drawGrayScaleImage(Object g, Object image, int destX0, int destY0, int destX1, int destY1, int srcX0, int srcY0, int srcX1, int srcY1)

Specified by:
  `drawGrayScaleImage` in interface `GenericGraphics`

### drawLine

public void drawLine(Object g, int x0, int y0, int x1, int y1)

Specified by:
  `drawLine` in interface `GenericGraphics`

### drawCircle

public void drawCircle(Object g, int x, int y, int diameter)

Specified by:
  `drawCircle` in interface `GenericGraphics`

### drawPolygon

public void drawPolygon(Object g, int[] ayPoints, int[] axPoints, int nPoints)

Specified by:
  `drawPolygon` in interface `GenericGraphics`

### drawRect

public void drawRect(Object g, int x, int y, int width, int height)

Specified by:
  `drawRect` in interface `GenericGraphics`

### drawString

public void drawString(Object g, String s, int x, int y)

Specified by:
  `drawString` in interface `GenericGraphics`

### drawStringRotated

public void drawStringRotated(Object g, String s, int x, int y, double angle)

Specified by:
  `drawStringRotated` in interface `GenericGraphics`

### fillBackground

public void fillBackground(Object g, GenericColor bgcolor)

Specified by:
  `fillBackground` in interface `GenericGraphics`

### fillCircle

public void fillCircle(Object g, int x, int y, int diameter)

Specified by:
  `fillCircle` in interface `GenericGraphics`

### fillPolygon

public void fillPolygon(Object g, int[] ayPoints, int[] axPoints, int nPoints)

Specified by:
  `fillPolygon` in interface `GenericGraphics`

### fillRect

public void fillRect(Object g, int x, int y, int width, int height)

Specified by:
  `fillRect` in interface `GenericGraphics`

### setGraphicsColor

public void setGraphicsColor(Object g, GenericColor c)

Specified by:
  `setGraphicsColor` in interface `GenericGraphics`

### setFont

public Font setFont(Object g, Font font)

Specified by:
  `setFont` in interface `GenericGraphics`

### setStrokeBold

public void setStrokeBold(Object g, boolean tf)

Specified by:
  `setStrokeBold` in interface `GenericGraphics`

### setWindowParameters

public void setWindowParameters(int width, int height)

Specified by:
  `setWindowParameters` in interface `GenericGraphics`

### translateScale

public void translateScale(Object g, double x, double y, double scale)

Specified by:
  `translateScale` in interface `GenericGraphics`

### canDoLineTo

public boolean canDoLineTo()

Specified by:
  `canDoLineTo` in interface `GenericGraphics`

### doStroke

public void doStroke(Object g, boolean isBegin)

Specified by:
  `doStroke` in interface `GenericGraphics`

### lineTo

public void lineTo(Object g, int x2, int y2)

Specified by:
  `lineTo` in interface `GenericGraphics`