Package net.algart.external.awt
Class MatrixToBufferedImage.InterleavedRGBToInterleaved
java.lang.Object
net.algart.external.awt.MatrixToBufferedImage
net.algart.external.awt.MatrixToBufferedImage.InterleavedRGBToInterleaved
- Direct Known Subclasses:
MatrixToBufferedImage.InterleavedBGRToInterleaved
,MatrixToBufferedImage.MonochromeToIndexed
- Enclosing class:
MatrixToBufferedImage
-
Nested Class Summary
Nested classes/interfaces inherited from class net.algart.external.awt.MatrixToBufferedImage
MatrixToBufferedImage.InterleavedBGRToInterleaved, MatrixToBufferedImage.InterleavedRGBToInterleaved, MatrixToBufferedImage.InterleavedToBandedRGB, MatrixToBufferedImage.MonochromeToIndexed
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionlong
colorValue
(Matrix<? extends PArray> interleavedMatrix, Color color, int bankIndex) Converts the color into a form, stored in the data buffer, returned byMatrixToBufferedImage.toDataBuffer(Matrix)
.boolean
protected int[]
rgbAlphaMasks
(int bandCount) Returns the band masks, which will be passed to Raster.createPackedRaster method, if you want to convert data into a packed BufferedImage.setAlwaysAddAlpha
(boolean alwaysAddAlpha) protected DataBuffer
toDataBuffer
(PArray interleavedArray, int bandCount) Actual method, on whichMatrixToBufferedImage.toDataBuffer(Matrix)
is based.toString()
Methods inherited from class net.algart.external.awt.MatrixToBufferedImage
bytesRequired, getBandCount, getDataArray, getHeight, getWidth, isUnsignedInt32, palette, setUnsignedInt32, toBufferedImage, toBufferedImage, toDataBuffer, toDataBufferBand0Filter
-
Constructor Details
-
InterleavedRGBToInterleaved
public InterleavedRGBToInterleaved()
-
-
Method Details
-
isAlwaysAddAlpha
public boolean isAlwaysAddAlpha() -
setAlwaysAddAlpha
-
colorValue
Description copied from class:MatrixToBufferedImage
Converts the color into a form, stored in the data buffer, returned byMatrixToBufferedImage.toDataBuffer(Matrix)
.The default implementation is suitable for monochrome, indexed and multi-bank data buffers.
Note: if the interleaved matrix is monochrome or indexed, i.e.
getBandCount
(interleavedMatrix)==1, this method returnsMath.round(0.3 * color.getRed() + 0.59 * color.getGreen() + 0.11 * color.getBlue())
The good idea is to provide identical R, G, B color components in such cases (if this method is not overridden).
- Overrides:
colorValue
in classMatrixToBufferedImage
- Parameters:
interleavedMatrix
- the interleaved data.color
- some color.bankIndex
- index of the bank in terms of java.awt.image.DataBuffer.- Returns:
- the corresponded component of this color or interleaved RGB-Alpha value, depending on the structure of the data buffer.
-
toString
-
toDataBuffer
Description copied from class:MatrixToBufferedImage
Actual method, on whichMatrixToBufferedImage.toDataBuffer(Matrix)
is based.The passed AlgART array must be
direct accessible
.- Specified by:
toDataBuffer
in classMatrixToBufferedImage
- Parameters:
interleavedArray
- the interleaved data.bandCount
- the number of bands: if called fromMatrixToBufferedImage.toDataBuffer(Matrix)
, it is 1 for 2-dimensional matrix anddim(0)
for 3-dimensional matrix.- Returns:
- the newly allocated DataBuffer with the same data.
-
rgbAlphaMasks
protected int[] rgbAlphaMasks(int bandCount) Description copied from class:MatrixToBufferedImage
Returns the band masks, which will be passed to Raster.createPackedRaster method, if you want to convert data into a packed BufferedImage. The resulting array may be null, that means an unpacked form of the raster (Raster.createBandedRaster), or an array containing bandCount elements: red, green, blue and (if necessary) alpha masks.- Overrides:
rgbAlphaMasks
in classMatrixToBufferedImage
- Parameters:
bandCount
- the number of masks (3 or 4, in other cases null is returned).- Returns:
- the bit masks for storing bands in the packed int values.
-