public class SimpleManipulations
extends java.lang.Object
Constructor and Description |
---|
SimpleManipulations() |
Modifier and Type | Method and Description |
---|---|
static PixelPicture |
alphaBlend(double alpha,
PixelPicture pic,
PixelPicture f)
Blend two pictures together by taking a weighted average of each pixel.
|
static PixelPicture |
border(PixelPicture pic,
int borderWidth,
Pixel borderColor)
Create a new image by adding a border to a specified image.
|
static PixelPicture |
grayScaleAverage(PixelPicture pic)
Transform a colored picture to its grayscale equivalent using an averaging
algorithm.
|
static PixelPicture |
grayScaleLuminosity(PixelPicture pic)
Transforms a picture to its GrayScale equivalent using the luminosity
algorithm.
|
static PixelPicture |
invertColors(PixelPicture pic)
Create a new image by inverting the color of each pixel.
|
static PixelPicture |
rotateCCW(PixelPicture pic)
Rotate a picture 90 degrees counter-clockwise.
|
static PixelPicture |
rotateCW(PixelPicture pic)
Rotate a picture 90 degrees clockwise.
|
static PixelPicture |
scaleColors(PixelPicture pic,
double rfactor,
double gfactor,
double bfactor)
Scale the color components of a picture.
|
static PixelPicture |
vignette(PixelPicture pic)
Adds dark edges to an image to draw interest to the center.
|
static int |
weightedAverage(double alpha,
int x,
int y)
Compute the weighted average of two integers.
|
public static PixelPicture rotateCW(PixelPicture pic)
pic
- The original picture to rotate.public static PixelPicture rotateCCW(PixelPicture pic)
pic
- The original picture to rotate.public static PixelPicture border(PixelPicture pic, int borderWidth, Pixel borderColor)
pic
- the original pictureborderWidth
- number of pixels in the borderborderColor
- color of the border.public static PixelPicture grayScaleLuminosity(PixelPicture pic)
public static PixelPicture invertColors(PixelPicture pic)
pic
- the picture to be invertedpublic static PixelPicture grayScaleAverage(PixelPicture pic)
pic
- the original picturepublic static PixelPicture scaleColors(PixelPicture pic, double rfactor, double gfactor, double bfactor)
rfactor
- red factorgfactor
- green factorbfactor
- blue factorpublic static int weightedAverage(double alpha, int x, int y)
public static PixelPicture alphaBlend(double alpha, PixelPicture pic, PixelPicture f)
alpha
- pic
- f
- public static PixelPicture vignette(PixelPicture pic)