abstract class Screen extends ScreenDriver
Provides screen (pixel) graphics.
The drawing area will have the specified width and height and will be positioned at the given location (if possible).
It will have a coordinate system with the origin (0, 0)
in the lower-left
corner and the upper-right corner at (width-1, height-1)
. All operations
ensure clipping to that area, so that it is safe to use coordinates outside
of it.
Implementation note: This abstract class does not add abstract members other
than it inherits from ScreenDriver
.
- Alphabetic
- By Inheritance
- Screen
- ScreenDriver
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
Abstract Value Members
-
abstract
val
activeColor: Color
color to be used for the next operations (except for those that use their own color)
color to be used for the next operations (except for those that use their own color)
- Definition Classes
- ScreenDriver
-
abstract
def
close(): Unit
Closes the screen this driver is associated to.
Closes the screen this driver is associated to.
- Definition Classes
- ScreenDriver
- Since
1.3.0
- Note
Might not have an effect if the underlying implementation does not support such an operation.
-
abstract
def
drawArc(p0: Pixel, width: Int, height: Int, startAngle: Int, arcAngle: Int): Unit
Draws an arc within a virtual rectangle.
Draws an arc within a virtual rectangle.
Angles are given in degrees, where 0 is the direction of the x axis and positive values count counter-clockwise while negative values count clockwise.
- p0
centre of the arc
- width
of the enclosing rectangle
- height
of the enclosing rectangle
- startAngle
start in degrees
- arcAngle
extent in degrees
- Definition Classes
- ScreenDriver
drawArc(Pixel(10,10), 5, 5, 0, 360) draws a circle of diameter 5 around the centre (10,10)
Example: -
abstract
def
drawLine(p1: Pixel, p2: Pixel): Unit
Draws a line from
p1
top2
.Draws a line from
p1
top2
.- Definition Classes
- ScreenDriver
-
abstract
def
drawPolyline(p: Seq[Pixel]): Unit
Draws a polygonal chain with vertices defined by the specified sequence.
Draws a polygonal chain with vertices defined by the specified sequence.
The chain is not closed by default. To achieve this, set the last vertex equal to the first.
- Definition Classes
- ScreenDriver
-
abstract
def
drawRectangle(p1: Pixel, p2: Pixel): Unit
Draws a rectangle with diagonal opposite corners at
p1
andp2
.Draws a rectangle with diagonal opposite corners at
p1
andp2
.- Definition Classes
- ScreenDriver
-
abstract
def
drawText(p0: Pixel, text: String): Unit
Draws a text with lower-left corner at
p0
. -
abstract
def
fillArc(p0: Pixel, width: Int, height: Int, startAngle: Int, arcAngle: Int): Unit
Fills an arc within a virtual rectangle.
Fills an arc within a virtual rectangle.
Angles are given in degrees, where 0 is the direction of the x axis and positive values count counter-clockwise while negative values count clockwise.
- p0
centre of the arc
- width
of the enclosing rectangle
- height
of the enclosing rectangle
- startAngle
start in degrees
- arcAngle
extent in degrees
- Definition Classes
- ScreenDriver
fillArc(Pixel(10,10), 5, 5, 0, 360) fills a circle of diameter 5 around the centre (10,10)
Example: -
abstract
def
fillPolygon(p: Seq[Pixel]): Unit
Fills a polygonal area with vertices defined by the specified sequence.
Fills a polygonal area with vertices defined by the specified sequence.
There is no need to close the sequence of vertices.
- Definition Classes
- ScreenDriver
-
abstract
def
fillRectangle(p1: Pixel, p2: Pixel): Unit
Fills a rectangle with diagonal opposite corners at
p1
andp2
.Fills a rectangle with diagonal opposite corners at
p1
andp2
.- Definition Classes
- ScreenDriver
-
abstract
def
getPixel(p: Pixel): Color
Gets color of a pixel.
Gets color of a pixel.
- returns
the color of the pixel at
p
orColor(0, 0, 0)
if it is outside of the drawing area
- Definition Classes
- ScreenDriver
-
abstract
def
setPixel(p: Pixel, color: Color): Unit
Sets pixel to color.
Sets pixel to color.
- Definition Classes
- ScreenDriver
Concrete 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
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clear(col: Color): Unit
Sets all pixels of the screen to a specified color.
Sets all pixels of the screen to a specified color.
- col
specified color
-
def
clear(p1: Pixel, p2: Pixel, col: Color): Unit
Sets all pixels in a rectangle with diagonal opposite corners at
p1
andp2
to a specified color.Sets all pixels in a rectangle with diagonal opposite corners at
p1
andp2
to a specified color.- col
specified color
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
def
drawCircle(p0: Pixel, r: Int): Unit
Draws a circle.
Draws a circle.
- p0
centre of the circle
- r
radius of the circle
-
def
drawCross(p0: Pixel, l: Int): Unit
Draws a cross (+) with centre at
p0
and the specified line lengthl
.Draws a cross (+) with centre at
p0
and the specified line lengthl
.- p0
centre of the cross
- l
length of the lines of the cross
-
def
drawEllipse(p0: Pixel, width: Int, height: Int): Unit
Draws an ellipse within a virtual rectangle.
Draws an ellipse within a virtual rectangle.
- p0
centre of the ellipse
- width
of the enclosing rectangle
- height
of the enclosing rectangle
-
def
drawGrid(dx: Int, dy: Int): Unit
Draws a grid on the whole screen.
Draws a grid on the whole screen.
- dx
distance of vertical lines
- dy
distance of horizontal lines
-
def
drawGrid(p1: Pixel, p2: Pixel, dx: Int, dy: Int): Unit
Draws a grid in a rectangle with diagonal opposite corners at
p1
andp2
.Draws a grid in a rectangle with diagonal opposite corners at
p1
andp2
.- dx
distance of vertical lines
- dy
distance of horizontal lines
-
def
drawSquare(p0: Pixel, l: Int): Unit
Draws a square with centre at
p0
and the specified side lengthl
.Draws a square with centre at
p0
and the specified side lengthl
.- p0
centre of the square
- l
side length of the square
-
def
drawTo(p: Pixel): Unit
Draws a line in the active color from the active starting point to the given endpoint and sets the latter as new starting point for the next
drawTo
.Draws a line in the active color from the active starting point to the given endpoint and sets the latter as new starting point for the next
drawTo
.No methods other than
moveTo
anddrawTo
have an effect on the starting point. -
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
fillCircle(p0: Pixel, r: Int): Unit
Fills a circle.
Fills a circle.
- p0
centre of the circle
- r
radius of the circle
-
def
fillEllipse(p0: Pixel, width: Int, height: Int): Unit
Fills an ellipse within a virtual rectangle.
Fills an ellipse within a virtual rectangle.
- p0
centre of the ellipse
- width
of the enclosing rectangle
- height
of the enclosing rectangle
-
def
fillSquare(p0: Pixel, l: Int): Unit
Fills a square with centre at
p0
and the specified side lengthl
.Fills a square with centre at
p0
and the specified side lengthl
.- p0
centre of the square
- l
side length of the square
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
def
flipV(y: Int): Int
Helper function for systems with origin at upper-left corner.
Helper function for systems with origin at upper-left corner.
- y
original coordinate
- returns
vertical flipped coordinate
- Attributes
- protected
- Definition Classes
- ScreenDriver
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
-
val
height: Int
- Definition Classes
- Screen → ScreenDriver
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
moveTo(p: Pixel): Unit
Sets starting point for next
drawtTo
.Sets starting point for next
drawtTo
.No methods other than
moveTo
anddrawTo
have an effect on this starting point. -
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
-
val
p0: Pixel
- Definition Classes
- Screen → ScreenDriver
-
def
setPixels(col: (Pixel) ⇒ Color): Unit
Sets all pixels of the screen to a computed color.
Sets all pixels of the screen to a computed color.
- col
computing function that maps pixel coordinates to colors
-
def
setPixels(p1: Pixel, p2: Pixel)(col: (Pixel) ⇒ Color): Unit
Sets all pixels in a rectangle with diagonal opposite corners at
p1
andp2
to a computed color.Sets all pixels in a rectangle with diagonal opposite corners at
p1
andp2
to a computed color.- col
computing function that maps pixel coordinates to colors
-
def
setPixelsParallel(col: (Pixel) ⇒ Color): Future[Unit]
Sets all pixels of the screen to a computed color using parallel operations.
Sets all pixels of the screen to a computed color using parallel operations.
The returned value can be used if further operations need to be informed when this operation is done (e.g., by setting a callback). The future is completed when either all pixels are set or some exception occurs. Note that in case of an exception some pixel settings might still continue afterwards.
- col
computing function that maps pixel coordinates to colors
- returns
a future with no specific value indicating the completion of this operation
- Since
1.1.0
-
def
setPixelsParallel(p1: Pixel, p2: Pixel)(col: (Pixel) ⇒ Color): Future[Unit]
Sets all pixels in a rectangle with diagonal opposite corners at
p1
andp2
to a computed color using parallel operations.Sets all pixels in a rectangle with diagonal opposite corners at
p1
andp2
to a computed color using parallel operations.The returned value can be used if further operations need to be informed when this operation is done (e.g., by setting a callback). The future is completed when either all pixels are set or some exception occurs. Note that in case of an exception some pixel settings might still continue afterwards.
- col
computing function that maps pixel coordinates to colors
- returns
a future with no specific value indicating the completion of this operation
- Since
1.1.0
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
val
title: String
- Definition Classes
- Screen → ScreenDriver
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
val
width: Int
- Definition Classes
- Screen → ScreenDriver