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