public class SVGImage extends Image<Float[],SVGImage>
Image.Field
Constructor and Description |
---|
SVGImage(int w,
int h)
Construct an empty SVG-backed image of the given size
|
SVGImage(SVGRenderHints hints) |
Modifier and Type | Method and Description |
---|---|
SVGImage |
abs()
Set all pixels to their absolute values, so that all pixel values in the
image will be greater than zero.
|
SVGImage |
addInplace(Float[] num)
Add a scalar to each pixel in this image (side-affects this image).
|
SVGImage |
addInplace(Image<?,?> im)
Add the given image to this image (side-affects this image).
|
SVGImage |
clip(Float[] min,
Float[] max)
Sets any pixels that are below
min to zero or above
max to the highest normal value that the image allows
(usually 1 for floating-point images). |
SVGImage |
clipMax(Float[] thresh)
Set all values greater than the given value to the highest normal value
that the image allows (usually 1 for floating-point images).
|
SVGImage |
clipMin(Float[] thresh)
Set all values less than the given value to zero.
|
SVGImage |
clone()
Deep copy of an image (internal image buffers copied).
|
MBFImage |
createMBFImage() |
SVGRenderer |
createRenderer()
Create a
ImageRenderer capable of drawing into this image. |
ImageRenderer<Float[],SVGImage> |
createRenderer(RenderHints options)
Create a
ImageRenderer capable of drawing into this image. |
SVGImage |
divideInplace(Float[] val)
Divide each pixel of the image by the given scalar value.
|
SVGImage |
divideInplace(Image<?,?> im)
Divide each pixel in this image by the corresponding pixel value in the
given image.
|
SVGImage |
extractCentreSubPix(float cx,
float cy,
SVGImage out)
Sub-pixel sampling of a centred rectangular region such that
dst(x, y) = src(x + center.x (width(dst) 1) ⇤ 0.5, y + center.y (height(dst) 1) ⇤ 0.5)
. |
SVGImage |
extractROI(int x,
int y,
int w,
int h)
Extract a rectangular region of interest of the given width and height.
|
SVGImage |
extractROI(int x,
int y,
SVGImage img)
Extract a rectangular region of interest from this image and put it in
the given image.
|
SVGImage |
fill(Float[] colour)
Fill this image with the given colour.
|
SVGImage |
flipX()
Flips the content horizontally.
|
SVGImage |
flipY()
Flips the content vertically.
|
Rectangle |
getContentArea()
Get bounding box of non-zero-valued pixels around the outside of the
image.
|
SVGImage |
getField(Image.Field f)
Get the given field of this image.
|
SVGImage |
getFieldCopy(Image.Field f)
Get the given field of this image, maintaining the image's aspect ratio
by doubling the fields.
|
SVGImage |
getFieldInterpolate(Image.Field f)
Get the given field of this image, maintaining the image's aspect ratio
by interpolating between the fields.
|
int |
getHeight()
Returns the image height in pixels.
|
Float[] |
getPixel(int x,
int y)
Get the value of the pixel at coordinate
(x, y) . |
Comparator<? super Float[]> |
getPixelComparator()
Returns a pixel comparator that is able to compare equality of pixels in
the given image type.
|
Float[] |
getPixelInterp(double x,
double y)
Get the value of a sub-pixel using linear-interpolation.
|
Float[] |
getPixelInterp(double x,
double y,
Float[] backgroundColour)
Get the value of a sub-pixel using linear-interpolation.
|
int |
getWidth()
Get the width (number of columns) in this image.
|
SVGImage |
internalAssign(int[] pixelData,
int width,
int height)
Copy pixels from given ARGB buffer image into this image.
|
SVGImage |
internalAssign(SVGImage im)
Assign the internal state from another image of the same type.
|
SVGImage |
internalCopy(SVGImage im)
Copy the internal state from another image of the same type.
|
SVGImage |
inverse()
Invert the image pixels by finding the maximum value and subtracting each
pixel value from that maximum.
|
Float[] |
max()
Find the maximum pixel value.
|
Float[] |
min()
Find the minimum pixel value.
|
SVGImage |
multiplyInplace(Float[] num)
Multiply each pixel of this by the given scalar.
|
SVGImage |
multiplyInplace(Image<?,?> im)
Multiply each pixel in this image by the corresponding pixel in the given
image.
|
SVGImage |
newInstance(int width,
int height)
Create a new instance of this image subclass with given dimensions.
|
SVGImage |
normalise()
Normalise all pixel values to fall within the range 0.0 - 1.0.
|
SVGImage |
overlayInplace(SVGImage image,
int x,
int y)
Overlays the given image on this image directly.
|
SVGImage |
replace(Float[] target,
Float[] replacement)
Replace pixels of a certain colour with another colour.
|
void |
setPixel(int x,
int y,
Float[] val)
Sets the pixel at
(x,y) to the given value. |
SVGImage |
subtractInplace(Float[] num)
Subtract a scalar from every pixel value in this image.
|
SVGImage |
subtractInplace(Image<?,?> im)
Subtract the corresponding pixel value from the given image from the
pixel values in this image.
|
SVGImage |
threshold(Float[] thresh)
Set all values less than the given threshold to 0 and all others to 1.
|
byte[] |
toByteImage()
Convert the image to a byte representation suitable for writing to a pnm
type format.
|
int[] |
toPackedARGBPixels()
Returns a 1D array representation of this image with each pixel
represented as a packed ARGB integer.
|
SVGImage |
zero()
Set all pixels in the image to zero.
|
accumulateWith, add, add, analyseWith, analyseWith, analyseWithMasked, combineWith, defaultBackgroundColour, defaultForegroundColour, divide, divide, drawConnectedPoints, drawCubicBezier, drawImage, drawImage, drawImage, drawLine, drawLine, drawLine, drawLine, drawLine, drawLine, drawLine, drawLines, drawPath, drawPaths, drawPoint, drawPoints, drawPolygon, drawPolygon, drawPolygonFilled, drawShape, drawShape, drawShapeFilled, drawText, drawText, drawText, drawText, drawText, drawText, drawText, drawText, extractCenter, extractCenter, extractCentreSubPix, extractCentreSubPix, extractCentreSubPix, extractROI, getBounds, getCols, getImage, getPixel, getPixelVector, getRows, multiply, multiply, overlay, padding, padding, paddingSymmetric, process, process, process, process, process, process, processInplace, processInplace, processInplace, processInplace, processInplace, processMasked, processMaskedInplace, shiftDown, shiftDown, shiftDownInplace, shiftDownInplace, shiftLeft, shiftLeft, shiftLeftInplace, shiftLeftInplace, shiftRight, shiftRight, shiftRightInplace, shiftRightInplace, shiftUp, shiftUp, shiftUpInplace, shiftUpInplace, subtract, subtract, transform, trim
public SVGImage(SVGRenderHints hints)
hints
- public SVGImage(int w, int h)
w
- the widthh
- the heightpublic SVGImage abs()
Image
public SVGImage addInplace(Image<?,?> im)
Image
addInplace
in class Image<Float[],SVGImage>
im
- The image to add to this imagepublic SVGImage addInplace(Float[] num)
Image
addInplace
in class Image<Float[],SVGImage>
num
- The value to add to every pixel in this image.public SVGImage clip(Float[] min, Float[] max)
Image
min
to zero or above
max
to the highest normal value that the image allows
(usually 1 for floating-point images). This method may side-affect this
image.public SVGImage clipMax(Float[] thresh)
Image
public SVGImage clipMin(Float[] thresh)
Image
public SVGImage clone()
Image
public SVGRenderer createRenderer()
Image
ImageRenderer
capable of drawing into this image.createRenderer
in class Image<Float[],SVGImage>
public ImageRenderer<Float[],SVGImage> createRenderer(RenderHints options)
Image
ImageRenderer
capable of drawing into this image.createRenderer
in class Image<Float[],SVGImage>
options
- Options for the rendererpublic SVGImage divideInplace(Image<?,?> im)
Image
divideInplace
in class Image<Float[],SVGImage>
im
- image The image to divide this image by.public SVGImage divideInplace(Float[] val)
Image
divideInplace
in class Image<Float[],SVGImage>
val
- The value to divide each pixel by.public SVGImage extractROI(int x, int y, SVGImage img)
Image
(0,0)
is the top-left corner.
The width and height of the extracted image should be determined from the
given image's width and height.extractROI
in class Image<Float[],SVGImage>
x
- The leftmost coordinate of the rectangle to extracty
- The topmost coordinate of the rectangle to extractimg
- The destination imagepublic SVGImage extractROI(int x, int y, int w, int h)
Image
(0,0)
is the top-left corner. Returns a new
image.extractROI
in class Image<Float[],SVGImage>
x
- The leftmost coordinate of the rectangle to extracty
- The topmost coordinate of the rectangle to extractw
- The width of the rectangle to extracth
- The height of the rectangle to extractpublic SVGImage extractCentreSubPix(float cx, float cy, SVGImage out)
Image
dst(x, y) = src(x + center.x (width(dst) 1) ⇤ 0.5, y + center.y (height(dst) 1) ⇤ 0.5)
. Sub-pixels values are estimated using bilinear interpolation.extractCentreSubPix
in class Image<Float[],SVGImage>
cx
- the x-ordinate of the centrecy
- the y-ordinate of the centreout
- the output image (also defines the size of the extracted
region)out
Image.getPixelInterp(double, double)
public SVGImage fill(Float[] colour)
Image
public SVGImage flipX()
Image
public SVGImage flipY()
Image
public Rectangle getContentArea()
Image
Image.trim()
.getContentArea
in class Image<Float[],SVGImage>
public SVGImage getField(Image.Field f)
Image
getField
in class Image<Float[],SVGImage>
f
- The Image.Field
to extract from this imagepublic SVGImage getFieldCopy(Image.Field f)
Image
getFieldCopy
in class Image<Float[],SVGImage>
f
- The Image.Field
to extract from this imagepublic SVGImage getFieldInterpolate(Image.Field f)
Image
getFieldInterpolate
in class Image<Float[],SVGImage>
f
- The Image.Field
to extract from this image.public int getHeight()
Image
public Float[] getPixel(int x, int y)
Image
(x, y)
.public Comparator<? super Float[]> getPixelComparator()
Image
getPixelComparator
in class Image<Float[],SVGImage>
Comparator
that compares pixels.public Float[] getPixelInterp(double x, double y)
Image
getPixelInterp
in class Image<Float[],SVGImage>
x
- The x-ordinate to gety
- The y-ordinate to get(x,y)
public Float[] getPixelInterp(double x, double y, Float[] backgroundColour)
Image
getPixelInterp
in class Image<Float[],SVGImage>
x
- The x-ordinate to get.y
- The y-ordinate to get.backgroundColour
- The colour of the background pixel.(x,y)
public int getWidth()
Image
public SVGImage internalCopy(SVGImage im)
Image
internalCopy
in class Image<Float[],SVGImage>
im
- The source image to make a copy of.public SVGImage internalAssign(SVGImage im)
Image
internalAssign
in class Image<Float[],SVGImage>
im
- The source image to make a copy of.public SVGImage internalAssign(int[] pixelData, int width, int height)
Image
internalAssign
in class Image<Float[],SVGImage>
pixelData
- buffer of ARGB packed integer pixelswidth
- the width of the bufferheight
- the height of the bufferpublic SVGImage inverse()
Image
public SVGImage multiplyInplace(Image<?,?> im)
Image
multiplyInplace
in class Image<Float[],SVGImage>
im
- The image to multiply with this image.public SVGImage multiplyInplace(Float[] num)
Image
multiplyInplace
in class Image<Float[],SVGImage>
num
- The scalar to multiply this image by.public SVGImage newInstance(int width, int height)
Image
newInstance
in class Image<Float[],SVGImage>
width
- The image widthheight
- The image heightI
public SVGImage normalise()
Image
public void setPixel(int x, int y, Float[] val)
Image
(x,y)
to the given value. Side-affects
this image.public SVGImage subtractInplace(Image<?,?> im)
Image
subtractInplace
in class Image<Float[],SVGImage>
im
- The image to subtract from this image.public SVGImage subtractInplace(Float[] num)
Image
subtractInplace
in class Image<Float[],SVGImage>
num
- A value to subtract from each pixel.public SVGImage threshold(Float[] thresh)
Image
public byte[] toByteImage()
Image
toByteImage
in class Image<Float[],SVGImage>
public MBFImage createMBFImage()
public int[] toPackedARGBPixels()
Image
toPackedARGBPixels
in class Image<Float[],SVGImage>
public SVGImage zero()
Image
public SVGImage overlayInplace(SVGImage image, int x, int y)
Image
overlayInplace
in class Image<Float[],SVGImage>
image
- The image to overlayx
- The location at which to overlay the imagey
- The location at which to overlay the image