Libraries.Game.Graphics.PixelMap Documentation

The PixelMap class represents an image as a collection of individual pixels. It is used by the Texture class to draw shapes and load images from files. This is a class used internally by the game engine, and most users will not need to interface with this class directl

Inherits from: Libraries.Language.Object, Libraries.Game.Disposable

Summary

Actions Summary Table

ActionsDescription
Compare(Libraries.Language.Object object)This action compares two object hash codes and returns an integer.
CreatePixelMap(integer newWidth, integer newHeight, Libraries.Game.Graphics.Format newFormat)This action will create new PixelMap data to be used in OpenGL with the given width, height, and Forma
Define2DImage(integer target, integer mipLevel, integer border)This action will create OpenGL information for the currently loaded PixelMap informatio
Dispose()This action will free up the memory used to store the pixel information of the image.
DrawCircle(integer x, integer y, integer radius, Libraries.Game.Graphics.Color color)This action will draw a hollow circle at the given point with the given radius using the given colo
DrawCircle(integer x, integer y, integer radius, integer color)This action will draw a hollow circle at the given point with the given radius using the given color cod
DrawLine(integer x1, integer y1, integer x2, integer y2, Libraries.Game.Graphics.Color color)This action will draw a line on the PixelMap between the two points given using the given colo
DrawLine(integer x1, integer y1, integer x2, integer y2, integer color)This action will draw a line on the PixelMap between the two points given using the given color cod
DrawPixelMap(Libraries.Game.Graphics.PixelMap pixmap, integer sourceX, integer sourceY, integer destX, integer destY, integer sourceWidth, integer sourceHeight)This action will draw a different PixelMap starting from the destX and destY with sourceWidth and sourceHeight on top of this PixelMap at the coordinates of sourceX, source
DrawPixelMap(Libraries.Game.Graphics.PixelMap pixmap, integer x, integer y)This action takes a different PixelMap and draws it on top of this PixelMap at the given x,y coordinates on this PixelMa
DrawRectangle(integer x, integer y, integer width, integer height, Libraries.Game.Graphics.Color color)This action will draw a hollow rectangle at the given point with the given width and height using the given colo
DrawRectangle(integer x, integer y, integer width, integer height, integer color)This action will draw a hollow rectangle at the given point with the given width and height using the given color cod
Equals(Libraries.Language.Object object)This action determines if two objects are equal based on their hash code values.
Fill(integer color)This action will fill the complete bitmap with the given color cod
Fill(Libraries.Game.Graphics.Color color)This action will fill the complete bitmap with the given colo
FillCircle(integer x, integer y, integer radius, integer color)This action will draw a solid circle at the given point with the given radius using the given color cod
FillCircle(integer x, integer y, integer radius, Libraries.Game.Graphics.Color color)This action will draw a solid circle at the given point with the given radius using the given colo
FillRectangle(integer x, integer y, integer width, integer height, Libraries.Game.Graphics.Color color)This action will draw a solid rectangle at the given point with the given width and height using the given colo
FillRectangle(integer x, integer y, integer width, integer height, integer color)This action will draw a solid rectangle at the given point with the given width and height using the given color cod
FillTriangle(integer x1, integer y1, integer x2, integer y2, integer x3, integer y3, integer color)This action will draw a solid triangle using the three given points and the given colo
FillTriangle(integer x1, integer y1, integer x2, integer y2, integer x3, integer y3, Libraries.Game.Graphics.Color color)This action will draw a solid triangle using the three given points and the given colo
GetBlending()This action will return the Blending being used on this PixelMa
GetColor()Returns the color being applied to this PixelMa
GetFormat()Returns the Format that is used by this PixelMa
GetGLInternalFormat()This action returns an integer value representing the internal GL forma
GetHashCode()This action gets the hash code for an object.
GetHeight()Returns the height of this PixelMa
GetPixel(integer x, integer y)This action will return an integer color code representing the color of the pixel at the given coordinate
GetWidth()Returns the width of this PixelMa
LoadAsynchronously(Libraries.System.File file, Libraries.Game.Graphics.Format format, boolean useMipMaps, Libraries.Game.Graphics.Drawable drawable, Libraries.Game.Graphics.Texture texture)This action will asynchronously load the PixelMap (that is, it will be loaded separately from the rest of the program's execution) and then it will be loaded into the provided Texture, which will be used to load the provided Drawable (if it is not undefined).
LoadMatrix(Libraries.Compute.Matrix matrix)This action will load a matrix into the PixelMap to create a monochrome (black and white) image.
LoadPixelMap(Libraries.System.File file)This action will load a PixelMap using an image fil
SetBlending(Libraries.Game.Graphics.Blending newBlend)This action will set the Blending to be used for this PixelMa
SetColor(Libraries.Game.Graphics.Color newColor)Sets the color being used by this PixelMap using a Color objec
SetColor(number redValue, number greenValue, number blueValue, number alphaValue)Sets the color being used by this PixelMap using color component values between 0 and 1 for the red, green, blue, and alpha component
SetColorFromCode(integer code)Sets the color being used by this PixelMap using an integer color cod
SetFilter(Libraries.Game.Graphics.Filter filter)Sets the type of interpolation Filter to be used for this PixelMa
SetPixel(integer x, integer y)This action will set the pixel at the given coordinates with the PixelMap's current colo
SetPixel(integer x, integer y, integer code)This action will set the pixel at the given coordinates with the given color cod
SetPixel(integer x, integer y, Libraries.Game.Graphics.Color setColor)This action will set the pixel at the given coordinates with the given colo
SetScale(integer scale)This action will set the scaling filter to the given typ

Actions Documentation

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 (smalle

Parameters

Return

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

CreatePixelMap(integer newWidth, integer newHeight, Libraries.Game.Graphics.Format newFormat)

This action will create new PixelMap data to be used in OpenGL with the given width, height, and Forma

Parameters

Define2DImage(integer target, integer mipLevel, integer border)

This action will create OpenGL information for the currently loaded PixelMap informatio

Parameters

Dispose()

This action will free up the memory used to store the pixel information of the image. This should only be used when the PixelMap is no longer neede

DrawCircle(integer x, integer y, integer radius, Libraries.Game.Graphics.Color color)

This action will draw a hollow circle at the given point with the given radius using the given colo

Parameters

DrawCircle(integer x, integer y, integer radius, integer color)

This action will draw a hollow circle at the given point with the given radius using the given color cod

Parameters

DrawLine(integer x1, integer y1, integer x2, integer y2, Libraries.Game.Graphics.Color color)

This action will draw a line on the PixelMap between the two points given using the given colo

Parameters

DrawLine(integer x1, integer y1, integer x2, integer y2, integer color)

This action will draw a line on the PixelMap between the two points given using the given color cod

Parameters

DrawPixelMap(Libraries.Game.Graphics.PixelMap pixmap, integer sourceX, integer sourceY, integer destX, integer destY, integer sourceWidth, integer sourceHeight)

This action will draw a different PixelMap starting from the destX and destY with sourceWidth and sourceHeight on top of this PixelMap at the coordinates of sourceX, source

Parameters

DrawPixelMap(Libraries.Game.Graphics.PixelMap pixmap, integer x, integer y)

This action takes a different PixelMap and draws it on top of this PixelMap at the given x,y coordinates on this PixelMa

Parameters

DrawRectangle(integer x, integer y, integer width, integer height, Libraries.Game.Graphics.Color color)

This action will draw a hollow rectangle at the given point with the given width and height using the given colo

Parameters

DrawRectangle(integer x, integer y, integer width, integer height, integer color)

This action will draw a hollow rectangle at the given point with the given width and height using the given color cod

Parameters

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(

Parameters

Return

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

Fill(integer color)

This action will fill the complete bitmap with the given color cod

Parameters

Fill(Libraries.Game.Graphics.Color color)

This action will fill the complete bitmap with the given colo

Parameters

FillCircle(integer x, integer y, integer radius, integer color)

This action will draw a solid circle at the given point with the given radius using the given color cod

Parameters

FillCircle(integer x, integer y, integer radius, Libraries.Game.Graphics.Color color)

This action will draw a solid circle at the given point with the given radius using the given colo

Parameters

FillRectangle(integer x, integer y, integer width, integer height, Libraries.Game.Graphics.Color color)

This action will draw a solid rectangle at the given point with the given width and height using the given colo

Parameters

FillRectangle(integer x, integer y, integer width, integer height, integer color)

This action will draw a solid rectangle at the given point with the given width and height using the given color cod

Parameters

FillTriangle(integer x1, integer y1, integer x2, integer y2, integer x3, integer y3, integer color)

This action will draw a solid triangle using the three given points and the given colo

Parameters

FillTriangle(integer x1, integer y1, integer x2, integer y2, integer x3, integer y3, Libraries.Game.Graphics.Color color)

This action will draw a solid triangle using the three given points and the given colo

Parameters

GetBlending()

This action will return the Blending being used on this PixelMa

Return

Libraries.Game.Graphics.Blending:

GetColor()

Returns the color being applied to this PixelMa

Return

Libraries.Game.Graphics.Color:

GetFormat()

Returns the Format that is used by this PixelMa

Return

Libraries.Game.Graphics.Format:

GetGLInternalFormat()

This action returns an integer value representing the internal GL forma

Return

integer:

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.

GetHeight()

Returns the height of this PixelMa

Return

integer:

GetPixel(integer x, integer y)

This action will return an integer color code representing the color of the pixel at the given coordinate

Parameters

Return

integer:

GetWidth()

Returns the width of this PixelMa

Return

integer:

LoadAsynchronously(Libraries.System.File file, Libraries.Game.Graphics.Format format, boolean useMipMaps, Libraries.Game.Graphics.Drawable drawable, Libraries.Game.Graphics.Texture texture)

This action will asynchronously load the PixelMap (that is, it will be loaded separately from the rest of the program's execution) and then it will be loaded into the provided Texture, which will be used to load the provided Drawable (if it is not undefined). This is only needed for use on the web, and when loading Drawables or Textures directly via files or file paths, it is called automatically. Most users will never need to use this action directly.

Parameters

LoadMatrix(Libraries.Compute.Matrix matrix)

This action will load a matrix into the PixelMap to create a monochrome (black and white) image. Each value is assumed to be between 0 and 1, where 0 represents a black pixel and 1 represents a white pixel.

Example Code

use Libraries.Game.Game
    use Libraries.Game.Graphics.PixelMap
    use Libraries.Game.Graphics.Drawable
    use Libraries.Game.Graphics.Texture
    use Libraries.Compute.Matrix

    class Main is Game

        PixelMap pixelMap
        Texture texture
        Drawable drawable

        action Main
            StartGame()
        end

        action CreateGame
            Matrix matrix

            // 7x7 square that is black at edges and lightens as it goes towards the center.
            matrix:Fill(7, 7, 0)
            matrix:Set(1, 1, 0.33)
            matrix:Set(2, 1, 0.33)
            matrix:Set(3, 1, 0.33)
            matrix:Set(4, 1, 0.33)
            matrix:Set(5, 1, 0.33)
            matrix:Set(5, 2, 0.33)
            matrix:Set(5, 3, 0.33)
            matrix:Set(5, 4, 0.33)
            matrix:Set(5, 5, 0.33)
            matrix:Set(4, 5, 0.33)
            matrix:Set(3, 5, 0.33)
            matrix:Set(2, 5, 0.33)
            matrix:Set(1, 5, 0.33)
            matrix:Set(1, 4, 0.33)
            matrix:Set(1, 3, 0.33)
            matrix:Set(1, 2, 0.33)

            matrix:Set(2, 2, 0.66)
            matrix:Set(3, 2, 0.66)
            matrix:Set(4, 2, 0.66)
            matrix:Set(4, 3, 0.66)
            matrix:Set(4, 4, 0.66)
            matrix:Set(3, 4, 0.66)
            matrix:Set(2, 4, 0.66)
            matrix:Set(2, 3, 0.66)

            matrix:Set(3, 3, 1)

            pixelMap:LoadMatrix(matrix)

            // Loading the PixelMap and blowing up the size of the Drawable to make it easier to see.
            texture:LoadFromPixelMap(pixelMap)
            drawable:Load(texture)
            Add(drawable)

            drawable:SetPosition(200, 200)
            drawable:SetSize(100, 100)
        end
    e

Parameters

LoadPixelMap(Libraries.System.File file)

This action will load a PixelMap using an image fil

Parameters

SetBlending(Libraries.Game.Graphics.Blending newBlend)

This action will set the Blending to be used for this PixelMa

Parameters

SetColor(Libraries.Game.Graphics.Color newColor)

Sets the color being used by this PixelMap using a Color objec

Parameters

SetColor(number redValue, number greenValue, number blueValue, number alphaValue)

Sets the color being used by this PixelMap using color component values between 0 and 1 for the red, green, blue, and alpha component

Parameters

SetColorFromCode(integer code)

Sets the color being used by this PixelMap using an integer color cod

Parameters

SetFilter(Libraries.Game.Graphics.Filter filter)

Sets the type of interpolation Filter to be used for this PixelMa

Parameters

SetPixel(integer x, integer y)

This action will set the pixel at the given coordinates with the PixelMap's current colo

Parameters

SetPixel(integer x, integer y, integer code)

This action will set the pixel at the given coordinates with the given color cod

Parameters

SetPixel(integer x, integer y, Libraries.Game.Graphics.Color setColor)

This action will set the pixel at the given coordinates with the given colo

Parameters

SetScale(integer scale)

This action will set the scaling filter to the given typ

Parameters