Package dev.brachtendorf.graphics
Class FastPixelInt
- java.lang.Object
-
- dev.brachtendorf.graphics.FastPixelImpl
-
- dev.brachtendorf.graphics.FastPixelInt
-
- All Implemented Interfaces:
FastPixel
public class FastPixelInt extends FastPixelImpl
- Author:
- Kilian
-
-
Field Summary
-
Fields inherited from class dev.brachtendorf.graphics.FastPixelImpl
alpha, alphaReplacementThreshold, height, replacementA, replacementB, replacementG, replacementR, width
-
-
Constructor Summary
Constructors Constructor Description FastPixelInt(BufferedImage bImage)Constructs a fast pixel object with the underlying buffered image.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetAlphaInternal(int index)protected intgetBlueInternal(int index)protected intgetGreenInternal(int index)intgetOffset(int x, int y)Map the x and y values to the underlying one dimensional data arrayprotected intgetRedInternal(int index)intgetRGB(int index)intgetRGB(int x, int y)Returns an integer pixel in the default RGB color model(TYPE_INT_ARGB).voidsetAlpha(int index, int newAlpha)Set the alpha value.voidsetBlue(int index, int newBlue)voidsetGreen(int index, int newGreen)Set the green value at the specified offsetvoidsetRed(int index, int newRed)Set the red value at the specified offsetvoidsetRed(int x, int y, int newRed)Set the red value of the specified pixel-
Methods inherited from class dev.brachtendorf.graphics.FastPixelImpl
getAlpha, getAlpha, getAverageGrayscale, getAverageGrayscale, getBlue, getBlue, getBlue1D, getGreen, getGreen, getGreen1D, getLuma, getLuma, getLuma1D, getRed, getRed, getRed1D, getRGB, hasAlpha, isReplaceOpaqueColors, setAlpha, setAverageGrayscale, setBlue, setGreen, setRed, setReplaceOpaqueColors
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface dev.brachtendorf.graphics.FastPixel
getAlpha, getAverageGrayscale, getBlue, getCb, getCb, getCr, getCr, getGreen, getHue, getHue, getLuma, getRed, getSat, getSat, getVal, getVal, setAlpha, setAverageGrayscale, setAverageGrayscale, setBlue, setGreen, setReplaceOpaqueColors, setReplaceOpaqueColors
-
-
-
-
Constructor Detail
-
FastPixelInt
public FastPixelInt(BufferedImage bImage)
Constructs a fast pixel object with the underlying buffered image.Note that calling this method may cause this DataBufferobject to be incompatible with performance optimizations used by some implementations (such as caching an associated image in video memory).
- Parameters:
bImage- The buffered image to extract data from- Since:
- 1.3.0 com.github.kilianB
-
-
Method Detail
-
getRGB
public int getRGB(int index)
-
getRGB
public int getRGB(int x, int y)Returns an integer pixel in the default RGB color model(TYPE_INT_ARGB). There are only 8-bits of precision for each color component in the returned data when using this method. An ArrayOutOfBoundsException may be thrown if the coordinates are not in bounds.- Parameters:
x- the X coordinate of the pixel from which to get the pixel in the default RGB color modely- the Y coordinate of the pixel from which to get the pixel in the default RGB color model- Returns:
- an integer pixel in the default RGB color model and default sRGB colorspace.
- Since:
- 1.3.0 com.github.kilianB
-
getAlphaInternal
public int getAlphaInternal(int index)
- Specified by:
getAlphaInternalin classFastPixelImpl
-
setAlpha
public void setAlpha(int index, int newAlpha)Description copied from interface:FastPixelSet the alpha value. This method is a NOP if alpha is not supported.- Parameters:
index- the offset of the underlying arraynewAlpha- the new alpha value in range [0-255]
-
getRedInternal
protected int getRedInternal(int index)
- Specified by:
getRedInternalin classFastPixelImpl
-
setRed
public void setRed(int index, int newRed)Description copied from interface:FastPixelSet the red value at the specified offset- Parameters:
index- the offset of the underlying arraynewRed- the new red value in range [0-255]
-
setRed
public void setRed(int x, int y, int newRed)Set the red value of the specified pixel- Parameters:
x- The x coordinate of the images' pixely- The y coordinate of the images' pixelnewRed- the new red value in range [0-255]- Since:
- 1.3.0 com.github.kilianB
-
getGreenInternal
protected int getGreenInternal(int index)
- Specified by:
getGreenInternalin classFastPixelImpl
-
setGreen
public void setGreen(int index, int newGreen)Description copied from interface:FastPixelSet the green value at the specified offset- Parameters:
index- the offset of the underlying arraynewGreen- the new green value in range [0-255]
-
getBlueInternal
protected int getBlueInternal(int index)
- Specified by:
getBlueInternalin classFastPixelImpl
-
setBlue
public void setBlue(int index, int newBlue)
-
getOffset
public int getOffset(int x, int y)Description copied from interface:FastPixelMap the x and y values to the underlying one dimensional data array- Parameters:
x- the x coordinatey- the y coordinate- Returns:
- the corresponding 1d array index
-
-