# Class GData

java.lang.Object
org.jmol.util.GData

All Implemented Interfaces:
  `JmolGraphicsInterface`

Direct Known Subclasses:
  `Graphics3D`

public class GData extends Object implements JmolGraphicsInterface

## Field Summary

Fields
Modifier and Type
Field
Description
`int`
`ambientOcclusion`
`boolean`
`antialiasEnabled`
`protected boolean`
`antialiasThisFrame`
`GenericPlatform`
`apiPlatform`
`int`
`argbCurrent`
`int`
`argbNoisyDn`
`int`
`argbNoisyUp`
`protected Object`
`backgroundImage`
`int`
`bgcolor`
`int`
`bufferSize`
`protected short[]`
`changeableColixMap`
`protected short`
`colixCurrent`
`protected short`
`contrastColix`
WHITE or BLACK
`protected Font`
`currentFont`
`boolean`
`currentlyRendering`
`int`
`depth`
`protected int`
`displayMaxX`
`protected int`
`displayMaxX2`
`protected int`
`displayMaxY`
`protected int`
`displayMaxY2`
`protected int`
`displayMinX`
`protected int`
`displayMinX2`
`protected int`
`displayMinY`
`protected int`
`displayMinY2`
`static final byte`
`ENDCAPS_FLAT`
`static final byte`
`ENDCAPS_FLAT_TO_SPHERICAL`
`static final byte`
`ENDCAPS_HIDDEN`
`static final byte`
`ENDCAPS_NONE`
`static final byte`
`ENDCAPS_OPEN_TO_SPHERICAL`
`static final byte`
`ENDCAPS_SPHERICAL`
`static final int`
`EXPORT_CARTESIAN`
`static final int`
`EXPORT_NOT`
`static final int`
`EXPORT_RAYTRACER`
`protected Object`
`graphicsForMetrics`
`int`
`height`
`protected int`
`ht3`
`static final int`
`HUGE`
`protected boolean`
`inGreyscaleMode`
`boolean`
`isPass2`
`protected boolean`
`newAntialiasing`
`protected int`
`newWindowHeight`
`protected int`
`newWindowWidth`
`protected static short`
`normixCount`
`Shader`
`shader`
`int`
`slab`
`protected int`
`textY`
`protected V3[]`
`transformedVectors`
`boolean`
`translucentCoverOnly`
`protected Viewer`
`vwr`
`int`
`width`
`protected int`
`windowHeight`
`protected int`
`windowWidth`
`static final int`
`xGT`
`int`
`xLast`
`static final int`
`xLT`
`static final int`
`yGT`
`int`
`yLast`
`static final int`
`yLT`
`static final int`
`zGT`
`static final int`
`zLT`

## Constructor Summary

Constructors
Constructor
Description
`GData()`
It is possible to instantiate this class with no Graphics3D.

## Method Summary

Modifier and Type
Method
Description
`void`
`addRenderer(int tok)`
`void`
`applyAnaglygh(STER stereoMode, int[] stereoColors)`
`void`
`beginRendering(M3 stereoRotationMatrix, boolean translucentMode, boolean isImageWrite, boolean renderLow)`
`void`
`changeColixArgb(int id, int argb)`
`void`
`clear()`
`void`
`clearFontCache()`
`int`
`clipCode(int z)`
`int`
`clipCode3(int x, int y, int z)`
`void`
`destroy()`
`void`
`drawLinePixels(P3i sA, P3i sB, int z, int zslab)`
`void`
`drawQuadrilateralBits(JmolRendererInterface jmolRenderer, short colix, P3 screenA, P3 screenB, P3 screenC, P3 screenD)`
`void`
`drawTriangleBits(JmolRendererInterface renderer, P3 screenA, short colixA, P3 screenB, short colixB, P3 screenC, short colixC, int check)`
`void`
`endRendering()`
`int`
`getAmbientPercent()`
`boolean`
`getCel()`
`int`
`getCelPower()`
`short`
`getChangeableColix(int id, int argb)`
`int`
`getColorArgbOrGray(short colix)`
`int`
`getDiffusePercent()`
`Font`
`getFont3D(float fontSize)`
`Font`
`getFont3DCurrent()`
`Font`
`getFont3DFS(String fontFace, float fontSize)`
`Font`
`getFont3DFSS(String fontFace, String fontStyle, float fontSize)`
`Font`
`getFont3DScaled(Font font, float scale)`
`int`
`getFontFidFS(String fontFace, float fontSize)`
`int`
`getFontFidI(float fontSize)`
`static void`
`getHermiteList(int tension, T3 p0, T3 p1, T3 p2, T3 p3, T3 p4, T3[] list, int index0, int n, boolean isPt)`
Used by Navigator, BioShapeRenderer, and DrawRenderer
`V3`
`getLightSource()`
`int`
`getPhongExponent()`
`Object`
`getScreenImage(boolean isImageWrite)`
`int[]`
`getShades(short colix)`
`boolean`
`getSpecular()`
`int`
`getSpecularExponent()`
`int`
`getSpecularPercent()`
`int`
`getSpecularPower()`
`int`
`getTextPosition()`
`V3[]`
`getTransformedVertexVectors()`
`void`
`initialize(Viewer vwr, GenericPlatform apiPlatform)`
`boolean`
`isAntialiased()`
is full scene / oversampling antialiasing in effect
`boolean`
`isClipped(int x, int y)`
`boolean`
`isClipped3(int x, int y, int z)`
`boolean`
`isClippedXY(int diameter, int x, int y)`
`boolean`
`isClippedZ(int z)`
`boolean`
`isDirectedTowardsCamera(short normix)`
`boolean`
`isInDisplayRange(int x, int y)`
`void`
`plotImage(int x, int y, int z, Object image, JmolRendererInterface jmolRenderer, short bgcolix, int width, int height)`
`void`
`plotText(int x, int y, int z, int colorArgbOrGray, int bgColor, String text, Font font3d, JmolRendererInterface jmolRenderer)`
`void`
`releaseScreenImage()`
`void`
`renderAllStrings(Object jmolRenderer)`
`void`
`renderBackground(JmolRendererInterface jmolRenderer)`
`static int`
`roundInt(int a)`
JavaScript won't really have an integer here after integer division.
`void`
`setAmbientOcclusion(int value)`
`void`
`setAmbientPercent(int val)`
fractional distance from black for ambient color
`void`
`setBackgroundArgb(int argb)`
sets background color to the specified argb value
`void`
`setBackgroundImage(Object image)`
`void`
`setBackgroundTransparent(boolean TF)`
`boolean`
`setC(short colix)`
`void`
`setCel(boolean val)`
`void`
`setCelPower(int celPower)`
`void`
`setColor(int argb)`
`void`
`setDepth(int depthValue)`
clipping from the front and the back
`void`
`setDiffusePercent(int val)`
df in I = df * (N dot L) + sf * (R dot V)^p
`void`
`setFont(Font font3d)`
`void`
`setFontBold(String fontFace, float fontSize)`
`void`
`setGreyscaleMode(boolean greyscaleMode)`
controls greyscale rendering
`void`
`setNewWindowParametersForExport()`
`boolean`
`setPass2(boolean antialias)`
`void`
`setPhongExponent(int val)`
p in I = df * (N dot L) + sf * (R dot V)^p
`void`
`setSlab(int slabValue)`
clipping from the front and the back
`void`
`setSlabAndZShade(int slab, int depth, int zSlab, int zDepth, int zPower)`
`void`
`setSpecular(boolean val)`
`void`
`setSpecularExponent(int val)`
log_2(p) in I = df * (N dot L) + sf * (R dot V)^p for faster calculation of shades
`void`
`setSpecularPercent(int val)`
sf in I = df * (N dot L) + sf * (R dot V)^p not a percent of anything, really
`void`
`setSpecularPower(int val)`
fractional distance to white for specular dot
`void`
`setTextPosition(int y)`
`protected void`
`setWidthHeight(boolean isAntialiased)`
`void`
`setWindowParameters(int width, int height, boolean antialias)`
`protected void`
`setWinParams(int width, int height, boolean antialias)`
`void`
`snapshotAnaglyphChannelBytes()`

### Methods inherited from class Object

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

## Field Details

### apiPlatform

public GenericPlatform apiPlatform

### translucentCoverOnly

public boolean translucentCoverOnly

### currentlyRendering

public boolean currentlyRendering

### antialiasEnabled

public boolean antialiasEnabled

### windowWidth

protected int windowWidth

### windowHeight

protected int windowHeight

### displayMinX

protected int displayMinX

### displayMaxX

protected int displayMaxX

### displayMinY

protected int displayMinY

### displayMaxY

protected int displayMaxY

### displayMinX2

protected int displayMinX2

### displayMaxX2

protected int displayMaxX2

### displayMinY2

protected int displayMinY2

### displayMaxY2

protected int displayMaxY2

### antialiasThisFrame

protected boolean antialiasThisFrame

### inGreyscaleMode

protected boolean inGreyscaleMode

### changeableColixMap

protected short[] changeableColixMap

### backgroundImage

protected Object backgroundImage

### newWindowWidth

protected int newWindowWidth

### newWindowHeight

protected int newWindowHeight

### newAntialiasing

protected boolean newAntialiasing

### bgcolor

public int bgcolor

### contrastColix

protected short contrastColix
WHITE or BLACK

### xLast

public int xLast

### yLast

public int yLast

### slab

public int slab

### depth

public int depth

### width

public int width

### height

public int height

### ambientOcclusion

public int ambientOcclusion

### colixCurrent

protected short colixCurrent

### argbCurrent

public int argbCurrent

### ht3

protected int ht3

### isPass2

public boolean isPass2

### textY

protected int textY

### bufferSize

public int bufferSize

### shader

public Shader shader

### vwr

protected Viewer vwr

### ENDCAPS_NONE

public static final byte ENDCAPS_NONE

See Also:
  - Constant Field Values

### ENDCAPS_HIDDEN

public static final byte ENDCAPS_HIDDEN

See Also:
  - Constant Field Values

### ENDCAPS_FLAT

public static final byte ENDCAPS_FLAT

See Also:
  - Constant Field Values

### ENDCAPS_SPHERICAL

public static final byte ENDCAPS_SPHERICAL

See Also:
  - Constant Field Values

### ENDCAPS_OPEN_TO_SPHERICAL

public static final byte ENDCAPS_OPEN_TO_SPHERICAL

See Also:
  - Constant Field Values

### ENDCAPS_FLAT_TO_SPHERICAL

public static final byte ENDCAPS_FLAT_TO_SPHERICAL

See Also:
  - Constant Field Values

### graphicsForMetrics

protected Object graphicsForMetrics

### EXPORT_RAYTRACER

public static final int EXPORT_RAYTRACER

See Also:
  - Constant Field Values

### EXPORT_CARTESIAN

public static final int EXPORT_CARTESIAN

See Also:
  - Constant Field Values

### EXPORT_NOT

public static final int EXPORT_NOT

See Also:
  - Constant Field Values

### yGT

public static final int yGT

See Also:
  - Constant Field Values

### yLT

public static final int yLT

See Also:
  - Constant Field Values

### xGT

public static final int xGT

See Also:
  - Constant Field Values

### xLT

public static final int xLT

See Also:
  - Constant Field Values

### zGT

public static final int zGT

See Also:
  - Constant Field Values

### zLT

public static final int zLT

See Also:
  - Constant Field Values

### HUGE

public static final int HUGE

See Also:
  - Constant Field Values

### currentFont

protected Font currentFont

### argbNoisyUp

public int argbNoisyUp

### argbNoisyDn

public int argbNoisyDn

### transformedVectors

protected V3[] transformedVectors

### normixCount

protected static short normixCount

## Constructor Details

### GData

public GData()
It is possible to instantiate this class with no Graphics3D. This will happen in the case of WebGL.

## Method Details

### initialize

public void initialize(Viewer vwr, GenericPlatform apiPlatform)

### setDepth

public void setDepth(int depthValue)
clipping from the front and the back

the plane is defined as a percentage from the back of the image to the front

for depth values:

- 0 means 100% is shown
- 25 means the back 25% is not shown
- 50 means the back half is not shown
- 100 means that nothing is shown

Parameters:
  `depthValue` - rear clipping percentage [0,100]

### setSlab

public void setSlab(int slabValue)
clipping from the front and the back

the plane is defined as a percentage from the back of the image to the front

For slab values:

- 100 means 100% is shown
- 75 means the back 75% is shown
- 50 means the back half is shown
- 0 means that nothing is shown

Specified by:
  `setSlab` in interface `JmolGraphicsInterface`
Parameters:
  `slabValue` - front clipping percentage [0,100]

### setSlabAndZShade

public void setSlabAndZShade(int slab, int depth, int zSlab, int zDepth, int zPower)

Specified by:
  `setSlabAndZShade` in interface `JmolGraphicsInterface`
Parameters:
  `zSlab` - for zShade
  `zDepth` - for zShade
  `zPower` -

### setAmbientOcclusion

public void setAmbientOcclusion(int value)

### isAntialiased

public boolean isAntialiased()
is full scene / oversampling antialiasing in effect

Specified by:
  `isAntialiased` in interface `JmolGraphicsInterface`
Returns:
  the answer

### getChangeableColix

public short getChangeableColix(int id, int argb)

### changeColixArgb

public void changeColixArgb(int id, int argb)

### getColorArgbOrGray

public int getColorArgbOrGray(short colix)

### getShades

public int[] getShades(short colix)

### setGreyscaleMode

public void setGreyscaleMode(boolean greyscaleMode)
controls greyscale rendering

Parameters:
  `greyscaleMode` - Flag for greyscale rendering

### getSpecularPower

public int getSpecularPower()

### setSpecularPower

public void setSpecularPower(int val)
fractional distance to white for specular dot

Parameters:
  `val` -

### getSpecularPercent

public int getSpecularPercent()

### setSpecularPercent

public void setSpecularPercent(int val)
sf in I = df * (N dot L) + sf * (R dot V)^p not a percent of anything, really

Parameters:
  `val` -

### getSpecularExponent

public int getSpecularExponent()

### setSpecularExponent

public void setSpecularExponent(int val)
log_2(p) in I = df * (N dot L) + sf * (R dot V)^p for faster calculation of shades

Parameters:
  `val` -

### getPhongExponent

public int getPhongExponent()

### setPhongExponent

public void setPhongExponent(int val)
p in I = df * (N dot L) + sf * (R dot V)^p

Parameters:
  `val` -

### getDiffusePercent

public int getDiffusePercent()

### setDiffusePercent

public void setDiffusePercent(int val)
df in I = df * (N dot L) + sf * (R dot V)^p

Parameters:
  `val` -

### getAmbientPercent

public int getAmbientPercent()

### setAmbientPercent

public void setAmbientPercent(int val)
fractional distance from black for ambient color

Parameters:
  `val` -

### getSpecular

public boolean getSpecular()

### setSpecular

public void setSpecular(boolean val)

### setCel

public void setCel(boolean val)

### getCel

public boolean getCel()

### getCelPower

public int getCelPower()

### setCelPower

public void setCelPower(int celPower)

### getLightSource

public V3 getLightSource()

### isClipped3

public boolean isClipped3(int x, int y, int z)

### isClipped

public boolean isClipped(int x, int y)

### isInDisplayRange

public boolean isInDisplayRange(int x, int y)

Specified by:
  `isInDisplayRange` in interface `JmolGraphicsInterface`

### isClippedXY

public boolean isClippedXY(int diameter, int x, int y)

Specified by:
  `isClippedXY` in interface `JmolGraphicsInterface`

### isClippedZ

public boolean isClippedZ(int z)

### clipCode3

public int clipCode3(int x, int y, int z)

### clipCode

public int clipCode(int z)

### getFont3D

public Font getFont3D(float fontSize)

### getFont3DFS

public Font getFont3DFS(String fontFace, float fontSize)

### getFontFidFS

public int getFontFidFS(String fontFace, float fontSize)

### getFont3DFSS

public Font getFont3DFSS(String fontFace, String fontStyle, float fontSize)

### getFont3DScaled

public Font getFont3DScaled(Font font, float scale)

### getFontFidI

public int getFontFidI(float fontSize)

### getFont3DCurrent

public Font getFont3DCurrent()

### setFont

public void setFont(Font font3d)

Parameters:
  `font3d` -

### setFontBold

public void setFontBold(String fontFace, float fontSize)

### setBackgroundTransparent

public void setBackgroundTransparent(boolean TF)

Parameters:
  `TF` -

### setBackgroundArgb

public void setBackgroundArgb(int argb)
sets background color to the specified argb value

Parameters:
  `argb` - an argb value with alpha channel

### setBackgroundImage

public void setBackgroundImage(Object image)

### setWindowParameters

public void setWindowParameters(int width, int height, boolean antialias)

### setWinParams

protected void setWinParams(int width, int height, boolean antialias)

### setNewWindowParametersForExport

public void setNewWindowParametersForExport()

### setWidthHeight

protected void setWidthHeight(boolean isAntialiased)

### beginRendering

public void beginRendering(M3 stereoRotationMatrix, boolean translucentMode, boolean isImageWrite, boolean renderLow)

Parameters:
  `stereoRotationMatrix` -
  `translucentMode` -
  `isImageWrite` -
  `renderLow` - TODO

### endRendering

public void endRendering()

### snapshotAnaglyphChannelBytes

public void snapshotAnaglyphChannelBytes()

### getScreenImage

public Object getScreenImage(boolean isImageWrite)

Parameters:
  `isImageWrite` -
Returns:
  image object

### releaseScreenImage

public void releaseScreenImage()

### applyAnaglygh

public void applyAnaglygh(STER stereoMode, int[] stereoColors)

Parameters:
  `stereoMode` -
  `stereoColors` -

### setPass2

public boolean setPass2(boolean antialias)

Parameters:
  `antialias` -
Returns:
  true if need a second (translucent) pass

### destroy

public void destroy()

### clearFontCache

public void clearFontCache()

### drawQuadrilateralBits

public void drawQuadrilateralBits(JmolRendererInterface jmolRenderer, short colix, P3 screenA, P3 screenB, P3 screenC, P3 screenD)

### drawTriangleBits

public void drawTriangleBits(JmolRendererInterface renderer, P3 screenA, short colixA, P3 screenB, short colixB, P3 screenC, short colixC, int check)

### plotImage

public void plotImage(int x, int y, int z, Object image, JmolRendererInterface jmolRenderer, short bgcolix, int width, int height)

Parameters:
  `x` -
  `y` -
  `z` -
  `image` -
  `jmolRenderer` -
  `bgcolix` -
  `width` -
  `height` -

### plotText

public void plotText(int x, int y, int z, int colorArgbOrGray, int bgColor, String text, Font font3d, JmolRendererInterface jmolRenderer)

Parameters:
  `x` -
  `y` -
  `z` -
  `colorArgbOrGray` -
  `bgColor` - TODO
  `text` -
  `font3d` -
  `jmolRenderer` -

### renderBackground

public void renderBackground(JmolRendererInterface jmolRenderer)

Parameters:
  `jmolRenderer` -

### setColor

public void setColor(int argb)

### setC

public boolean setC(short colix)

Parameters:
  `colix` -
Returns:
  TRUE if correct pass (translucent or opaque)

### isDirectedTowardsCamera

public boolean isDirectedTowardsCamera(short normix)

Parameters:
  `normix` -
Returns:
  true if front

### roundInt

public static int roundInt(int a)
JavaScript won't really have an integer here after integer division. So we need to round it to the integer between it and zero.

Parameters:
  `a` -
Returns:
  number closest to zero

### clear

public void clear()

### renderAllStrings

public void renderAllStrings(Object jmolRenderer)

Specified by:
  `renderAllStrings` in interface `JmolGraphicsInterface`

### addRenderer

public void addRenderer(int tok)

Parameters:
  `tok` -

### getHermiteList

public static void getHermiteList(int tension, T3 p0, T3 p1, T3 p2, T3 p3, T3 p4, T3[] list, int index0, int n, boolean isPt)
Used by Navigator, BioShapeRenderer, and DrawRenderer

Parameters:
  `tension` -
  `p0` -
  `p1` -
  `p2` -
  `p3` -
  `p4` -
  `list` -
  `index0` -
  `n` -
  `isPt` -

### setTextPosition

public void setTextPosition(int y)

### getTextPosition

public int getTextPosition()

### getTransformedVertexVectors

public V3[] getTransformedVertexVectors()

### drawLinePixels

public void drawLinePixels(P3i sA, P3i sB, int z, int zslab)

Specified by:
  `drawLinePixels` in interface `JmolGraphicsInterface`