|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.uci.ics.jung.visualization.swt.graphics.GCGraphicsContext
public class GCGraphicsContext
An adapter that translates invokations of the GraphicsContext interface to the necessary invokations on its org.eclipse.swt.graphics.GC delegate. Special thanks to the developers of the Holongate project, http://www.holongate.org, for helping me get started in the right direction.
| Field Summary | |
|---|---|
protected org.eclipse.swt.graphics.GC |
delegate
|
| Constructor Summary | |
|---|---|
GCGraphicsContext()
|
|
GCGraphicsContext(org.eclipse.swt.graphics.GC delegate)
|
|
| Method Summary | |
|---|---|
void |
clearRect(int x,
int y,
int width,
int height)
|
void |
clip(Shape s)
|
void |
clipRect(int x,
int y,
int width,
int height)
|
void |
copyArea(int x,
int y,
int width,
int height,
int dx,
int dy)
|
Image |
createImage(int width,
int height)
|
Label |
createLabel()
|
void |
dispose()
|
void |
draw(Shape s)
|
void |
drawArc(int x,
int y,
int width,
int height,
int startAngle,
int arcAngle)
|
void |
drawChars(char[] data,
int offset,
int length,
int x,
int y)
|
void |
drawImage(Image img,
AffineTransform xform)
|
void |
drawImage(Image img,
int x,
int y)
|
void |
drawLabel(Label label,
int x,
int y)
|
void |
drawLabel(Label label,
int x,
int y,
int w,
int h)
|
void |
drawLine(int x1,
int y1,
int x2,
int y2)
|
void |
drawOval(int x,
int y,
int width,
int height)
|
void |
drawPolygon(int[] xPoints,
int[] yPoints,
int nPoints)
|
void |
drawPolygon(Polygon p)
|
void |
drawPolyline(int[] xPoints,
int[] yPoints,
int nPoints)
|
void |
drawRect(int x,
int y,
int width,
int height)
|
void |
drawRoundRect(int x,
int y,
int width,
int height,
int arcWidth,
int arcHeight)
|
void |
drawString(String s,
float x,
float y)
|
void |
drawString(String str,
int x,
int y)
|
void |
fill(Shape s)
|
void |
fillArc(int x,
int y,
int width,
int height,
int startAngle,
int arcAngle)
|
void |
fillOval(int x,
int y,
int width,
int height)
|
void |
fillPolygon(int[] xPoints,
int[] yPoints,
int nPoints)
|
void |
fillPolygon(Polygon p)
|
void |
fillRect(int x,
int y,
int width,
int height)
|
void |
fillRoundRect(int x,
int y,
int width,
int height,
int arcWidth,
int arcHeight)
|
Boolean |
getAntialiasing()
|
Color |
getBackground()
|
int |
getCharWidth(char c)
|
Shape |
getClip()
|
Rectangle |
getClipBounds()
|
Rectangle |
getClipBounds(Rectangle r)
|
Color |
getColor()
|
Font |
getFont()
|
int |
getFontAscent()
|
int |
getFontDescent()
|
int |
getFontHeight()
|
Paint |
getPaint()
|
int |
getStringWidth(String str)
|
Stroke |
getStroke()
|
static org.eclipse.swt.graphics.FontData |
getSWTFontData(org.eclipse.swt.graphics.Device dev,
Font font)
|
Boolean |
getTextAntialiasing()
|
AffineTransform |
getTransform()
|
boolean |
hit(Rectangle rect,
Shape s,
boolean onStroke)
|
void |
setAntialiasing(Boolean on)
|
void |
setBackground(Color color)
|
void |
setClip(int x,
int y,
int width,
int height)
|
void |
setClip(Shape clip)
|
void |
setColor(Color color)
|
void |
setFont(Font font)
|
void |
setPaint(Paint paint)
|
void |
setStroke(Stroke s)
|
void |
setTextAntialiasing(Boolean on)
|
void |
setTransform(AffineTransform tx)
|
static Color |
toAWTColor(org.eclipse.swt.graphics.GC gc,
org.eclipse.swt.graphics.Color rgb)
Converts an SWT Color into an AWT Color. |
static Font |
toAWTFont(org.eclipse.swt.graphics.Device dev,
org.eclipse.swt.graphics.Font font)
|
static AffineTransform |
toAWTTransform(org.eclipse.swt.graphics.Transform t)
|
static org.eclipse.swt.graphics.Path |
toPath(org.eclipse.swt.graphics.Device dev,
Shape s)
Converts a Java2D Shape into an SWT Path object. |
org.eclipse.swt.graphics.Color |
toSWTColor(Color color)
Converts an AWT Color into an SWT Color. |
org.eclipse.swt.graphics.Font |
toSWTFont(Font font)
Font size in Java2D is expressed in pixels??? The javadoc says that font sizes are in points! |
static org.eclipse.swt.graphics.Transform |
toSWTTransform(org.eclipse.swt.graphics.Device dev,
AffineTransform t)
Converts a Java2D AffineTransform into an SWT Transform. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected org.eclipse.swt.graphics.GC delegate
| Constructor Detail |
|---|
public GCGraphicsContext()
public GCGraphicsContext(org.eclipse.swt.graphics.GC delegate)
| Method Detail |
|---|
public void dispose()
dispose in interface GraphicsContext
public static org.eclipse.swt.graphics.Transform toSWTTransform(org.eclipse.swt.graphics.Device dev,
AffineTransform t)
The caller must call dispose() on the returned instance.
This method is not static because the returned transform is bound to the same Device as the orginal GC this instance represents.
t - The Java2D affine transform
public static AffineTransform toAWTTransform(org.eclipse.swt.graphics.Transform t)
public static Color toAWTColor(org.eclipse.swt.graphics.GC gc,
org.eclipse.swt.graphics.Color rgb)
The returned Color have its alpha channel set to the current alpha value of the GC. As a consequence, colors cannot be cached or resused.
rgb - The SWT color
public org.eclipse.swt.graphics.Color toSWTColor(Color color)
The alpha channel of the AWT color is lost in the process.
The caller must call dispose() on the returned instance.
This method is not static because the returned color is bound to the same Device as the orginal GC this instance represents.
rgba -
public static org.eclipse.swt.graphics.Path toPath(org.eclipse.swt.graphics.Device dev,
Shape s)
Coordinates are supposed to be expressed in the original (untransformed) user space following the Java2D convention for coordinates.
This method uses the PathIterator mechanism to iterate over the shape.
The caller must call dispose() on the returned instance.
This method is not static because the returned path is bound to the same Device as the orginal GC this instance represents.
s - The Shape to convert
public static org.eclipse.swt.graphics.FontData getSWTFontData(org.eclipse.swt.graphics.Device dev,
Font font)
public org.eclipse.swt.graphics.Font toSWTFont(Font font)
Font size is converted in points by multiplying AWT font size by 72/ screen DPI.
public static Font toAWTFont(org.eclipse.swt.graphics.Device dev,
org.eclipse.swt.graphics.Font font)
public int getCharWidth(char c)
getCharWidth in interface GraphicsContextpublic int getFontAscent()
getFontAscent in interface GraphicsContextpublic int getFontDescent()
getFontDescent in interface GraphicsContextpublic int getFontHeight()
getFontHeight in interface GraphicsContextpublic int getStringWidth(String str)
getStringWidth in interface GraphicsContextpublic Boolean getAntialiasing()
getAntialiasing in interface GraphicsContextpublic Boolean getTextAntialiasing()
getTextAntialiasing in interface GraphicsContextpublic void setAntialiasing(Boolean on)
setAntialiasing in interface GraphicsContextpublic void setTextAntialiasing(Boolean on)
setTextAntialiasing in interface GraphicsContextpublic Label createLabel()
createLabel in interface GraphicsContext
public Image createImage(int width,
int height)
createImage in interface GraphicsContext
public void clearRect(int x,
int y,
int width,
int height)
clearRect in interface GraphicsContextpublic void clip(Shape s)
clip in interface GraphicsContext
public void clipRect(int x,
int y,
int width,
int height)
clipRect in interface GraphicsContext
public void copyArea(int x,
int y,
int width,
int height,
int dx,
int dy)
copyArea in interface GraphicsContextpublic void draw(Shape s)
draw in interface GraphicsContext
public void drawArc(int x,
int y,
int width,
int height,
int startAngle,
int arcAngle)
drawArc in interface GraphicsContext
public void drawChars(char[] data,
int offset,
int length,
int x,
int y)
drawChars in interface GraphicsContext
public void drawImage(Image img,
int x,
int y)
drawImage in interface GraphicsContext
public void drawImage(Image img,
AffineTransform xform)
drawImage in interface GraphicsContext
public void drawLabel(Label label,
int x,
int y,
int w,
int h)
drawLabel in interface GraphicsContext
public void drawLabel(Label label,
int x,
int y)
drawLabel in interface GraphicsContext
public void drawLine(int x1,
int y1,
int x2,
int y2)
drawLine in interface GraphicsContext
public void drawOval(int x,
int y,
int width,
int height)
drawOval in interface GraphicsContext
public void drawPolygon(int[] xPoints,
int[] yPoints,
int nPoints)
drawPolygon in interface GraphicsContextpublic void drawPolygon(Polygon p)
drawPolygon in interface GraphicsContext
public void drawPolyline(int[] xPoints,
int[] yPoints,
int nPoints)
drawPolyline in interface GraphicsContext
public void drawRect(int x,
int y,
int width,
int height)
drawRect in interface GraphicsContext
public void drawRoundRect(int x,
int y,
int width,
int height,
int arcWidth,
int arcHeight)
drawRoundRect in interface GraphicsContext
public void drawString(String s,
float x,
float y)
drawString in interface GraphicsContext
public void drawString(String str,
int x,
int y)
drawString in interface GraphicsContextpublic void fill(Shape s)
fill in interface GraphicsContext
public void fillArc(int x,
int y,
int width,
int height,
int startAngle,
int arcAngle)
fillArc in interface GraphicsContext
public void fillOval(int x,
int y,
int width,
int height)
fillOval in interface GraphicsContext
public void fillPolygon(int[] xPoints,
int[] yPoints,
int nPoints)
fillPolygon in interface GraphicsContextpublic void fillPolygon(Polygon p)
fillPolygon in interface GraphicsContext
public void fillRect(int x,
int y,
int width,
int height)
fillRect in interface GraphicsContext
public void fillRoundRect(int x,
int y,
int width,
int height,
int arcWidth,
int arcHeight)
fillRoundRect in interface GraphicsContextpublic Color getBackground()
getBackground in interface GraphicsContextpublic Shape getClip()
getClip in interface GraphicsContextpublic Rectangle getClipBounds()
getClipBounds in interface GraphicsContextpublic Rectangle getClipBounds(Rectangle r)
getClipBounds in interface GraphicsContextpublic Font getFont()
getFont in interface GraphicsContextpublic Color getColor()
getColor in interface GraphicsContextpublic Stroke getStroke()
getStroke in interface GraphicsContextpublic AffineTransform getTransform()
getTransform in interface GraphicsContext
public boolean hit(Rectangle rect,
Shape s,
boolean onStroke)
hit in interface GraphicsContextpublic void setBackground(Color color)
setBackground in interface GraphicsContext
public void setClip(int x,
int y,
int width,
int height)
setClip in interface GraphicsContextpublic void setClip(Shape clip)
setClip in interface GraphicsContextpublic void setFont(Font font)
setFont in interface GraphicsContextpublic void setColor(Color color)
setColor in interface GraphicsContextpublic void setStroke(Stroke s)
setStroke in interface GraphicsContextpublic void setTransform(AffineTransform tx)
setTransform in interface GraphicsContextpublic Paint getPaint()
getPaint in interface GraphicsContextpublic void setPaint(Paint paint)
setPaint in interface GraphicsContext
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||