public class Transform
extends java.lang.Object
Modifier and Type | Field | Description |
---|---|---|
static int |
DEFAULT_COLOR_SHIFT |
Default amount to shift colors by.
|
static int |
DEFAULT_POSITION_SHIFT |
Default amount to shift an image's position.
|
static int |
DEFAULT_RESIZE_AMOUNT |
The default resize factor.
|
Constructor | Description |
---|---|
Transform() |
Modifier and Type | Method | Description |
---|---|---|
static RGBAPixel[][] |
expandHorizontal(RGBAPixel[][] originalImage,
int amount) |
Expand in the horizontal axis around the image center.
|
static RGBAPixel[][] |
expandVertical(RGBAPixel[][] originalImage,
int amount) |
Expand in the vertical axis around the image center.
|
static RGBAPixel[][] |
flipHorizontal(RGBAPixel[][] originalImage) |
Flip the image on the horizontal axis across its center.
|
static RGBAPixel[][] |
flipVertical(RGBAPixel[][] originalImage) |
Flip the image on the vertical axis across its center.
|
static RGBAPixel[][] |
greenScreen(RGBAPixel[][] originalImage) |
Remove a green screen mask from an image.
|
static RGBAPixel[][] |
lessAlpha(RGBAPixel[][] originalImage,
int amount) |
Decrease the image alpha channel value.
|
static RGBAPixel[][] |
lessBlue(RGBAPixel[][] originalImage,
int amount) |
Remove blue from the image.
|
static RGBAPixel[][] |
lessGreen(RGBAPixel[][] originalImage,
int amount) |
Remove green from the image.
|
static RGBAPixel[][] |
lessRed(RGBAPixel[][] originalImage,
int amount) |
Remove red from the image.
|
static RGBAPixel[][] |
moreAlpha(RGBAPixel[][] originalImage,
int amount) |
Increase the image alpha channel value.
|
static RGBAPixel[][] |
moreBlue(RGBAPixel[][] originalImage,
int amount) |
Add blue to the image.
|
static RGBAPixel[][] |
moreGreen(RGBAPixel[][] originalImage,
int amount) |
Add green to the image.
|
static RGBAPixel[][] |
moreRed(RGBAPixel[][] originalImage,
int amount) |
Add red to the image.
|
static RGBAPixel[][] |
mystery(RGBAPixel[][] originalImage) |
A wild and mysterious image transform.
|
static RGBAPixel[][] |
rotateLeft(RGBAPixel[][] originalImage) |
Rotate the image left by 90 degrees around its center.
|
static RGBAPixel[][] |
rotateRight(RGBAPixel[][] originalImage) |
Rotate the image right by 90 degrees around its center.
|
static RGBAPixel[][] |
shiftDown(RGBAPixel[][] originalImage,
int amount) |
Shift the image down by the specified amount.
|
static RGBAPixel[][] |
shiftLeft(RGBAPixel[][] originalImage,
int amount) |
Shift the image left by the specified amount.
|
static RGBAPixel[][] |
shiftRight(RGBAPixel[][] originalImage,
int amount) |
Shift the image right by the specified amount.
|
static RGBAPixel[][] |
shiftUp(RGBAPixel[][] originalImage,
int amount) |
Shift the image up by the specified amount.
|
static RGBAPixel[][] |
shrinkHorizontal(RGBAPixel[][] originalImage,
int amount) |
Shrink in the horizontal axis around the image center.
|
static RGBAPixel[][] |
shrinkVertical(RGBAPixel[][] originalImage,
int amount) |
Shrink in the vertical axis around the image center.
|
public static final int DEFAULT_POSITION_SHIFT
public static final int DEFAULT_COLOR_SHIFT
public static final int DEFAULT_RESIZE_AMOUNT
public static RGBAPixel[][] shiftLeft(RGBAPixel[][] originalImage, int amount)
Any pixels shifted in from off screen should be filled with FILL_VALUE. This function does not modify the original image.
originalImage
- the image to shift to the leftamount
- the amount to shift the image to the leftpublic static RGBAPixel[][] shiftRight(RGBAPixel[][] originalImage, int amount)
Any pixels shifted in from off screen should be filled with FILL_VALUE. This function does not modify the original image.
originalImage
- the image to shift to the rightamount
- the amount to shift the image to the rightpublic static RGBAPixel[][] shiftUp(RGBAPixel[][] originalImage, int amount)
Any pixels shifted in from off screen should be filled with FILL_VALUE. This function does not modify the original image.
originalImage
- the image to shift upamount
- the amount to shift the image uppublic static RGBAPixel[][] shiftDown(RGBAPixel[][] originalImage, int amount)
Any pixels shifted in from off screen should be filled with FILL_VALUE. This function does not modify the original image.
originalImage
- the image to shift downamount
- the amount to shift the image downpublic static RGBAPixel[][] rotateLeft(RGBAPixel[][] originalImage)
Any pixels rotated in from off screen should be filled with FILL_VALUE. This function does not modify the original image.
originalImage
- the image to rotate left 90 degreespublic static RGBAPixel[][] rotateRight(RGBAPixel[][] originalImage)
Any pixels rotated in from off screen should be filled with FILL_VALUE. This function does not modify the original image.
originalImage
- the image to rotate right 90 degreespublic static RGBAPixel[][] flipVertical(RGBAPixel[][] originalImage)
This function does not modify the original image. It should also not generate any new filled pixels.
originalImage
- the image to flip on its vertical axispublic static RGBAPixel[][] flipHorizontal(RGBAPixel[][] originalImage)
This function does not modify the original image. It should also not generate any new filled pixels.
originalImage
- the image to flip on its horizontal axispublic static RGBAPixel[][] moreRed(RGBAPixel[][] originalImage, int amount)
This function does not modify the original image. It should also not generate any new filled pixels.
originalImage
- the image to add red toamount
- the amount of red to addpublic static RGBAPixel[][] lessRed(RGBAPixel[][] originalImage, int amount)
This function does not modify the original image. It should also not generate any new filled pixels.
originalImage
- the image to remove red fromamount
- the amount of red to removepublic static RGBAPixel[][] moreGreen(RGBAPixel[][] originalImage, int amount)
This function does not modify the original image. It should also not generate any new filled pixels.
originalImage
- the image to add green toamount
- the amount of green to addpublic static RGBAPixel[][] lessGreen(RGBAPixel[][] originalImage, int amount)
This function does not modify the original image. It should also not generate any new filled pixels.
originalImage
- the image to remove green fromamount
- the amount of green to removepublic static RGBAPixel[][] moreBlue(RGBAPixel[][] originalImage, int amount)
This function does not modify the original image. It should also not generate any new filled pixels.
originalImage
- the image to add blue toamount
- the amount of blue to addpublic static RGBAPixel[][] lessBlue(RGBAPixel[][] originalImage, int amount)
This function does not modify the original image. It should also not generate any new filled pixels.
originalImage
- the image to remove blue fromamount
- the amount of blue to removepublic static RGBAPixel[][] moreAlpha(RGBAPixel[][] originalImage, int amount)
This function does not modify the original image. It should also not generate any new filled pixels. Note that increasing the alpha channel value makes the image less, not more, transparent.
originalImage
- the image to remove transparency fromamount
- the amount of transparency to removepublic static RGBAPixel[][] lessAlpha(RGBAPixel[][] originalImage, int amount)
This function does not modify the original image. It should also not generate any new filled pixels. Note that decreasing the image alpha channel value makes the image more, not less, transparent.
originalImage
- the image to add transparency toamount
- the amount of transparency to addpublic static RGBAPixel[][] shrinkVertical(RGBAPixel[][] originalImage, int amount)
An amount of 2 will result in an image that is half its original height. An amount of 3 will result in an image that's a third of its original height. Any pixels shrunk in from off screen should be filled with FILL_VALUE. This function does not modify the original image.
Note that this function is not tested by the test suite. You are free to complete it to enable shrink in the web interface, but it will not affect your score.
originalImage
- the image to shrinkamount
- the factor by which the image's height is reducedpublic static RGBAPixel[][] expandVertical(RGBAPixel[][] originalImage, int amount)
An amount of 2 will result in an image that is twice its original height. An amount of 3 will result in an image that's three times its original height. This function does not modify the original image. It should also not generate any new filled pixels.
Note that this function should not modify the canvas size. Pixels within the original image should be expanded, but the canvas size should remain unchanged. Some pixels will end up off screen, which is fine.
originalImage
- the image to expandamount
- the factor by which the image's height is increasedpublic static RGBAPixel[][] shrinkHorizontal(RGBAPixel[][] originalImage, int amount)
An amount of 2 will result in an image that is half its original width. An amount of 3 will result in an image that's a third of its original width. Any pixels shrunk in from off screen should be filled with FILL_VALUE. This function does not modify the original image.
Note that this function is not tested by the test suite. You are free to complete it to enable shrink in the web interface, but it will not affect your score.
originalImage
- the image to shrinkamount
- the factor by which the image's width is reducedpublic static RGBAPixel[][] expandHorizontal(RGBAPixel[][] originalImage, int amount)
An amount of 2 will result in an image that is twice its original width. An amount of 3 will result in an image that's three times its original width. This function does not modify the original image. It should also not generate any new filled pixels.
Note that this function should not modify the canvas size. Pixels within the original image should be expanded, but the canvas size should remain unchanged. Some pixels will end up off screen, which is fine.
originalImage
- the image to expandamount
- the factor by which the image's width is increasedpublic static RGBAPixel[][] greenScreen(RGBAPixel[][] originalImage)
This function should remove primarily green pixels from an image and replace them with transparent pixels (FILL_VALUE), allowing you to achieve a green screen effect. Obviously this function will destroy pixels, but it does not modify the original image.
originalImage
- the image to remove a green screen from