Packages

  • package root
    Definition Classes
    root
  • package hevs
    Definition Classes
    root
  • package graphics

    A library used for teaching computer science in the ISC degree programme, notably for the course _101.1 Imperative programming_.

    A library used for teaching computer science in the ISC degree programme, notably for the course _101.1 Imperative programming_.

    The library provides classes for simple graphical drawing, with primitives such as points and lines drawing, simple text with different fonts, ... Input primitives are also available using keyboard or mouse. Several examples are also provided.

    Overview

    Here is how to create a window and draw a circle on it using FunGraphics :

    val f = new FunGraphics(400, 300)
    f.drawCircle(200,150, 50)
    Definition Classes
    hevs
  • package interfaces
    Definition Classes
    graphics
  • DualLayerGraphics
  • Graphics

trait Graphics extends AnyRef

An interface that every graphic application should have (common between FunGraphics and Gdx2d).

Version

1.0

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Graphics
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Abstract Value Members

  1. abstract def clear(c: Color): Unit

    Method which cleans up the display.

    Method which cleans up the display. Everything becomes the background again.

  2. abstract def clear(): Unit

    Method which cleans up the display.

    Method which cleans up the display. Everything becomes the background again

  3. abstract def drawCircle(posX: Int, posY: Int, f: Int): Unit

    Draws a circle starting from (Top left X, Top left Y)

    Draws a circle starting from (Top left X, Top left Y)

    posX

    X top-left position of the circle

    posY

    Y top-left position of the circle

    f

    Diameter of the drawn circle

  4. abstract def drawFancyString(posX: Int, posY: Int, str: String, fontFamily: String, fontStyle: Int, fontSize: Int, color: Color, halign: Int, valign: Int, shadowX: Int, shadowY: Int, shadowColor: Color, shadowThickness: Int, outlineColor: Color, outlineThickness: Int): Unit

    Draws a text with a shadow and/or outline

    Draws a text with a shadow and/or outline

    posX

    X position of the string

    posY

    Y position of the string

    str

    the string to draw

    fontFamily

    the font family

    fontStyle

    the font style (Font.PLAIN, Font.BOLD, Font.ITALIC, ...)

    fontSize

    the font size

    color

    the text color

    halign

    the horizontal alignment (see javax.swing.SwingConstants) Valid values: LEFT, CENTER and RIGHT

    valign

    the vertical alignment (see javax.swing.SwingConstants) Valid values: TOP, CENTER and BOTTOM

    shadowX

    the shadow's X offset

    shadowY

    the shadow's Y offset

    shadowColor

    the shadow color

    shadowThickness

    the shadow thickness

    outlineColor

    the outline color

    outlineThickness

    the outline thickness

  5. abstract def drawFancyString(posX: Int, posY: Int, str: String, color: Color, size: Int): Unit

    Draws a text with a shadow

    Draws a text with a shadow

    posX

    X position of the string

    posY

    Y position of the string

    str

    the string to draw

    color

    the text color

    size

    the font size

  6. abstract def drawFillRect(rect: Rectangle): Unit

    Draw a filled rectangle in the color selected with setColor.

    Draw a filled rectangle in the color selected with setColor.

    rect

    rectangle to draw

  7. abstract def drawFillRect(posX: Int, posY: Int, width: Int, height: Int): Unit

    Draw a filled rectangle in the color selected with setColor.

    Draw a filled rectangle in the color selected with setColor.

    posX

    X coordinate of the top left corner of the rectangle

    posY

    Y coordinate of the top left corner of the rectangle

    width

    Width of the rectangle

    height

    Height of the rectangle

  8. abstract def drawFilledCircle(posX: Int, posY: Int, diameter: Int): Unit

    Draws a circle starting from (Top left X, Top left Y)

    Draws a circle starting from (Top left X, Top left Y)

    posX

    X top-left position of the circle

    posY

    Y top-left position of the circle

    diameter

    Diameter of the drawn circle

  9. abstract def drawFilledOval(posX: Int, posY: Int, width: Int, height: Int): Unit

    Draws an oval starting from (Top left X, Top left Y)

    Draws an oval starting from (Top left X, Top left Y)

    posX

    X top-left position of the circle

    posY

    Y top-left position of the circle

    width

    Width of the drawn oval

    height

    Height of the drawn oval

  10. abstract def drawFilledPolygon(p: Polygon, c: Color): Unit

    Draw a filled polygon

    Draw a filled polygon

    p

    the polygon to draw

    c

    the color of the polygon

  11. abstract def drawLine(p1x: Int, p1y: Int, p2x: Int, p2y: Int): Unit

    Draw a line from P1 to P2 in the color selected with setColor.

    Draw a line from P1 to P2 in the color selected with setColor.

    p1x

    X coordinate of P1

    p1y

    Y coordinate of P1

    p2x

    X coordinate of P2

    p2y

    Y coordinate of P2

  12. abstract def drawMirroredPicture(posX: Int, posY: Int, angle: Double, bitmap: GraphicsBitmap): Unit

    Draw a mirrored centered picture from a file (gif, jpg, png) to (posX, posY)

    Draw a mirrored centered picture from a file (gif, jpg, png) to (posX, posY)

    posX

    X position of the image

    posY

    Y position of the image

    angle

    The rotation angle of the image to be drawn

    bitmap

    A bitmap

  13. abstract def drawPicture(posX: Int, posY: Int, bitmap: GraphicsBitmap): Unit

    Draw a centered picture from a file (gif, jpg, png) to (posX, posY)

    Draw a centered picture from a file (gif, jpg, png) to (posX, posY)

    posX

    X position of the image

    posY

    Y position of the image

    bitmap

    A bitmap

  14. abstract def drawRect(rect: Rectangle): Unit

    Draw an empty rectangle in the color selected with setColor

    Draw an empty rectangle in the color selected with setColor

    rect

    rectangle to draw

  15. abstract def drawRect(posX: Int, posY: Int, width: Int, height: Int): Unit

    Draw an empty rectangle in the color selected with setColor.

    Draw an empty rectangle in the color selected with setColor.

    posX

    X coordinate of the top left corner of the rectangle

    posY

    Y coordinate of the top left corner of the rectangle

    width

    Width of the rectangle

    height

    Height of the rectangle

  16. abstract def drawString(posX: Int, posY: Int, str: String, color: Color, size: Int): Unit

    Write the given string at (posX, posY)

    Write the given string at (posX, posY)

    posX

    Position x of the string

    posY

    Position y of the string

    str

    The string to be drawn

    color

    The color of the string

    size

    The size of the font

  17. abstract def drawString(posX: Int, posY: Int, str: String, fontFamily: String, fontStyle: Int, fontSize: Int, color: Color, halign: Int, valign: Int): Unit

    Draws a string at a given location.

    Draws a string at a given location. Note that the boundaries are not checked and text may be painted outside the window

    posX

    X position of string

    posY

    Y position of string

    str

    the string to write

    fontFamily

    the font family

    fontStyle

    the font style (Font.PLAIN, Font.BOLD, Font.ITALIC, ...)

    fontSize

    the font size

    color

    the text color

    halign

    the horizontal alignment (see javax.swing.SwingConstants) Valid values: LEFT, CENTER and RIGHT

    valign

    the vertical alignment (see javax.swing.SwingConstants) Valid values: TOP, CENTER and BOTTOM

  18. abstract def drawString(posX: Int, posY: Int, str: String, font: Font, color: Color, halign: Int, valign: Int): Unit

    Draws a string at a given location with the given font, color and alignments.

    Draws a string at a given location with the given font, color and alignments. Note that the boundaries are not checked and text may be painted outside the window

    posX

    X position of string

    posY

    Y position of string

    str

    the string to write

    font

    the font

    color

    the text color

    halign

    the horizontal alignment (see javax.swing.SwingConstants) Valid values: LEFT, CENTER and RIGHT

    valign

    the vertical alignment (see javax.swing.SwingConstants) Valid values: TOP, CENTER and BOTTOM

  19. abstract def drawString(posX: Int, posY: Int, str: String, font: Font, color: Color): Unit

    Draws a string at a given location with the given font and color.

    Draws a string at a given location with the given font and color. Note that the boundaries are not checked and text may be painted outside the window

    posX

    X position of string

    posY

    Y position of string

    str

    the string to write

    font

    the font

    color

    the text color

  20. abstract def drawTransformedPicture(posX: Int, posY: Int, angle: Double, scale: Double, bitmap: GraphicsBitmap): Unit

    Draw a centered picture from a file (gif, jpg, png) to (posX, posY)

    Draw a centered picture from a file (gif, jpg, png) to (posX, posY)

    posX

    X position of the image

    posY

    Y position of the image

    angle

    The rotation angle of the image to be drawn

    scale

    The scale factor of the image to be drawn

    bitmap

    A bitmap

  21. abstract def drawTransformedPicture(posX: Int, posY: Int, angle: Double, scale: Double, imageName: String): Unit

    Draw a centered picture from a file (gif, jpg, png) to (posX, posY).

    Draw a centered picture from a file (gif, jpg, png) to (posX, posY). Warning, very slow because the image has to be reloaded

    posX

    X position of the image

    posY

    Y position of the image

    angle

    The rotation angle of the image to be drawn

    scale

    The scale factor of the image to be drawn

    imageName

    path of the image file

  22. abstract def getAvailableFonts(): Array[String]

    Returns a list of available font names on the device

    Returns a list of available font names on the device

    returns

    the list of available font names

  23. abstract def getFrameHeight(): Int

    Get the frame height

    Get the frame height

    returns

    the frame height

  24. abstract def getFrameWidth(): Int

    Get the frame width

    Get the frame width

    returns

    the frame width

  25. abstract def getStringSize(str: String): Rectangle2D

    Computes the size necessary to render a string with the current font

    Computes the size necessary to render a string with the current font

    str

    the string

    returns

    the bounding box of the rendered string

  26. abstract def getStringSize(str: String, font: Font): Rectangle2D

    Computes the size necessary to render a string with the given font

    Computes the size necessary to render a string with the given font

    str

    the string

    font

    the font

    returns

    the bounding box of the rendered string

  27. abstract def setColor(c: Color): Unit

    Set the color of the future drawings

    Set the color of the future drawings

    c

    Selected color for drawing

  28. abstract def setPenWidth(width: Float): Unit

    Sets the width of the pen

    Sets the width of the pen

    width

    The new width of the pen

  29. abstract def setPixel(x: Int, y: Int, c: Int): Unit

    Draws a pixel with a given color.

    Draws a pixel with a given color. Does not change the current color

    x

    X coordinate

    y

    Y coordinate

    c

    Color to use (RGB coded)

  30. abstract def setPixel(x: Int, y: Int, c: Color): Unit

    Draws a pixel with a given color.

    Draws a pixel with a given color. Does not change the current color.

    x

    X coordinate

    y

    Y coordinate

    c

    Color to use for this pixel (this pixel only, see setColor(Color)

  31. abstract def setPixel(x: Int, y: Int): Unit

    Draw the selected pixel with the color selected with setColor.

    Draw the selected pixel with the color selected with setColor.

    x

    X coordinate of the pixel

    y

    Y coordinate of the pixel

Concrete Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
  6. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  7. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  8. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  9. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  10. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  11. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  12. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  13. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  14. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  15. def toString(): String
    Definition Classes
    AnyRef → Any
  16. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  17. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  18. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

Inherited from AnyRef

Inherited from Any

Ungrouped