You can use the GnomeCanvas widget to draw figures, display graphics,
position widgets, and more.
getCanvas
public static Canvas getCanvas(Handle handle)
Internal static factory method to be used by Java-Gnome only.
getCenterScrollRegion
public boolean getCenterScrollRegion()
getColor
public Color getColor(String spec)
Takes a string specification for a color and allocates it into the
specified GdkColor.
spec
- The color to allocate.
getColorPixel
public long getColorPixel(int rgba)
Allocates a color from the RGB value passed into this function.
getCurrentCanvasItem
public CanvasItem getCurrentCanvasItem()
The item containing the mouse pointer, or NULL if none.
getDither
public RgbDither getDither()
Returns the dither mode of an antialiased canvas. Only applicable to
antialiased canvases - ignored by non-antialiased convases.
getFocusedCanvasItem
public CanvasItem getFocusedCanvasItem()
The currently focused item, or NULL if none.
getGrabbedCanvasItem
public CanvasItem getGrabbedCanvasItem()
The item that holds a pointer grab, or NULL if none.
getItemAt
public CanvasItem getItemAt(double x,
double y)
Returns the item that is at the specified position in world coordinates,
or NULL if no item is there.
x
- The horizontal coordinate.y
- The vertical coordinate.
getPixelsPerUnit
public double getPixelsPerUnit()
Scaling factor to be used for display.
getRoot
public CanvasGroup getRoot()
Returns the root canvas item group of the canvas
getScrollOffsetX
public double getScrollOffsetX()
Returns the horizontal scroll offset of the canvas in canvas pixel
coordinates.
- The scroll offset x coordinate.
getScrollOffsetY
public double getScrollOffsetY()
Returns the vertical scroll offset of the canvas in canvas pixel
coordinates.
- The scroll offset y coordinate.
getScrollX1
public double getScrollX1()
The x1 coordinate of the scrolling region.
getScrollX2
public double getScrollX2()
The x2 coordinate of the scrolling region.
getScrollY1
public double getScrollY1()
The y1 coordinate of the scrolling region.
getScrollY2
public double getScrollY2()
The y2 coordinate of the scrolling region.
getType
public static Type getType()
Retrieve the runtime type used by the GLib library.
requestRedraw
public void requestRedraw(int x1,
int y1,
int x2,
int y2)
scrollTo
public void scrollTo(int cx,
int cy)
Scrolls the canvas to the specified offsets, given in canvas pixel
coordinates.
cx
- Horizontal coordinate.cy
- Vertical coordinate.
setCenterScrollRegion
public void setCenterScrollRegion(boolean center)
setDither
public void setDither(RgbDither dither)
Controls the dithering used when the canvas renders. Only applicable to
antialiased canvases - ignored by non-antialiased canvases.
setPixelsPerUnit
public void setPixelsPerUnit(double n)
Sets the number of pixels that correspond to one unit in world
coordinates.
setScrollRegion
public void setScrollRegion(double x1,
double y1,
double x2,
double y2)
Convenience method to set all 4 coordinates of the scroll region at once.
x1
- First horizontal coordinate.y1
- First vertical coordinate.x2
- Second horizontal coordinate.y2
- Second vertical coordinate.
setScrollX1
public void setScrollX1(double x1)
Set the scroll region's X1 coordinate.
setScrollX2
public void setScrollX2(double x2)
Set the scroll region's X2 coordinate.
setScrollY1
public void setScrollY1(double y1)
Set the scroll region's Y1 coordinate.
setScrollY2
public void setScrollY2(double y2)
Set the scroll region's Y2 coordinate.
update
public void update()
Requests that the canvas be repainted immediately instead of during the
idle loop.
windowToWorldX
public double windowToWorldX(double winx)
windowToWorldY
public double windowToWorldY(double winy)
worldToWindowX
public double worldToWindowX(double worldx)
worldToWindowY
public double worldToWindowY(double worldy)