public class RasterPlotter
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
RasterPlotter.DrawMode |
static class |
RasterPlotter.FilterMode |
Modifier and Type | Field and Description |
---|---|
private long |
backgroundCol |
static long |
BLUE |
private int[] |
cc |
private int |
defaultColB |
private int |
defaultColG |
private int |
defaultColR |
private RasterPlotter.DrawMode |
defaultMode |
private byte[] |
frame |
static long |
GREEN |
static long |
GREY |
private java.awt.image.WritableRaster |
grid |
protected int |
height |
private static byte[] |
IDAT |
private static byte[] |
IEND |
private static byte[] |
IHDR |
private java.awt.image.BufferedImage |
image |
static ConcurrentLog |
log |
static double |
PI180 |
static double |
PI2 |
static double |
PI32 |
static double |
PI4 |
static long |
RED |
static double |
TL |
protected int |
width |
Constructor and Description |
---|
RasterPlotter(int width,
int height,
RasterPlotter.DrawMode drawMode,
long backgroundColor) |
RasterPlotter(int width,
int height,
RasterPlotter.DrawMode drawMode,
java.lang.String backgroundColor) |
Modifier and Type | Method and Description |
---|---|
void |
antialiasing(int ulx,
int uly,
int lrx,
int lry,
int bgcolor)
antialiasing filter for a square part of the image
|
void |
arc(int x,
int y,
int innerRadius,
int outerRadius,
int intensity) |
void |
arc(int x,
int y,
int innerRadius,
int outerRadius,
int fromArc,
int toArc) |
void |
arcArc(int cx,
int cy,
int arcRadius,
double angle,
int innerRadius,
int outerRadius,
int intensity) |
void |
arcArc(int cx,
int cy,
int arcRadius,
double angle,
int innerRadius,
int outerRadius,
int fromArc,
int toArc) |
void |
arcConnect(int cx,
int cy,
int arcRadius,
double angle1,
double angle2,
boolean in,
java.lang.Long colorLine,
int intensityLine,
java.lang.Long colorDot,
int intensityDot,
int dotDist,
int dotPos,
int dotRadius,
boolean dotFilled,
java.lang.String message,
java.lang.Long colorMessage,
int intensityMessage)
draw a connecting line between two points on a circle
|
void |
arcDot(int cx,
int cy,
int arcRadius,
double angle,
int dotRadius) |
void |
arcLine(int cx,
int cy,
int innerRadius,
int outerRadius,
double angle,
boolean in,
java.lang.Long colorLine,
java.lang.Long colorDot,
int dotDist,
int dotPos,
int dotRadius,
boolean dotFilled)
draw a portion of a line from the center of a circle
|
void |
blur(int ulx,
int uly,
int lrx,
int lry)
blur filter for a square part of the image
|
void |
clear()
Deletes all pixels of image and sets them to previously defined
background color.
|
static java.awt.image.BufferedImage |
convertToIndexed(java.awt.image.BufferedImage src) |
static boolean |
darkColor(long c) |
static boolean |
darkColor(java.lang.String s) |
static void |
demoPaint(RasterPlotter m) |
void |
dot(int x,
int y,
int radius,
boolean filled,
int intensity) |
static ByteBuffer |
exportImage(java.awt.image.BufferedImage image,
java.lang.String targetExt)
Encode buffered image using specified format to a new ByteBuffer
|
ByteBuffer |
exportPng() |
private void |
filter(int ulx,
int uly,
int lrx,
int lry,
RasterPlotter.FilterMode filter,
int bgcolor)
filter for a square part of the ymageMatrix
|
int |
getHeight() |
java.awt.image.BufferedImage |
getImage() |
int[] |
getPixel(int x,
int y) |
int[] |
getPixel(int x,
int y,
int[] c) |
int |
getWidth() |
void |
insertBitmap(java.awt.image.BufferedImage bitmap,
int x,
int y)
inserts image
|
void |
insertBitmap(java.awt.image.BufferedImage bitmap,
int x,
int y,
int transRGB)
inserts image where all pixels that have the same RGB value as the
pixel at (xx, yy) are transparent
|
void |
insertBitmap(java.awt.image.BufferedImage bitmap,
int x,
int y,
int xx,
int yy)
inserts image where all pixels which have the same RGB value as the
pixel at (xx, yy) are transparent
|
void |
insertBitmap(java.awt.image.BufferedImage bitmap,
int x,
int y,
int xx,
int yy,
RasterPlotter.FilterMode filter)
inserts image where all pixels that have the same RGB value as the
pixel at (xx, yy) are transparent
|
void |
insertBitmap(java.awt.image.BufferedImage bitmap,
int x,
int y,
int transRGB,
RasterPlotter.FilterMode filter)
inserts image where all pixels that have a special RGB value
pixel at (xx, yy) are transparent
|
void |
insertBitmap(java.awt.image.BufferedImage bitmap,
int x,
int y,
RasterPlotter.FilterMode filter)
inserts image
|
void |
invert(int ulx,
int uly,
int lrx,
int lry)
invert filter for a square part of the image
|
void |
line(int Ax,
int Ay,
int Bx,
int By,
int intensity) |
void |
line(int Ax,
int Ay,
int Bx,
int By,
java.lang.Long colorLine,
int intensityLine,
java.lang.Long colorDot,
int intensityDot,
int dotDist,
int dotPos,
int dotRadius,
boolean dotFilled)
draw a line using Bresenham's line drawing algorithm.
|
void |
lineArrow(int x0,
int y0,
int x1,
int y1,
int sidelength,
int padding,
long lineColor,
long arrowColor)
draw a line with an arrow at the end
|
void |
lineDot(int x0,
int y0,
int x1,
int y1,
int radius,
int padding,
long lineColor,
long dotColor)
draw a line with a dot at the end
|
static void |
main(java.lang.String[] args) |
void |
plot(int x,
int y) |
void |
plot(int x,
int y,
int intensity) |
byte[] |
pngEncode(int compressionLevel) |
void |
save(java.io.File file,
java.lang.String type)
save the image to a file
|
void |
setColor(long c) |
void |
setDrawMode(RasterPlotter.DrawMode drawMode) |
void |
setPixel(int x,
int y,
int[] c) |
void |
show()
show the image as JFrame on desktop
|
java.awt.image.BufferedImage |
toIndexed() |
private static int |
writeBytes(byte[] target,
byte[] data,
int offset) |
private static int |
writeInt4(byte[] target,
int n,
int offset) |
public static final ConcurrentLog log
public static final double PI180
public static final double PI4
public static final double PI2
public static final double PI32
public static final double TL
public static final long RED
public static final long GREEN
public static final long BLUE
public static final long GREY
protected final int width
protected final int height
private final int[] cc
private java.awt.image.BufferedImage image
private java.awt.image.WritableRaster grid
private int defaultColR
private int defaultColG
private int defaultColB
private final long backgroundCol
private RasterPlotter.DrawMode defaultMode
private byte[] frame
private static final byte[] IHDR
private static final byte[] IDAT
private static final byte[] IEND
public RasterPlotter(int width, int height, RasterPlotter.DrawMode drawMode, java.lang.String backgroundColor)
public RasterPlotter(int width, int height, RasterPlotter.DrawMode drawMode, long backgroundColor)
public final void clear()
public void setDrawMode(RasterPlotter.DrawMode drawMode)
public java.awt.image.BufferedImage getImage()
public int getWidth()
public int getHeight()
public static boolean darkColor(java.lang.String s)
public static boolean darkColor(long c)
public int[] getPixel(int x, int y)
public int[] getPixel(int x, int y, int[] c)
public void setPixel(int x, int y, int[] c)
public void setColor(long c)
public void plot(int x, int y)
public void plot(int x, int y, int intensity)
public void line(int Ax, int Ay, int Bx, int By, int intensity)
public void line(int Ax, int Ay, int Bx, int By, java.lang.Long colorLine, int intensityLine, java.lang.Long colorDot, int intensityDot, int dotDist, int dotPos, int dotRadius, boolean dotFilled)
Ax
- Ay
- Bx
- By
- colorLine
- intensityLine
- colorDot
- intensityDot
- dotDist
- dotPos
- dotRadius
- dotFilled
- public void lineDot(int x0, int y0, int x1, int y1, int radius, int padding, long lineColor, long dotColor)
x0
- start pointy0
- start pointx1
- end pointy1
- end pointradius
- radius of the dotpadding
- the distance of the dot border to the end pointlineColor
- the color of the linedotColor
- the color of the dotpublic void lineArrow(int x0, int y0, int x1, int y1, int sidelength, int padding, long lineColor, long arrowColor)
x0
- start pointy0
- start pointx1
- end pointy1
- end pointsidelength
- the side length of the arrow tip (all 3 sides are equal)padding
- the distance of the arrow tip to the end pointlineColor
- the color of the linearrowColor
- the color of the arrow tippublic void dot(int x, int y, int radius, boolean filled, int intensity)
public void arc(int x, int y, int innerRadius, int outerRadius, int intensity)
public void arc(int x, int y, int innerRadius, int outerRadius, int fromArc, int toArc)
public void arcLine(int cx, int cy, int innerRadius, int outerRadius, double angle, boolean in, java.lang.Long colorLine, java.lang.Long colorDot, int dotDist, int dotPos, int dotRadius, boolean dotFilled)
cx
- center of circle, xcy
- center of circle, yinnerRadius
- inner radius of lineouterRadius
- outer radius of lineangle
- angle within the circle for the linein
- direction, if true: inward. This is the moving direction of dots, if dotRadius is alternated from 0 to 360colorLine
- the color of the linecolorDot
- the color of the dotdotDist
- the distance of two dotsdotPos
- the start position of the first dotdotRadius
- the radius of the dotdotFilled
- if true: dot is filled.public void arcDot(int cx, int cy, int arcRadius, double angle, int dotRadius)
public void arcConnect(int cx, int cy, int arcRadius, double angle1, double angle2, boolean in, java.lang.Long colorLine, int intensityLine, java.lang.Long colorDot, int intensityDot, int dotDist, int dotPos, int dotRadius, boolean dotFilled, java.lang.String message, java.lang.Long colorMessage, int intensityMessage)
cx
- center of circle, xcy
- center of circle, yarcRadius
- radius of circleangle1
- position of dot 1 on circleangle2
- position of dot 2 on circlein
- direction of dots on line; in=true means: inwardscolorLine
- intensityLine
- colorDot
- intensityDot
- dotDist
- dotPos
- dotRadius
- dotFilled
- public void arcArc(int cx, int cy, int arcRadius, double angle, int innerRadius, int outerRadius, int intensity)
public void arcArc(int cx, int cy, int arcRadius, double angle, int innerRadius, int outerRadius, int fromArc, int toArc)
public void insertBitmap(java.awt.image.BufferedImage bitmap, int x, int y)
bitmap
- bitmap to be insertedx
- x-value of upper left coordinate where bitmap will be placedy
- y-value of upper left coordinate where bitmap will be placedpublic void insertBitmap(java.awt.image.BufferedImage bitmap, int x, int y, RasterPlotter.FilterMode filter)
bitmap
- bitmap to be insertedx
- x-value of upper left coordinate where bitmap will be placedy
- y-value of upper left coordinate where bitmap will be placedfilter
- chooses filterpublic void insertBitmap(java.awt.image.BufferedImage bitmap, int x, int y, int xx, int yy)
bitmap
- bitmap to be insertedx
- x-value of upper left coordinate where bitmap will be placedy
- y-value of upper left coordinate where bitmap will be placedxx
- x-value of pixel that determines which color is transparentyy
- y-value of pixel that determines which color is transparentpublic void insertBitmap(java.awt.image.BufferedImage bitmap, int x, int y, int xx, int yy, RasterPlotter.FilterMode filter)
bitmap
- bitmap to be insertedx
- x-value of upper left coordinate where bitmap will be placedy
- y-value of upper left coordinate where bitmap will be placedxx
- x-value of pixel that determines which color is transparentyy
- y-value of pixel that determines which color is transparentfilter
- filter to be appliedpublic void insertBitmap(java.awt.image.BufferedImage bitmap, int x, int y, int transRGB)
bitmap
- bitmap to be insertedx
- x-value of upper left coordinate where bitmap will be placedy
- y-value of upper left coordinate where bitmap will be placedrgb
- RGB value which will be transparentpublic void insertBitmap(java.awt.image.BufferedImage bitmap, int x, int y, int transRGB, RasterPlotter.FilterMode filter)
bitmap
- bitmap to be insertedx
- x-value of upper left coordinate where bitmap will be placedy
- y-value of upper left coordinate where bitmap will be placedrgb
- RGB value which will be transparentfilter
- filter to be appliedpublic void antialiasing(int ulx, int uly, int lrx, int lry, int bgcolor)
ulx
- x-value for upper left coordinateuly
- y-value for upper left coordinatelrx
- x-value for lower right coordinatelry
- y-value for lower right coordinatergb
- color of backgroundpublic void blur(int ulx, int uly, int lrx, int lry)
ulx
- x-value for upper left coordinateuly
- y-value for upper left coordinatelrx
- x-value for lower right coordinatelry
- y-value for lower right coordinatepublic void invert(int ulx, int uly, int lrx, int lry)
ulx
- x-value for upper left coordinateuly
- y-value for upper left coordinatelrx
- x-value for lower right coordinatelry
- y-value for lower right coordinateprivate void filter(int ulx, int uly, int lrx, int lry, RasterPlotter.FilterMode filter, int bgcolor)
ulx
- x-value for upper left coordinateuly
- y-value for upper left coordinatelrx
- x-value for lower right coordinatelry
- y-value for lower right coordinatefilter
- chooses filterpublic static void demoPaint(RasterPlotter m)
public java.awt.image.BufferedImage toIndexed()
public static java.awt.image.BufferedImage convertToIndexed(java.awt.image.BufferedImage src)
public static ByteBuffer exportImage(java.awt.image.BufferedImage image, java.lang.String targetExt)
image
- image to encodetargetExt
- format name. For example "png".public ByteBuffer exportPng()
public void save(java.io.File file, java.lang.String type) throws java.io.IOException
file
- the storage filetype
- the file type, may be i.e. 'png' or 'gif'java.io.IOException
public void show()
public final byte[] pngEncode(int compressionLevel) throws java.io.IOException
java.io.IOException
private static final int writeInt4(byte[] target, int n, int offset)
private static final int writeBytes(byte[] target, byte[] data, int offset)
public static void main(java.lang.String[] args)