Libraries.Game.Graphics.Fonts.Line Documentation

The Line class is used to calculate the lines that need to be drawn to fill in a glyph's outline, including the points that fall on the outline itself. It scans the glyph line by line on the y-axis to find where the glyph outline begins and ends, and sets the x-intercepts accordingly. These x-intercepts/y-coordinate pairs are used in the rasterization process.

Example Code

use Libraries.Game.Graphics.Fonts.all
    use Libraries.Game.Game
    use Libraries.Containers.HashTable

    class Main is Game
        action Main
            StartGame()
        end

        action CreateGame
            Line line
            HashTable<integer, XCoordinateList> list
            // Gets the x-intercepts for a line where the pixel size is 14,
            // EM size is 2048, the vertical resolution is 1080, and the nonzero
            // value is currently 0.
            list = line:GetXInterceptsNumber(14, 14, 2048, 1080, 0)
        end
    end

Inherits from: Libraries.Language.Object

Summary

Actions Summary Table

ActionsDescription
CalculateCoordinate(integer gridCoordinate, integer pixelSize, integer emSize, integer screenSize)This action calculates and returns the scaled coordinate position of a coordinate, as an integer.
CalculateCoordinateNumber(integer gridCoordinate, integer pixelSize, integer emSize, integer screenSize)This action calculates and returns the scaled coordinate position of a coordinate, as a number.
Compare(Libraries.Language.Object object)This action compares two object hash codes and returns an integer.
Equals(Libraries.Language.Object object)This action determines if two objects are equal based on their hash code values.
GetHashCode()This action gets the hash code for an object.
GetX1()This action returns the starting x-coordinate of the line.
GetX2()This action returns the ending x-coordinate of the line.
GetXInterceptsNumber(integer xPixelSize, integer yPixelSize, integer unitsPerEM, integer yScreenSize, integer oldNonZero)This action finds all of the x-intercepts for a scanline along the y-axis, and then returns a hash table of these intercepts.
GetY1()This action returns the starting y-coordinate of the line.
GetY2()This action returns the ending y-coordinate of the line.
SetPoint1(integer x, integer y)This action sets the starting coordinates of the line.
SetPoint2(integer x, integer y)This action sets the ending coordinates of the line.
SetX1(integer x)This action sets the starting x-coordinate of the line.
SetX2(integer x)This action sets the ending x-coordinate of the line.
SetY1(integer y)This action sets the starting y-coordinate of the line.
SetY2(integer y)This action sets the ending y-coordinate of the line.
ToText()This action returns the starting and ending coordinate positions of the line as text, in ordered pair form (x, y).

Actions Documentation

CalculateCoordinate(integer gridCoordinate, integer pixelSize, integer emSize, integer screenSize)

This action calculates and returns the scaled coordinate position of a coordinate, as an integer.

Example Code

use Libraries.Game.Graphics.Fonts.all
        use Libraries.Game.Game

        class Main is Game
            action Main
                StartGame()
            end

            action CreateGame
                Line line
                output line:CalculateCoordinate(100, 12, 2048, 1080)
            end
        end

Parameters

Return

integer: Returns the scaled coordinate position of a coordinate, as an integer.

CalculateCoordinateNumber(integer gridCoordinate, integer pixelSize, integer emSize, integer screenSize)

This action calculates and returns the scaled coordinate position of a coordinate, as a number.

Example Code

use Libraries.Game.Graphics.Fonts.all
        use Libraries.Game.Game

        class Main is Game
            action Main
                StartGame()
            end

            action CreateGame
                Line line
                output line:CalculateCoordinateNumber(100, 12, 2048, 1080)
            end
        end

Parameters

Return

number: Returns the scaled coordinate position of a coordinate, as a number.

Compare(Libraries.Language.Object object)

This action compares two object hash codes and returns an integer. The result is larger if this hash code is larger than the object passed as a parameter, smaller, or equal. In this case, -1 means smaller, 0 means equal, and 1 means larger. This action was changed in Quorum 7 to return an integer, instead of a CompareResult object, because the previous implementation was causing efficiency issues.

Example Code

Object o
        Object t
        integer result = o:Compare(t) //1 (larger), 0 (equal), or -1 (smaller)

Parameters

Return

integer: The Compare result, Smaller, Equal, or Larger.

Equals(Libraries.Language.Object object)

This action determines if two objects are equal based on their hash code values.

Example Code

use Libraries.Language.Object
        use Libraries.Language.Types.Text
        Object o
        Text t
        boolean result = o:Equals(t)

Parameters

Return

boolean: True if the hash codes are equal and false if they are not equal.

GetHashCode()

This action gets the hash code for an object.

Example Code

Object o
        integer hash = o:GetHashCode()

Return

integer: The integer hash code of the object.

GetX1()

This action returns the starting x-coordinate of the line.

Example Code

use Libraries.Game.Graphics.Fonts.all
        use Libraries.Game.Game

        class Main is Game
            action Main
                StartGame()
            end

            action CreateGame
                Line line
                output line:GetX1()
            end
        end

Return

integer: Returns the starting x-coordinate of the line.

GetX2()

This action returns the ending x-coordinate of the line.

Example Code

use Libraries.Game.Graphics.Fonts.all
        use Libraries.Game.Game

        class Main is Game
            action Main
                StartGame()
            end

            action CreateGame
                Line line
                output line:GetX2()
            end
        end

Return

integer: Returns the ending x-coordinate of the line.

GetXInterceptsNumber(integer xPixelSize, integer yPixelSize, integer unitsPerEM, integer yScreenSize, integer oldNonZero)

This action finds all of the x-intercepts for a scanline along the y-axis, and then returns a hash table of these intercepts.

Example Code

use Libraries.Game.Graphics.Fonts.all
        use Libraries.Game.Game
        use Libraries.Containers.HashTable

        class Main is Game
            action Main
                StartGame()
            end

            action CreateGame
                Line line
                HashTable<integer, XCoordinateList> list
                // Gets the x-intercepts for a line where the pixel size is 14,
                // EM size is 2048, the vertical resolution is 1080, and the nonzero
                // value is currently 0.
                list = line:GetXInterceptsNumber(14, 14, 2048, 1080, 0)
            end
        end

Parameters

Return

Libraries.Containers.HashTable: Returns a hash table of x-intercepts for the line.

GetY1()

This action returns the starting y-coordinate of the line.

Example Code

use Libraries.Game.Graphics.Fonts.all
        use Libraries.Game.Game

        class Main is Game
            action Main
                StartGame()
            end

            action CreateGame
                Line line
                output line:GetY1()
            end
        end

Return

integer: Returns the starting y-coordinate of the line.

GetY2()

This action returns the ending y-coordinate of the line.

Example Code

use Libraries.Game.Graphics.Fonts.all
        use Libraries.Game.Game

        class Main is Game
            action Main
                StartGame()
            end

            action CreateGame
                Line line
                output line:GetY2()
            end
        end

Return

integer: Returns the ending y-coordinate of the line.

SetPoint1(integer x, integer y)

This action sets the starting coordinates of the line.

Example Code

use Libraries.Game.Graphics.Fonts.all
        use Libraries.Game.Game

        class Main is Game
            action Main
                StartGame()
            end

            action CreateGame
                Line line
                line:SetPoint1(0, 0)
            end
        end

Parameters

SetPoint2(integer x, integer y)

This action sets the ending coordinates of the line.

Example Code

use Libraries.Game.Graphics.Fonts.all
        use Libraries.Game.Game

        class Main is Game
            action Main
                StartGame()
            end

            action CreateGame
                Line line
                line:SetPoint2(10, 10)
            end
        end

Parameters

SetX1(integer x)

This action sets the starting x-coordinate of the line.

Example Code

use Libraries.Game.Graphics.Fonts.all
        use Libraries.Game.Game

        class Main is Game
            action Main
                StartGame()
            end

            action CreateGame
                Line line
                line:SetX1(0)
            end
        end

Parameters

SetX2(integer x)

This action sets the ending x-coordinate of the line.

Example Code

use Libraries.Game.Graphics.Fonts.all
        use Libraries.Game.Game

        class Main is Game
            action Main
                StartGame()
            end

            action CreateGame
                Line line
                line:SetX2(10)
            end
        end

Parameters

SetY1(integer y)

This action sets the starting y-coordinate of the line.

Example Code

use Libraries.Game.Graphics.Fonts.all
        use Libraries.Game.Game

        class Main is Game
            action Main
                StartGame()
            end

            action CreateGame
                Line line
                line:SetY1(0)
            end
        end

Parameters

SetY2(integer y)

This action sets the ending y-coordinate of the line.

Example Code

use Libraries.Game.Graphics.Fonts.all
        use Libraries.Game.Game

        class Main is Game
            action Main
                StartGame()
            end

            action CreateGame
                Line line
                line:SetY2(10)
            end
        end

Parameters

ToText()

This action returns the starting and ending coordinate positions of the line as text, in ordered pair form (x, y).

Example Code

use Libraries.Game.Graphics.Fonts.all
        use Libraries.Game.Game

        class Main is Game
            action Main
                StartGame()
            end

            action CreateGame
                Line line
                output line:ToText()
            end
        end

Return

text: Returns the starting and ending coordinate positions of the line as text.