Class PixelImage
java.lang.Object
uk.ac.starlink.ttools.plot2.layer.PixelImage
Aggregates information for painting a colour-mapped image.
Some utility methods are provided for generating suitable colour models.
- Since:
- 4 Sep 2015
- Author:
- Mark Taylor
-
Constructor Summary
ConstructorsConstructorDescriptionPixelImage(Dimension size, int[] pixels, IndexColorModel colorModel) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionstatic IndexColorModelcreateColorModel(Shader shader, boolean zeroTransparent) Returns an indexed colour model whose entries range from one end to the other of a given shader object.static IndexColorModelcreateMaskColorModel(Color color) Returns a 2-colour indexed colour model.Returns the colour model.int[]Returns the pixel array.getSize()Returns the dimensions of this image.voidpaintPixels(Graphics g, Point origin) Paints this image to a given graphics context.voidpaintScaledPixels(Graphics g, Point origin, int scale) Paints this image to a given graphics context, with each pixel scaled by an integer factor.
-
Constructor Details
-
PixelImage
Constructor.- Parameters:
size- dimensions of the imagepixels- pixel array, fitssizeall values must fall in range of colour modelcolorModel- indexed colour model
-
-
Method Details
-
getSize
-
getPixels
public int[] getPixels()Returns the pixel array.- Returns:
- pixel array
-
getColorModel
-
paintPixels
-
paintScaledPixels
-
createColorModel
Returns an indexed colour model whose entries range from one end to the other of a given shader object.- Parameters:
shader- shader; should be absolutezeroTransparent- if true, the first entry in the returned colour map is transparent- Returns:
- colour model
-
createMaskColorModel
Returns a 2-colour indexed colour model.- Parameters:
color- non-blank colour- Returns:
- colour map with two entries:
0=transparent, 1=
color
-