new WebImage(filename)
- Source:
 
Parameters:
| Name | Type | Description | 
|---|---|---|
filename | 
            
            
            
                
string
            
             | 
            
            
            Filepath to the image | 
Extends
Methods
checkDimensions()
    Reinforce the dimensions of the WebImage based on the image it displays.
- Source:
 
containsPoint(x, y) → {boolean}
    Checks if the passed point is contained in the WebImage.
- Overrides:
 - Source:
 
Parameters:
| Name | Type | Description | 
|---|---|---|
x | 
            
            
            
                
number
            
             | 
            
            
            The x coordinate of the point being tested. | 
y | 
            
            
            
                
number
            
             | 
            
            
            The y coordinate of the point being tested. | 
Returns:
- Type:
 - 
        
boolean 
    Whether the passed point is contained in the WebImage.
    
draw(__graphics__)
    Draws the WebImage in the canvas.
- Overrides:
 - Source:
 
Parameters:
| Name | Type | Description | 
|---|---|---|
__graphics__ | 
            
            
            
                
CodeHSGraphics
            
             | 
            
            
            Instance of the __graphics__ module. | 
getAlpha(x, y) → {integer}
    Get the alpha value at a given location in the image.
- Source:
 
Parameters:
| Name | Type | Description | 
|---|---|---|
x | 
            
            
            
                
number
            
             | 
            
            
            The x coordinate of the point being tested. | 
y | 
            
            
            
                
number
            
             | 
            
            
            The y coordinate of the point being tested. | 
Returns:
- Type:
 - 
        
integer 
    An integer between 0 and 255.
    
getBlue(x, y) → {integer}
    Get the blue value at a given location in the image.
- Source:
 
Parameters:
| Name | Type | Description | 
|---|---|---|
x | 
            
            
            
                
number
            
             | 
            
            
            The x coordinate of the point being tested. | 
y | 
            
            
            
                
number
            
             | 
            
            
            The y coordinate of the point being tested. | 
Returns:
- Type:
 - 
        
integer 
    An integer between 0 and 255.
    
getBorderWidth() → {number}
    Gets the width of the Thing's border.
- Inherited From:
 - Source:
 
Returns:
- Type:
 - 
        
number 
    The width of the Thing's border.
    
getGreen(x, y) → {integer}
    Get the green value at a given location in the image.
- Source:
 
Parameters:
| Name | Type | Description | 
|---|---|---|
x | 
            
            
            
                
number
            
             | 
            
            
            The x coordinate of the point being tested. | 
y | 
            
            
            
                
number
            
             | 
            
            
            The y coordinate of the point being tested. | 
Returns:
- Type:
 - 
        
integer 
    An integer between 0 and 255.
    
getHeight() → {number}
    Gets the height of the WebImage.
- Source:
 
Returns:
- Type:
 - 
        
number 
    Height of the WebImage.
    
getPixel(x, y) → {array}
    Gets a pixel at the given x and y coordinates.
Read more here:
https://developer.mozilla.org/en-US/docs/Web/API/ImageData/data
- Source:
 
Parameters:
| Name | Type | Description | 
|---|---|---|
x | 
            
            
            
                
number
            
             | 
            
            
            The x coordinate of the point being tested. | 
y | 
            
            
            
                
number
            
             | 
            
            
            The y coordinate of the point being tested. | 
Returns:
- Type:
 - 
        
array 
    An array of 4 numbers representing the (r,g,b,a) values
                    of the pixel at that coordinate.
    
getRed(x, y) → {integer}
    Get the red value at a given location in the image.
- Source:
 
Parameters:
| Name | Type | Description | 
|---|---|---|
x | 
            
            
            
                
number
            
             | 
            
            
            The x coordinate of the point being tested. | 
y | 
            
            
            
                
number
            
             | 
            
            
            The y coordinate of the point being tested. | 
Returns:
- Type:
 - 
        
integer 
    An integer between 0 and 255.
    
getType() → {type}
    Returns the type of a Thing.
- Inherited From:
 - Source:
 
Returns:
- Type:
 - 
        
type 
    The type of the Thing.
    
getWidth() → {number}
    Gets the width of the WebImage.
- Source:
 
Returns:
- Type:
 - 
        
number 
    Width of the WebImage.
    
getX() → {number}
    Gets the x position of the Thing.
- Inherited From:
 - Source:
 
Returns:
- Type:
 - 
        
number 
    The x position of the Thing.
    
getY() → {number}
    Gets the y position of the Thing.
- Inherited From:
 - Source:
 
Returns:
- Type:
 - 
        
number 
    The y position of the Thing.
    
hasBorder() → {boolean}
    Returns if a Thing has a border.
- Inherited From:
 - Source:
 
Returns:
- Type:
 - 
        
boolean 
    True if the Thing has a border.
    
isFilled() → {boolean}
    Returns if a Thing is filled.
- Inherited From:
 - Source:
 
Returns:
- Type:
 - 
        
boolean 
    True if the Thing is filled.
    
loaded(callback)
    Set a function to be called when the WebImage is loaded.
- Source:
 
Parameters:
| Name | Type | Description | 
|---|---|---|
callback | 
            
            
            
                
function
            
             | 
            
            
            A function | 
loadPixelData()
    Return the underlying ImageData for this image.
Read more at https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/getImageData
- Source:
 
move(dx, dy)
    Changes the possition of a thing by a specified x and y amount.
- Inherited From:
 - Source:
 
Parameters:
| Name | Type | Description | 
|---|---|---|
dx | 
            
            
            
                
number
            
             | 
            
            
            The resulting change in the Thing's x position. | 
dy | 
            
            
            
                
number
            
             | 
            
            
            The resulting change in the Thing's y position. | 
rotate(degrees, angleUnit)
    Rotates a Thing an additional amount of degrees.
- Inherited From:
 - Source:
 
Parameters:
| Name | Type | Description | 
|---|---|---|
degrees | 
            
            
            
                
number
            
             | 
            
            
            The degrees to rotate degrees. | 
angleUnit | 
            
            
            
                
number
            
             | 
            
            
            Whether it is degrees or radians. Defaults to degrees. | 
setAlpha(x, y, val)
    Set the alpha value at a given location in the image to `val`.
- Source:
 
Parameters:
| Name | Type | Description | 
|---|---|---|
x | 
            
            
            
                
number
            
             | 
            
            
            The x coordinate of the point being tested. | 
y | 
            
            
            
                
number
            
             | 
            
            
            The y coordinate of the point being tested. | 
val | 
            
            
            
                
integer
            
             | 
            
            
            The desired value of the alpha component at the pixel. Must be between 0 and 255. | 
setBlue(x, y, val)
    Set the blue value at a given location in the image to `val`.
- Source:
 
Parameters:
| Name | Type | Description | 
|---|---|---|
x | 
            
            
            
                
number
            
             | 
            
            
            The x coordinate of the point being tested. | 
y | 
            
            
            
                
number
            
             | 
            
            
            The y coordinate of the point being tested. | 
val | 
            
            
            
                
integer
            
             | 
            
            
            The desired value of the blue component at the pixel. Must be between 0 and 255. | 
setBorder(hasBorder)
    Sets a Thing object to filled.
Throws an error if an argument is not passed.
- Inherited From:
 - Source:
 
Parameters:
| Name | Type | Description | 
|---|---|---|
hasBorder | 
            
            
            
                
bool
            
             | 
            
            
            A boolean of whether or not Thing has a border. | 
setBorderColor(color)
    Sets the border color of a Thing.
Throws an error if there are fewer than 1 params or if
the param is undefined.
- Inherited From:
 - Source:
 
Parameters:
| Name | Type | Description | 
|---|---|---|
color | 
            
            
            
                
Color
            
             | 
            
            
            The resulting color of the Thing's border. | 
setBorderWidth(width)
    Sets the width of a Thing's border.
Throws an error if there is not 1 argument.
- Inherited From:
 - Source:
 
Parameters:
| Name | Type | Description | 
|---|---|---|
width | 
            
            
            
                
number
            
             | 
            
            
            The resulting width of the Thing's border. | 
setColor(color)
    Sets the color of a Thing.
Throws an error if there are fewer than 1 params or if
the param is undefined.
- Inherited From:
 - Source:
 
Parameters:
| Name | Type | Description | 
|---|---|---|
color | 
            
            
            
                
Color
            
             | 
            
            
            The resulting color of Thing. | 
setFilled(filled)
    Sets a Thing object to filled.
Throws an error if an argument is not passed.
- Inherited From:
 - Source:
 
Parameters:
| Name | Type | Description | 
|---|---|---|
filled | 
            
            
            
                
bool
            
             | 
            
            
            A boolean of whether or not Thing is filled. | 
setGreen(x, y, val)
    Set the green value at a given location in the image to `val`.
- Source:
 
Parameters:
| Name | Type | Description | 
|---|---|---|
x | 
            
            
            
                
number
            
             | 
            
            
            The x coordinate of the point being tested. | 
y | 
            
            
            
                
number
            
             | 
            
            
            The y coordinate of the point being tested. | 
val | 
            
            
            
                
integer
            
             | 
            
            
            The desired value of the green component at the pixel. Must be between 0 and 255. | 
setImage(filename)
    Set the image of the WebImage.
- Source:
 
Parameters:
| Name | Type | Description | 
|---|---|---|
filename | 
            
            
            
                
string
            
             | 
            
            
            Filepath to the image | 
setPixel(x, y, component, val)
    Set the `component` value at a given location in the image to `val`.
- Source:
 
Parameters:
| Name | Type | Description | 
|---|---|---|
x | 
            
            
            
                
number
            
             | 
            
            
            The x coordinate of the point being tested. | 
y | 
            
            
            
                
number
            
             | 
            
            
            The y coordinate of the point being tested. | 
component | 
            
            
            
                
integer
            
             | 
            
            
            Integer representing the color value to be set. R, G, B = 0, 1, 2, respectively. | 
val | 
            
            
            
                
integer
            
             | 
            
            
            The desired value of the `component` at the pixel. Must be between 0 and 255. | 
setPosition(x, y)
    Sets the position of a Thing.
Throws an error if there are fewer than 2 params or if
they are not numbers.
- Inherited From:
 - Source:
 
Parameters:
| Name | Type | Description | 
|---|---|---|
x | 
            
            
            
                
number
            
             | 
            
            
            The destination x coordinate of this Thing. | 
y | 
            
            
            
                
number
            
             | 
            
            
            The destination y coordinate of this Thing. | 
setRed(x, y, val)
    Set the red value at a given location in the image to `val`.
- Source:
 
Parameters:
| Name | Type | Description | 
|---|---|---|
x | 
            
            
            
                
number
            
             | 
            
            
            The x coordinate of the point being tested. | 
y | 
            
            
            
                
number
            
             | 
            
            
            The y coordinate of the point being tested. | 
val | 
            
            
            
                
integer
            
             | 
            
            
            The desired value of the red component at the pixel. Must be between 0 and 255. | 
setRotation(degrees, angleUnit)
    Sets the rotation of a Thing in degrees.
Throws an error if there are fewer than 1 params or if they
are not numbers.
- Inherited From:
 - Source:
 
Parameters:
| Name | Type | Description | 
|---|---|---|
degrees | 
            
            
            
                
number
            
             | 
            
            
            The degrees to rotate degrees. | 
angleUnit | 
            
            
            
                
number
            
             | 
            
            
            Whether it is degrees or radians. Defaults to degrees. | 
setSize(width, height)
    Sets the size of the WebImage.
- Source:
 
Parameters:
| Name | Type | Description | 
|---|---|---|
width | 
            
            
            
                
number
            
             | 
            
            
            The desired width of the resulting WebImage. | 
height | 
            
            
            
                
number
            
             | 
            
            
            The desired height of the resulting WebImage. | 
setType(type)
    Sets a Thing object's type.
Questionable of whether or not this method is used.
- Inherited From:
 - Source:
 
Parameters:
| Name | Type | Description | 
|---|---|---|
type | 
            
            
            
                
type
            
             | 
            
            
            A type to set the Thing to. |