|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcz.cuni.jagrlib.DefaultProperty
cz.cuni.jagrlib.Piece
cz.cuni.jagrlib.DefaultRasterGraphics
cz.cuni.jagrlib.piece.HDRImage
public class HDRImage
HDR raster image stored in memory.
Uses Java's BufferedImage
class to hold raster data,
one channel is stored as float
number.
Field Summary | |
---|---|
protected float[] |
color
Actual drawing color ( MODE_RGB , MODE_RGBA , MODE_BAND ). |
protected float[] |
data
Raw data array in scanline order. |
static float[] |
FOREGROUND
Default foreground color. |
protected java.awt.image.BufferedImage |
im
The working BufferedImage object. |
static double[] |
INIT_COLOR
Background color for image initialization. |
static int |
MAX_VALUE
Maximum gray/RGB value used in integer part of the RasterGraphics API. |
static RegPiece |
reg
Static registration instance for this class. |
protected float |
sColor
Actual drawing scalar color ( MODE_GRAY ). |
protected double[] |
tmpColor
Temporary array used for RGBA access. |
Fields inherited from class cz.cuni.jagrlib.DefaultRasterGraphics |
---|
alpha, alphaOp, BACKGROUND, BACKGROUND_D, bands, binaryOp, CATEGORY, height, INV_255, mode, setBands, setColorMode, setHeight, setWidth, TEMPLATE_NAME, transferFunction, width |
Fields inherited from class cz.cuni.jagrlib.Piece |
---|
channels, info, pl, plugs, TEMPLATE_TYPE, userBreak |
Fields inherited from interface cz.cuni.jagrlib.iface.RasterGraphics |
---|
BANDS, COLORMODE, HEIGHT, MODE_BAND, MODE_COLORMAP, MODE_GRAY, MODE_RGB, MODE_RGBA, WIDTH |
Fields inherited from interface cz.cuni.jagrlib.iface.Property |
---|
LOGGING, STATISTICS, TEXT_DESCRIPTION |
Constructor Summary | |
---|---|
HDRImage()
Creates an empty image. |
|
HDRImage(int _width,
int _height,
int _mode)
Initializes the new image. |
|
HDRImage(RasterGraphics gr,
double scale,
int _mode)
Initializes the new image from an existing image. |
Method Summary | |
---|---|
void |
downsample(int factor,
boolean border)
Downsample the image by the given integer factor. |
java.awt.image.BufferedImage |
getBufferedImage()
Copies raster graphics to a BufferedImage object. |
int |
getGray(int x,
int y)
Returns the pixel's gray value (for all modes). |
double |
getGrayDouble(int x,
int y)
Returns the pixel's gray value (for all modes). |
int |
getMaxGray()
Maximal gray value. |
int |
getMaxRGB()
Maximal RGB[A] value. |
int |
getPixel(int x,
int y)
Returns the pixel's value (for MODE_GRAY ). |
void |
getPixel(int x,
int y,
double[] _color)
Returns the pixel's value (for MODE_RGB ,
MODE_RGBA or MODE_BAND ). |
void |
getPixel(int x,
int y,
int[] _color)
Returns the pixel's value (for MODE_RGB ,
MODE_RGBA or MODE_BAND ). |
double |
getPixelDouble(int x,
int y)
Returns the pixel's value (for MODE_GRAY ). |
void |
getRGB(int x,
int y,
double[] _color)
Returns the pixel's RGB[A] values (for all graphic modes). |
void |
getRGB(int x,
int y,
int[] _color)
Returns the pixel's RGB[A] values (for all graphic modes). |
void |
init()
RasterImage re-initialization (keeps current bitmap size, mode,
and colormap attributes, too). |
void |
init(int _width,
int _height,
int _mode,
int _bands)
RasterImage (re-)initialization. |
void |
putPixel(int x,
int y,
double _color)
Sets the given pixel's value (for MODE_GRAY ). |
void |
putPixel(int x,
int y,
double[] _color)
Sets the given pixel's value (for MODE_RGB ,
MODE_RGBA or MODE_BAND ). |
void |
putPixel(int x,
int y,
int _color)
Sets the given pixel's value (for MODE_GRAY ). |
void |
putPixel(int x,
int y,
int[] _color)
Sets the given pixel's value (for MODE_RGB ,
MODE_RGBA or MODE_BAND ). |
void |
setColor(double _color)
Sets the current drawing color (for MODE_GRAY ). |
void |
setColor(double[] _color)
Sets the current drawing color (for MODE_RGB ,
MODE_RGBA or MODE_BAND ). |
void |
setColor(int _color)
Sets the current drawing color (for MODE_GRAY ). |
void |
setColor(int[] _color)
Sets the current drawing color (for MODE_RGB ,
MODE_RGBA or MODE_BAND ). |
void |
setHLine(int x1,
int x2,
int y)
Sets the horizontal line from [min(x1,x2),y] to [max(x1,x2)-1,y]. |
void |
setPixel(int x,
int y)
Sets the given pixel's value. |
static int |
setTemplate(Template t,
int ord)
General-purpose registration routine. |
Methods inherited from class cz.cuni.jagrlib.DefaultRasterGraphics |
---|
commit, drawFrame, drawLine, get, getBands, getColormap, getColormap, getColormapType, getHeight, getHLine, getHLine, getHLine, getHLine, getMaxColormap, getMode, getWidth, putHLine, putHLine, putHLine, putHLine, set, setAlpha, setAlphaOperation, setBufferedImage, setColormap, setColormap, setColormapType, setHLine, setHLine, setHLine, setHLine, setOperation, setRectangle, setRectangle, setRectangle, setRectangle, setRectangle, setTransferFunction |
Methods inherited from class cz.cuni.jagrlib.Piece |
---|
className, connect, findPlug, findPlug, getInfo, getInterface, getInterface, getPlug, getReg, init, isCompatible, isCompatible, isConnected, logError, logWarning, myInterface, newInputPlug, newOptOutputPlug, newOutputPlug, newPlug, noTemplates, propBegin, propBounds, propDefault, propEnd, propEnum, propManipulator, propManipulator, setProgressListener, setRegStrings, setTemplateDynamic, stop |
Methods inherited from class cz.cuni.jagrlib.DefaultProperty |
---|
booleanProperty, booleanProperty, colorDoubleProperty, colorProperty, doubleProperty, doubleProperty, doubleProperty, enumProperty, floatProperty, floatProperty, floatProperty, intProperty, intProperty, intProperty, longProperty, longProperty, longProperty, set, stringProperty |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int MAX_VALUE
RasterGraphics
API.
public static final double[] INIT_COLOR
public static final float[] FOREGROUND
protected java.awt.image.BufferedImage im
BufferedImage
object.
protected float[] data
DataBufferFloat
instance (accelerator).
data[0] .. R[0,0], data[1] .. G[0,0], data[2] .. B[0,0], data[3] .. A[0,0], ..
protected float sColor
MODE_GRAY
).
protected float[] color
MODE_RGB
, MODE_RGBA
, MODE_BAND
).
protected double[] tmpColor
public static final RegPiece reg
Constructor Detail |
---|
public HDRImage()
init(int,int,int,int)
should be called to initialize image size/content.
public HDRImage(int _width, int _height, int _mode)
_width
- Width of a new bitmap._height
- Height of a new bitmap._mode
- Pixel value type (RasterGraphics.MODE_*
constant).public HDRImage(RasterGraphics gr, double scale, int _mode)
gr
- Existing raster image.scale
- Scale coefficient (1.0
for no scaling})._mode
- Pixel value type (RasterGraphics.MODE_*
constant).Method Detail |
---|
public void downsample(int factor, boolean border)
border
- Set border color (to background color
)?public void init(int _width, int _height, int _mode, int _bands)
RasterImage
(re-)initialization.
init
in interface RasterGraphics
init
in class DefaultRasterGraphics
_width
- Width of a new bitmap._height
- Height of a new bitmap._mode
- Pixel value type (RasterGraphics.MODE_*
constant)._bands
- Number of bands (for MODE_BAND
).DefaultRasterGraphics.setColormapType(int, int)
public void init()
RasterImage
re-initialization (keeps current bitmap size, mode,
and colormap attributes, too).
init
in interface RasterGraphics
init
in class DefaultRasterGraphics
public int getMaxGray()
getMaxGray
in interface RasterGraphics
getMaxGray
in class DefaultRasterGraphics
public int getMaxRGB()
getMaxRGB
in interface RasterGraphics
getMaxRGB
in class DefaultRasterGraphics
public java.awt.image.BufferedImage getBufferedImage()
BufferedImage
object.
getBufferedImage
in interface RasterGraphics
getBufferedImage
in class DefaultRasterGraphics
BufferedImage
object.DefaultRasterGraphics.setBufferedImage(java.awt.image.BufferedImage)
public void setColor(int _color)
MODE_GRAY
).
setColor
in interface RasterGraphics
setColor
in class DefaultRasterGraphics
_color
- Current drawing color (0 to getMaxGray()
).RasterGraphics
public void setColor(double _color)
MODE_GRAY
).
setColor
in interface RasterGraphics
setColor
in class DefaultRasterGraphics
_color
- Current drawing color (0.0
to 1.0
).RasterGraphics
public void setColor(int[] _color)
MODE_RGB
,
MODE_RGBA
or MODE_BAND
).
setColor
in interface RasterGraphics
setColor
in class DefaultRasterGraphics
_color
- Current drawing color (channel values between
0
and getMaxRGB()
).RasterGraphics
public void setColor(double[] _color)
MODE_RGB
,
MODE_RGBA
or MODE_BAND
).
setColor
in interface RasterGraphics
setColor
in class DefaultRasterGraphics
_color
- Current drawing color (channel values between
0.0
and 1.0
).RasterGraphics
public void setPixel(int x, int y)
Ignores any off-canvas access.
setPixel
in interface RasterGraphics
setPixel
in class DefaultRasterGraphics
x
- X coordinate of a pixel.y
- Y coordinate of a pixel.setColor(int)
,
setColor(double)
,
setColor(int[])
,
setColor(double[])
,
RasterGraphics
public int getPixel(int x, int y)
MODE_GRAY
).
getPixel
in interface RasterGraphics
getPixel
in class DefaultRasterGraphics
x
- X coordinate of a pixel.y
- Y coordinate of a pixel.
0
for off-canvas access).RasterGraphics
public double getPixelDouble(int x, int y)
MODE_GRAY
).
getPixelDouble
in interface RasterGraphics
getPixelDouble
in class DefaultRasterGraphics
x
- X coordinate of a pixel.y
- Y coordinate of a pixel.
0.0
for off-canvas access).RasterGraphics
public void getPixel(int x, int y, int[] _color)
MODE_RGB
,
MODE_RGBA
or MODE_BAND
).
getPixel
in interface RasterGraphics
getPixel
in class DefaultRasterGraphics
x
- X coordinate of a pixel.y
- Y coordinate of a pixel._color
- Current pixel RGB[A] value.RasterGraphics
public void getPixel(int x, int y, double[] _color)
MODE_RGB
,
MODE_RGBA
or MODE_BAND
).
getPixel
in interface RasterGraphics
getPixel
in class DefaultRasterGraphics
x
- X coordinate of a pixel.y
- Y coordinate of a pixel._color
- Current pixel RGB[A] value.RasterGraphics
public void getRGB(int x, int y, int[] _color)
getRGB
in interface RasterGraphics
getRGB
in class DefaultRasterGraphics
x
- X coordinate of a pixel.y
- Y coordinate of a pixel._color
- Current pixel RGB[A] value (if the array's length is at least 4, alpha will be returned).public void getRGB(int x, int y, double[] _color)
getRGB
in interface RasterGraphics
getRGB
in class DefaultRasterGraphics
x
- X coordinate of a pixel.y
- Y coordinate of a pixel._color
- Current pixel RGB[A] value (if the array's length is at least 4, alpha will be returned).public int getGray(int x, int y)
getGray
in interface RasterGraphics
getGray
in class DefaultRasterGraphics
x
- X coordinate of a pixel.y
- Y coordinate of a pixel.
0
for off-canvas access).public double getGrayDouble(int x, int y)
getGrayDouble
in interface RasterGraphics
getGrayDouble
in class DefaultRasterGraphics
x
- X coordinate of a pixel.y
- Y coordinate of a pixel.
0.0
for off-canvas access).public void putPixel(int x, int y, int _color)
MODE_GRAY
).
Ignores any off-canvas access.
putPixel
in interface RasterGraphics
putPixel
in class DefaultRasterGraphics
x
- X coordinate of a pixel.y
- Y coordinate of a pixel._color
- Pixel color (between 0
and getMaxGray()
).public void putPixel(int x, int y, double _color)
MODE_GRAY
).
Ignores any off-canvas access.
putPixel
in interface RasterGraphics
putPixel
in class DefaultRasterGraphics
x
- X coordinate of a pixel.y
- Y coordinate of a pixel._color
- Pixel color (between 0.0
and 1.0
).public void putPixel(int x, int y, int[] _color)
MODE_RGB
,
MODE_RGBA
or MODE_BAND
).
Ignores any off-canvas access.
putPixel
in interface RasterGraphics
putPixel
in class DefaultRasterGraphics
x
- X coordinate of a pixel.y
- Y coordinate of a pixel._color
- Pixel color (between 0
and getMaxRGB()
).public void putPixel(int x, int y, double[] _color)
MODE_RGB
,
MODE_RGBA
or MODE_BAND
).
Ignores any off-canvas access.
putPixel
in interface RasterGraphics
putPixel
in class DefaultRasterGraphics
x
- X coordinate of a pixel.y
- Y coordinate of a pixel._color
- Pixel color (between 0.0
and 1.0
).public void setHLine(int x1, int x2, int y)
Ignores any off-canvas access.
setHLine
in interface RasterGraphics
setHLine
in class DefaultRasterGraphics
x1
- X coordinate of the starting pixel.x2
- X coordinate of the first pixel after the line.y
- Common Y coordinate of the line.setColor(int)
,
setColor(double)
,
setColor(int[])
,
setColor(double[])
,
RasterGraphics
public static int setTemplate(Template t, int ord)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |