public class PixelImage
extends java.lang.Object
Some utility methods are provided for generating suitable colour models.
Constructor | Description |
---|---|
PixelImage(java.awt.Dimension size,
int[] pixels,
java.awt.image.IndexColorModel colorModel) |
Constructor.
|
Modifier and Type | Method | Description |
---|---|---|
static java.awt.image.IndexColorModel |
createColorModel(Shader shader,
boolean zeroTransparent) |
Returns an indexed colour model whose entries range from one end
to the other of a given shader object.
|
static java.awt.image.IndexColorModel |
createMaskColorModel(java.awt.Color color) |
Returns a 2-colour indexed colour model.
|
java.awt.image.IndexColorModel |
getColorModel() |
Returns the colour model.
|
int[] |
getPixels() |
Returns the pixel array.
|
java.awt.Dimension |
getSize() |
Returns the dimensions of this image.
|
void |
paintPixels(java.awt.Graphics g,
java.awt.Point origin) |
Paints this image to a given graphics context.
|
void |
paintScaledPixels(java.awt.Graphics g,
java.awt.Point origin,
int scale) |
Paints this image to a given graphics context, with each pixel
scaled by an integer factor.
|
public PixelImage(java.awt.Dimension size, int[] pixels, java.awt.image.IndexColorModel colorModel)
size
- dimensions of the imagepixels
- pixel array, fits size
all values must fall in range of colour modelcolorModel
- indexed colour modelpublic java.awt.Dimension getSize()
public int[] getPixels()
public java.awt.image.IndexColorModel getColorModel()
public void paintPixels(java.awt.Graphics g, java.awt.Point origin)
g
- graphics contextorigin
- target position for origin of painted imagepublic void paintScaledPixels(java.awt.Graphics g, java.awt.Point origin, int scale)
g
- graphics contextorigin
- target position for origin of painted imagescale
- scaling factorpublic static java.awt.image.IndexColorModel createColorModel(Shader shader, boolean zeroTransparent)
shader
- shader; should be absolutezeroTransparent
- if true, the first entry in the returned
colour map is transparentpublic static java.awt.image.IndexColorModel createMaskColorModel(java.awt.Color color)
color
- non-blank colourcolor
Copyright © 2018 Central Laboratory of the Research Councils. All Rights Reserved.