class GraphicsContext extends SFXDelegate[javafx.scene.canvas.GraphicsContext]
- Alphabetic
- By Inheritance
- GraphicsContext
- SFXDelegate
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new GraphicsContext(delegate: javafx.scene.canvas.GraphicsContext)
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def appendSVGPath(s: String): Unit
Appends an SVG Path string to the current path.
- def applyEffect(e: Effect): Unit
Applies the given effect to the entire canvas.
- def arc(centerX: Double, centerY: Double, radiusX: Double, radiusY: Double, startAngle: Double, length: Double): Unit
Adds path elements to the current path to make an arc that uses Euclidean degrees.
- def arcTo(x1: Double, y1: Double, x2: Double, y2: Double, radius: Double): Unit
Adds segments to the current path to make an arc.
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def beginPath(): Unit
Starts a Path
- def bezierCurveTo(xc1: Double, yc1: Double, xc2: Double, yc2: Double, x1: Double, y1: Double): Unit
Adds segments to the current path to make a cubic bezier curve.
- def canvas: Canvas
Gets the Canvas that the GraphicsContext is issuing draw commands to.
- def clearRect(x: Double, y: Double, w: Double, h: Double): Unit
Clears a portion of the canvas with a transparent color value.
- def clip(): Unit
Clips using the current path
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- def closePath(): Unit
Closes the path.
- val delegate: javafx.scene.canvas.GraphicsContext
JavaFX object to be wrapped.
JavaFX object to be wrapped.
- Definition Classes
- GraphicsContext → SFXDelegate
- def drawImage(img: Image, sx: Double, sy: Double, sw: Double, sh: Double, dx: Double, dy: Double, dw: Double, dh: Double): Unit
Draws the current source rectangle of the given image to the given destination rectangle of the Canvas.
- def drawImage(img: Image, x: Double, y: Double, w: Double, h: Double): Unit
Draws an image into the given destination rectangle of the canvas.
- def drawImage(img: Image, x: Double, y: Double): Unit
Draws an image at the given x, y position using the width and height of the given image.
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(ref: Any): Boolean
Verifies if a object is equals to this delegate.
Verifies if a object is equals to this delegate.
- ref
Object to be compared.
- returns
if the other object is equals to this delegate or not.
- Definition Classes
- SFXDelegate → AnyRef → Any
- def fill: Paint
the current fill attribute.
- def fillArc(x: Double, y: Double, w: Double, h: Double, startAngle: Double, arcExtent: Double, closure: ArcType): Unit
Fills an arc using the current fill paint.
- def fillOval(x: Double, y: Double, w: Double, h: Double): Unit
Fills an oval using the current fill paint.
- def fillPath(): Unit
Fills the path with the current fill paint.
Fills the path with the current fill paint. This method is correspondent to fill() method in JavaFx class.
- def fillPolygon(points: Seq[(Double, Double)]): Unit
Fills a polygon with the given points using the currently set fill paint.
- def fillPolygon(xPoints: Array[Double], yPoints: Array[Double], nPoints: Int): Unit
Fills a polygon with the given points using the currently set fill paint.
- def fillRect(x: Double, y: Double, w: Double, h: Double): Unit
Fills a rectangle using the current fill paint.
- def fillRoundRect(x: Double, y: Double, w: Double, h: Double, arcWidth: Double, arcHeight: Double): Unit
Fills a rounded rectangle using the current fill paint.
- def fillRule: FillRule
the filling rule constant for determining the interior of the path.
- def fillRule_=(fillRule: FillRule): Unit
- def fillText(text: String, x: Double, y: Double, maxWidth: Double): Unit
Fills text and includes a maximum width of the string.
- def fillText(text: String, x: Double, y: Double): Unit
Fills the given string of text at position x, y (0,0 at top left) with the current fill paint attribute.
- def fill_=(p: Paint): Unit
- def font: Font
the current Font.
- def font_=(f: Font): Unit
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def getEffect(e: Effect): Effect
Gets a copy of the effect to be applied after the next draw call.
- def getTransform(xform: Affine): Affine
Returns a copy of the current transform.
- def getTransform: Affine
Returns a copy of the current transform.
- def globalAlpha: Double
the current global alpha.
- def globalAlpha_=(alpha: Double): Unit
- def globalBlendMode: BlendMode
the global blend mode.
- def globalBlendMode_=(op: BlendMode): Unit
- def hashCode(): Int
- returns
The delegate hashcode
- Definition Classes
- SFXDelegate → AnyRef → Any
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def lineCap: StrokeLineCap
the current stroke line cap.
- def lineCap_=(cap: StrokeLineCap): Unit
- def lineJoin: StrokeLineJoin
the current stroke line join.
- def lineJoin_=(join: StrokeLineJoin): Unit
- def lineTo(x1: Double, y1: Double): Unit
Adds segments to the current path to make a line at the given x,y coordinate.
- def lineWidth: Double
the current line width.
- def lineWidth_=(lw: Double): Unit
- def miterLimit: Double
the current miter limit.
- def miterLimit_=(ml: Double): Unit
- def moveTo(x0: Double, y0: Double): Unit
Issues a move command for the current path to the given x,y coordinate.
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def pixelWriter: PixelWriter
Returns a PixelWriter object that can be used to modify the pixels of the Canvas associated with this GraphicsContext.
- def pointInPath(x: Double, y: Double): Boolean
Returns true if the the given x,y point is inside the path.
- def quadraticCurveTo(xc: Double, yc: Double, x1: Double, y1: Double): Unit
Adds segments to the current path to make a quadratic curve.
- def rect(x: Double, y: Double, w: Double, h: Double): Unit
Adds path elements to the current path to make a rectangle.
- def restore(): Unit
Pops the state off of the stack, setting the following attributes to their value at the time when that state was pushed onto the stack.
- def rotate(degrees: Double): Unit
Rotates the current transform in degrees.
- def save(): Unit
Saves the following attributes onto a stack.
- def scale(x: Double, y: Double): Unit
Scales the current transform by x, y.
- def setEffect(e: Effect): Unit
Sets the effect to be applied after the next draw call, or null to disable effects.
- def setTransform(mxx: Double, myx: Double, mxy: Double, myy: Double, mxt: Double, myt: Double): Unit
Sets the current transform.
- def setTransform(xform: Affine): Unit
Sets the current transform.
- def stroke: Paint
the current stroke.
- def strokeArc(x: Double, y: Double, w: Double, h: Double, startAngle: Double, arcExtent: Double, closure: ArcType): Unit
Strokes an Arc using the current stroke paint.
- def strokeLine(x1: Double, y1: Double, x2: Double, y2: Double): Unit
Strokes a line using the current stroke paint.
- def strokeOval(x: Double, y: Double, w: Double, h: Double): Unit
Strokes an oval using the current stroke paint.
- def strokePath(): Unit
Strokes the path with the current stroke paint.
Strokes the path with the current stroke paint. This method is correspondent to stroke() method in JavaFx class.
- def strokePolygon(points: Seq[(Double, Double)]): Unit
Strokes a polygon with the given points using the currently set stroke paint.
- def strokePolygon(xPoints: Array[Double], yPoints: Array[Double], nPoints: Int): Unit
Strokes a polygon with the given points using the currently set stroke paint.
- def strokePolyline(points: Seq[(Double, Double)]): Unit
Draws a polyline with the given points using the currently set stroke paint attribute.
- def strokePolyline(xPoints: Array[Double], yPoints: Array[Double], nPoints: Int): Unit
Draws a polyline with the given points using the currently set stroke paint attribute.
- def strokeRect(x: Double, y: Double, w: Double, h: Double): Unit
Strokes a rectangle using the current stroke paint.
- def strokeRoundRect(x: Double, y: Double, w: Double, h: Double, arcWidth: Double, arcHeight: Double): Unit
Strokes a rounded rectangle using the current stroke paint.
- def strokeText(text: String, x: Double, y: Double, maxWidth: Double): Unit
Draws text with stroke paint and includes a maximum width of the string.
- def strokeText(text: String, x: Double, y: Double): Unit
draws the given string of text at position x, y (0,0 at top left) with the current stroke paint attribute.
- def stroke_=(s: Paint): Unit
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def textAlign: TextAlignment
the current TextAlignment.
- def textAlign_=(align: TextAlignment): Unit
- def textBaseline: VPos
the current Text Baseline.
- def textBaseline_=(baseline: VPos): Unit
- def toString(): String
- returns
Returns the original delegate's
toString()
adding a[SFX]
prefix.
- Definition Classes
- SFXDelegate → AnyRef → Any
- def transform(mxx: Double, myx: Double, mxy: Double, myy: Double, mxt: Double, myt: Double): Unit
Concatenates the input with the current transform.
- def transform(xform: Affine): Unit
Concatenates the input with the current transform.
- def translate(x: Double, y: Double): Unit
Translates the current transform by x, y.
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
ScalaFX is a UI DSL written within the Scala Language that sits on top of JavaFX 2.x and and JavaFX 8. This means that every ScalaFX application is also a valid Scala application. By extension it supports full interoperability with Java and can run anywhere the Java Virtual Machine (JVM) and JavaFX 2.0 or JavaFX 8 are supported.
Package Structure
ScalaFX package structure corresponds to JavaFX package structure, for instance
scalafx.animation
corresponds tojavafx.animation
.Example Usage
A basic ScalaFX application is created creating an object that is an instance of
JFXApp
. Following Java FX theatre metaphor, it contains astage
that contains ascene
. Astage
roughly corresponds to a window in a typical UI environment. Thescene
holds UI content presented to the user. In the example below, the content is a pane with a singlelabel
component.