Class WritablePixelFormat<T extends Buffer>
java.lang.Object
javafx.scene.image.PixelFormat<T>
javafx.scene.image.WritablePixelFormat<T>
- Type Parameters:
T- the type of the buffer
A
PixelFormat object representing a pixel format that can store
full colors and so can be used as a destination format to write pixel
data from an arbitrary image.- Since:
- JavaFX 2.2
-
Nested Class Summary
Nested classes/interfaces declared in class PixelFormat
PixelFormat.TypeModifier and TypeClassDescriptionstatic enumAn enum describing the in-array storage format of a single pixel managed by aPixelFormat. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns true iff thisPixelFormatobject can convert color information into a pixel representation.abstract voidStores the appropriate pixel data that represents the specified 32-bit integer representation of a color in the buffer at the specified coordinates.Methods declared in class PixelFormat
createByteIndexedInstance, createByteIndexedPremultipliedInstance, getArgb, getByteBgraInstance, getByteBgraPreInstance, getByteRgbInstance, getIntArgbInstance, getIntArgbPreInstance, getType, isPremultipliedModifier and TypeMethodDescriptionstatic PixelFormat<ByteBuffer> createByteIndexedInstance(int[] colors) Creates aPixelFormatinstance describing a pixel layout with the pixels stored as single bytes representing an index into the specified lookup table of non-premultiplied color values in theINT_ARGBformat.static PixelFormat<ByteBuffer> createByteIndexedPremultipliedInstance(int[] colors) Creates aPixelFormatinstance describing a pixel layout with the pixels stored as single bytes representing an index into the specified lookup table of premultiplied color values in theINT_ARGB_PREformat.abstract intReads pixel data from the buffer at the specified coordinates and converts it to a 32-bit integer representation of the color in theINT_ARGBformat.static WritablePixelFormat<ByteBuffer> Returns aWritablePixelFormatinstance describing a pixel layout with the pixels stored in adjacent bytes with the non-premultiplied components stored in order of increasing index: blue, green, red, alpha.static WritablePixelFormat<ByteBuffer> Returns aWritablePixelFormatinstance describing a pixel layout with the pixels stored in adjacent bytes with the premultiplied components stored in order of increasing index: blue, green, red, alpha.static PixelFormat<ByteBuffer> Returns aPixelFormatinstance describing a pixel layout with the pixels stored in adjacent bytes with the color components stored in order of increasing index: red, green, blue.static WritablePixelFormat<IntBuffer> Returns aWritablePixelFormatinstance describing a pixel layout with the pixels stored in 32-bit integers with the non-premultiplied components stored in order, from MSb to LSb: alpha, red, green, blue.static WritablePixelFormat<IntBuffer> Returns aWritablePixelFormatinstance describing a pixel layout with the pixels stored in 32-bit integers with the premultiplied components stored in order, from MSb to LSb: alpha, red, green, blue.getType()Returns the enum representing the storage format of the pixels managed by thisPixelFormatobject.abstract booleanReturns true iff the color components decoded (or encoded) by this format are pre-multiplied by the alpha component for more efficient blending calculations.
-
Method Details
-
isWritable
public boolean isWritable()Description copied from class:PixelFormatReturns true iff thisPixelFormatobject can convert color information into a pixel representation.- Specified by:
isWritablein classPixelFormat<T extends Buffer>- Returns:
- true iff this
PixelFormatcan convert colors to pixel data
-
setArgb
Stores the appropriate pixel data that represents the specified 32-bit integer representation of a color in the buffer at the specified coordinates. The 32-bit integer will contain the 4 color components in separate 8-bit fields in ARGB order from the most significant byte to the least significant byte. The buffer should be positioned to the start of the pixel data such thatbuf.get(0)would return the pixel information for the pixel at coordinates(0, 0). ThescanlineStrideparameter defines the distance from the pixel data at the start of one row to the pixel data at the start of the immediately following row at the next higher Y coordinate. Usually,scanlineStrideis the same as the width of the image multiplied by the number of data elements per pixel (1 for the case of the integer and indexed formats, or 3 or 4 in the case of the byte formats), but some images may have further padding between rows for alignment or other purposes.Color components can be composed into an integer using the following sample code:
int argb = ((alpha << 24) | (red << 16) | (green << 8) | (blue );- Parameters:
buf- the buffer of pixel datax- the X coordinate of the pixel to be ready- the Y coordinate of the pixel to be readscanlineStride- the number of buffer elements between the start of adjacent pixel rows in the bufferargb- a 32-bit value with the color to be stored in the pixel in a format similar to theType.INT_ARGBpixel format
-