scalation.scala2d

Members list

Type members

Classlikes

case class Arc() extends Double

Arc is a convenience case class for Arc2D (a subclass of RectangularShape).

Arc is a convenience case class for Arc2D (a subclass of RectangularShape).

Attributes

Supertypes
trait Product
trait Equals
class Double
trait Serializable
class Arc2D
class RectangularShape
trait Cloneable
trait Shape
class Object
trait Matchable
class Any
Show all
case class Arrow(var p1: R2, var p2: R2, var len: Int) extends Double, CurvilinearShape

The Arrow class uses Java's Path2D class to create a line with an arrowhead on the far end. The main line is defined by points 'p1' and 'p2'. Points 'p3' and 'p4' are the corners of the triangular arrowhead.

The Arrow class uses Java's Path2D class to create a line with an arrowhead on the far end. The main line is defined by points 'p1' and 'p2'. Points 'p3' and 'p4' are the corners of the triangular arrowhead.

Value parameters

len

the length of the arrowhead on the line/arrow

p1

the starting point for the line/arrow

p2

the ending point for the line/arrow

Attributes

Supertypes
trait Product
trait Equals
class Double
trait Serializable
class Path2D
trait Cloneable
trait Shape
class Object
trait Matchable
class Any
Show all
object BorderLayout extends BorderLayout

The BorderLayout object is a convenience object for java.awt.BorderLayout.

The BorderLayout object is a convenience object for java.awt.BorderLayout.

Attributes

Supertypes
class BorderLayout
trait Serializable
trait LayoutManager2
trait LayoutManager
class Object
trait Matchable
class Any
Show all
Self type
object Colors

The Colors convenience object defines numerous common colors. Source of colors:

The Colors convenience object defines numerous common colors. Source of colors:

Attributes

See also
Supertypes
class Object
trait Matchable
class Any
Self type
Colors.type
trait CurvilinearShape extends Shape

The CurvilinearShape trait provides a general type for lines and curves. It is analogous to RectangularShape.

The CurvilinearShape trait provides a general type for lines and curves. It is analogous to RectangularShape.

Attributes

Supertypes
trait Shape
class Object
trait Matchable
class Any
Known subtypes
class Arrow
class QArrow
class QCurve
case class Ellipse() extends Double

Ellipse is a convenience case class for Ellipse2D (a subclass of RectangularShape).

Ellipse is a convenience case class for Ellipse2D (a subclass of RectangularShape).

Attributes

Supertypes
trait Product
trait Equals
class Double
trait Serializable
class Ellipse2D
class RectangularShape
trait Cloneable
trait Shape
class Object
trait Matchable
class Any
Show all
class Frame(title: String) extends JFrame

The Frame class is a convenience class for JFrame.

The Frame class is a convenience class for JFrame.

Attributes

Supertypes
class JFrame
trait RootPaneContainer
trait WindowConstants
class Frame
class Window
trait Accessible
class Container
class Component
trait Serializable
trait MenuContainer
trait ImageObserver
class Object
trait Matchable
class Any
Show all
Known subtypes
class StatTable
class VizFrame
class DgAnimator
class Histogram
class Plot
class PlotC
class PlotM
Show all
case class Hexagon() extends Polygon

The Hexagon class provides 6-sided polygons.

The Hexagon class provides 6-sided polygons.

Attributes

Supertypes
trait Product
trait Equals
class Polygon
class Polygon
trait Serializable
trait Shape
class Object
trait Matchable
class Any
Show all
case class Line(x_1: Double, y_1: Double, x_2: Double, y_2: Double) extends Double

Line is a convenience case class for Line2D (a subclass of RectangularShape).

Line is a convenience case class for Line2D (a subclass of RectangularShape).

Attributes

Supertypes
trait Product
trait Equals
class Double
trait Serializable
class Line2D
trait Cloneable
trait Shape
class Object
trait Matchable
class Any
Show all
case class Octagon() extends Polygon

The Octagon class provides 8-sided polygons.

The Octagon class provides 8-sided polygons.

Attributes

Supertypes
trait Product
trait Equals
class Polygon
class Polygon
trait Serializable
trait Shape
class Object
trait Matchable
class Any
Show all
case class Path() extends Double

Path is a convenience case class for Path2D. Its subtypes (case class Polygon, etc.) are defined in other files in the scala2d package.

Path is a convenience case class for Path2D. Its subtypes (case class Polygon, etc.) are defined in other files in the scala2d package.

Attributes

Supertypes
trait Product
trait Equals
class Double
trait Serializable
class Path2D
trait Cloneable
trait Shape
class Object
trait Matchable
class Any
Show all
case class Pentagon() extends Polygon

The Pentagon class provides 5-sided polygons.

The Pentagon class provides 5-sided polygons.

Attributes

Supertypes
trait Product
trait Equals
class Polygon
class Polygon
trait Serializable
trait Shape
class Object
trait Matchable
class Any
Show all
abstract class Polygon() extends Polygon

The Polygon class adds an abstract setFrame method to java.awt.Polygon for compatibility with RectangularShape.

The Polygon class adds an abstract setFrame method to java.awt.Polygon for compatibility with RectangularShape.

Attributes

Supertypes
class Polygon
trait Serializable
trait Shape
class Object
trait Matchable
class Any
Show all
Known subtypes
class Hexagon
class Octagon
class Pentagon
class Quad
class Triangle
case class QArrow(var p1: R2, var pc: R2, var p2: R2, len: Int) extends Double, CurvilinearShape

The QArrow class uses Java's Path2D class to create a quad curve with an arrowhead on the far end. The main curve is defined by points 'p1' and 'p2' along with a control point 'pc'. Points 'p3' and 'p4' are the corners of the triangular arrowhead.

The QArrow class uses Java's Path2D class to create a quad curve with an arrowhead on the far end. The main curve is defined by points 'p1' and 'p2' along with a control point 'pc'. Points 'p3' and 'p4' are the corners of the triangular arrowhead.

Value parameters

len

the length of the arrowhead on the curve/arc

p1

the starting point for the curve/arc

p2

the ending point for the curve/arc

pc

the control point for the curve/arc

Attributes

Supertypes
trait Product
trait Equals
class Double
trait Serializable
class Path2D
trait Cloneable
trait Shape
class Object
trait Matchable
class Any
Show all
case class QCurve(p1: R2, pc: R2, p2: R2, straight: Boolean) extends Double, CurvilinearShape

The QCurve class enhances the QuadCurve.Double class (from the java.awt.geom package) by allowing entities to move along such quadratic curves as well as lines. Although the curve could be developed as a quadratic function where y = ax^2 + bx + c. The following quadratic bezier formulation is used: p(t) = (x(t), y(t)) = [(1-t)^2 * p1] + [2 * (1-t) * t * pc] + [t^2 * p2].

The QCurve class enhances the QuadCurve.Double class (from the java.awt.geom package) by allowing entities to move along such quadratic curves as well as lines. Although the curve could be developed as a quadratic function where y = ax^2 + bx + c. The following quadratic bezier formulation is used: p(t) = (x(t), y(t)) = [(1-t)^2 * p1] + [2 * (1-t) * t * pc] + [t^2 * p2].

Value parameters

p1

the starting point for the quad curve

p2

the ending point for the quad curve

pc

the control point for the quad curve

straight

whether the quad curve is straight (i.e., a line)

Attributes

Companion
object
Supertypes
trait Product
trait Equals
class Double
trait Serializable
class QuadCurve2D
trait Cloneable
trait Shape
class Object
trait Matchable
class Any
Show all
object QCurve

The QCurve companion object provides formulas used by the QCurve class.

The QCurve companion object provides formulas used by the QCurve class.

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
QCurve.type
case class Quad() extends Polygon

The Quad class provides 4-sided polygons.

The Quad class provides 4-sided polygons.

Attributes

Supertypes
trait Product
trait Equals
class Polygon
class Polygon
trait Serializable
trait Shape
class Object
trait Matchable
class Any
Show all
case class Rectangle() extends Double

Rectangle is a convenience case class for Rectangle2D(a subclass of RectangularShape).

Rectangle is a convenience case class for Rectangle2D(a subclass of RectangularShape).

Attributes

Supertypes
trait Product
trait Equals
class Double
trait Serializable
class Rectangle2D
class RectangularShape
trait Cloneable
trait Shape
class Object
trait Matchable
class Any
Show all
case class RoundRectangle() extends Double

RoundRectangle is a convenience case class for RoundRectangle2D (a subclass of RectangularShape).

RoundRectangle is a convenience case class for RoundRectangle2D (a subclass of RectangularShape).

Attributes

Supertypes
trait Product
trait Equals
class Double
trait Serializable
class RoundRectangle2D
class RectangularShape
trait Cloneable
trait Shape
class Object
trait Matchable
class Any
Show all
trait Transform

The Transform trait provides a simple technique for transforming (translation, scaling and rotation) rectangular shapes.

The Transform trait provides a simple technique for transforming (translation, scaling and rotation) rectangular shapes.

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
class Animator
case class Triangle() extends Polygon

The Triangle class provides 3-sided polygons.

The Triangle class provides 3-sided polygons.

Attributes

Supertypes
trait Product
trait Equals
class Polygon
class Polygon
trait Serializable
trait Shape
class Object
trait Matchable
class Any
Show all
object TrigConstants

Useful trig constants.

Useful trig constants.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
class VizFrame(title: String, canvas: Panel, w: Int, h: Int, o: Int) extends Frame

The VizFrame class puts the canvas in the visualization/drawing frame.

The VizFrame class puts the canvas in the visualization/drawing frame.

Value parameters

canvas

the drawing canvas

h

the height of the frame

o

the offset of the frame

title

the title for the frame

w

the width of the frame

Attributes

Supertypes
class Frame
class JFrame
trait RootPaneContainer
trait WindowConstants
class Frame
class Window
trait Accessible
class Container
class Component
trait Serializable
trait MenuContainer
trait ImageObserver
class Object
trait Matchable
class Any
Show all
Known subtypes
class DgAnimator
class Histogram
class Plot
class PlotC
class PlotM
Show all
trait ZoomablePanel extends Panel, MouseWheelListener, MouseListener, MouseMotionListener

The ZoomablePanel class extends Panel with the ability to zoom in and out. The mouse wheel controls the amount of zooming, while mouse dragging repositions the objects in the panel (drawing canvas). Must add the following statement into your paintComponent method. g2d.setTransform (at) // used for zooming @author Casey Bowman

The ZoomablePanel class extends Panel with the ability to zoom in and out. The mouse wheel controls the amount of zooming, while mouse dragging repositions the objects in the panel (drawing canvas). Must add the following statement into your paintComponent method. g2d.setTransform (at) // used for zooming @author Casey Bowman

Attributes

See also

`docs.oracle.com/en/java/javase/20/docs/api/java.desktop/java/awt/geom/AffineTransform.html

animation package for examples

Supertypes
trait MouseMotionListener
trait MouseListener
trait MouseWheelListener
trait EventListener
class JPanel
trait Accessible
class JComponent
class Container
class Component
trait Serializable
trait MenuContainer
trait ImageObserver
class Object
trait Matchable
class Any
Show all
Known subtypes
class Canvas
class Canvas
class Canvas
class Canvas
class CanvasP
final class arrowTest

Attributes

Supertypes
class Object
trait Matchable
class Any
final class colorsTest

Attributes

Supertypes
class Object
trait Matchable
class Any
final class lineTest

Attributes

Supertypes
class Object
trait Matchable
class Any
final class polygonTest

Attributes

Supertypes
class Object
trait Matchable
class Any
final class polygonTest2

Attributes

Supertypes
class Object
trait Matchable
class Any
final class qArrowTest

Attributes

Supertypes
class Object
trait Matchable
class Any
final class qCurveTest

Attributes

Supertypes
class Object
trait Matchable
class Any
final class qCurveTest2

Attributes

Supertypes
class Object
trait Matchable
class Any
final class writeImageTest

Attributes

Supertypes
class Object
trait Matchable
class Any

Types

type BasicStroke = BasicStroke

The Shapes file provides type aliases for basic Java awt types.

The Shapes file provides type aliases for basic Java awt types.

Attributes

type Font = Font

The scala2d package contains classes, traits and objects for simple 2D graphics in Scala, based upon java.swing, java.awt and It makes java.awt and javax.swing GUI classes available and insulates the rest of ScalaTion from changes to GUI libraries. Only scalation.scala2d should import from java.awtorjavax.swing`.

The scala2d package contains classes, traits and objects for simple 2D graphics in Scala, based upon java.swing, java.awt and It makes java.awt and javax.swing GUI classes available and insulates the rest of ScalaTion from changes to GUI libraries. Only scalation.scala2d should import from java.awtorjavax.swing`.

Attributes

See also

Shapes.scala for providing classes in java.awt.geom.

type Graphics = Graphics
type Graphics2D = Graphics2D
type Label = JLabel
type MouseAdapter = MouseAdapter
type MouseEvent = MouseEvent
type MouseListener = MouseListener
type Panel = JPanel

The RectPolyShape type is a union type for rectangular shapes and polygons.

The RectPolyShape type is a union type for rectangular shapes and polygons.

Attributes

type Rectangle2D = Rectangle2D
type RectangularShape = RectangularShape
type ScrollPane = JScrollPane
type Shape = Shape
type Table = JTable

Value members

Concrete methods

def arrowTest(): Unit

The arrowTest main function is used to test the Arrow class.

The arrowTest main function is used to test the Arrow class.

runMain scalation.scala2d.arrowTest

Attributes

def colorsTest(): Unit

The colorsTest main function is used to test the Colors object.

The colorsTest main function is used to test the Colors object.

runMain scalation.scala2d.colorsTest

Attributes

def lineTest(): Unit

The lineTest main function tests drawing a line.

The lineTest main function tests drawing a line.

runMain scalation.scala2d.lineTest

Attributes

def polygonTest(): Unit

The polygonTest main function tests the Triangle, Quad, Pentagon, Hexagon and Octagon classes, testing the addPoints method.

The polygonTest main function tests the Triangle, Quad, Pentagon, Hexagon and Octagon classes, testing the addPoints method.

runMain scalation.scala2d.polygonTest

Attributes

def polygonTest2(): Unit

The polygonTest2 main function tests the Triangle, Quad, Pentagon, Hexagon and Octagon classes, testing the setFrame method.

The polygonTest2 main function tests the Triangle, Quad, Pentagon, Hexagon and Octagon classes, testing the setFrame method.

runMain scalation.scala2d.polygonTest2

Attributes

def qArrowTest(): Unit

The qArrowTest main function is used to test the QArrow class.

The qArrowTest main function is used to test the QArrow class.

runMain scalation.scala2d.qArrowTest

Attributes

def qCurveTest(): Unit

The qCurveTest main function tests the QCurve classes' quad curves.

The qCurveTest main function tests the QCurve classes' quad curves.

runMain scalation.scala2d.qCurveTest

Attributes

def qCurveTest2(): Unit

The qCurveTest2 main function tests traversal of QCurve's (quad curves).

The qCurveTest2 main function tests traversal of QCurve's (quad curves).

runMain scalation.scala2d.qCurveTest2

Attributes

def topLeft(bb: Rectangle2D): (Double, Double)

Return the top-left coordinates (x, y) of the polygon's bounding box.

Return the top-left coordinates (x, y) of the polygon's bounding box.

Value parameters

bb

the polygon's bounding box

Attributes

def writeImage(fname: String, frame: VizFrame): Unit

Write the graphs into a buffered image file.

Write the graphs into a buffered image file.

Value parameters

fname

the name of the file

gframe

the gframe containing the graphics

Attributes

See also

stackoverflow.com/questions/5655908/export-jpanel-graphics-to-png-or-gif-or-jpg/39490801#39490801

def writeImageTest(): Unit

The writeImageTest main function is used to test the writing an image file.

The writeImageTest main function is used to test the writing an image file.

Attributes

See also

scalation.mathstat.PlotM

runMain scalation.scala2d.writeImageTest

Concrete fields

val Font_BOLD: Int
val Font_ITALIC: Int

Extensions

Extensions

extension (s: RectPolyShape)
def getCenterX(): Double
def getCenterY(): Double
def getHeight(): Double
def getWidth(): Double
def setFrame(x: Double, y: Double, w: Double, h: Double): Unit