public final class MatrixToImageWriter
extends java.lang.Object
BitMatrix
to BufferedImage
,
file or stream. Provided here instead of core since it depends on
Java SE libraries.Modifier and Type | Field and Description |
---|---|
private static MatrixToImageConfig |
DEFAULT_CONFIG |
Modifier | Constructor and Description |
---|---|
private |
MatrixToImageWriter() |
Modifier and Type | Method and Description |
---|---|
static java.awt.image.BufferedImage |
toBufferedImage(BitMatrix matrix)
Renders a
BitMatrix as an image, where "false" bits are rendered
as white, and "true" bits are rendered as black. |
static java.awt.image.BufferedImage |
toBufferedImage(BitMatrix matrix,
MatrixToImageConfig config)
As
toBufferedImage(BitMatrix) , but allows customization of the output. |
static void |
writeToFile(BitMatrix matrix,
java.lang.String format,
java.io.File file)
Deprecated.
|
static void |
writeToFile(BitMatrix matrix,
java.lang.String format,
java.io.File file,
MatrixToImageConfig config)
Deprecated.
|
static void |
writeToPath(BitMatrix matrix,
java.lang.String format,
java.nio.file.Path file)
Writes a
BitMatrix to a file with default configuration. |
static void |
writeToPath(BitMatrix matrix,
java.lang.String format,
java.nio.file.Path file,
MatrixToImageConfig config)
As
writeToPath(BitMatrix, String, Path) , but allows customization of the output. |
static void |
writeToStream(BitMatrix matrix,
java.lang.String format,
java.io.OutputStream stream)
Writes a
BitMatrix to a stream with default configuration. |
static void |
writeToStream(BitMatrix matrix,
java.lang.String format,
java.io.OutputStream stream,
MatrixToImageConfig config)
As
writeToStream(BitMatrix, String, OutputStream) , but allows customization of the output. |
private static final MatrixToImageConfig DEFAULT_CONFIG
public static java.awt.image.BufferedImage toBufferedImage(BitMatrix matrix)
BitMatrix
as an image, where "false" bits are rendered
as white, and "true" bits are rendered as black. Uses default configuration.matrix
- BitMatrix
to writeBufferedImage
representation of the inputpublic static java.awt.image.BufferedImage toBufferedImage(BitMatrix matrix, MatrixToImageConfig config)
toBufferedImage(BitMatrix)
, but allows customization of the output.matrix
- BitMatrix
to writeconfig
- output configurationBufferedImage
representation of the input@Deprecated public static void writeToFile(BitMatrix matrix, java.lang.String format, java.io.File file) throws java.io.IOException
writeToPath(BitMatrix, String, Path)
matrix
- BitMatrix
to writeformat
- image formatfile
- file File
to write image tojava.io.IOException
- if writes to the file failpublic static void writeToPath(BitMatrix matrix, java.lang.String format, java.nio.file.Path file) throws java.io.IOException
BitMatrix
to a file with default configuration.matrix
- BitMatrix
to writeformat
- image formatfile
- file Path
to write image tojava.io.IOException
- if writes to the stream failtoBufferedImage(BitMatrix)
@Deprecated public static void writeToFile(BitMatrix matrix, java.lang.String format, java.io.File file, MatrixToImageConfig config) throws java.io.IOException
writeToPath(BitMatrix, String, Path, MatrixToImageConfig)
matrix
- BitMatrix
to writeformat
- image formatfile
- file File
to write image toconfig
- output configurationjava.io.IOException
- if writes to the file failpublic static void writeToPath(BitMatrix matrix, java.lang.String format, java.nio.file.Path file, MatrixToImageConfig config) throws java.io.IOException
writeToPath(BitMatrix, String, Path)
, but allows customization of the output.matrix
- BitMatrix
to writeformat
- image formatfile
- file Path
to write image toconfig
- output configurationjava.io.IOException
- if writes to the file failpublic static void writeToStream(BitMatrix matrix, java.lang.String format, java.io.OutputStream stream) throws java.io.IOException
BitMatrix
to a stream with default configuration.matrix
- BitMatrix
to writeformat
- image formatstream
- OutputStream
to write image tojava.io.IOException
- if writes to the stream failtoBufferedImage(BitMatrix)
public static void writeToStream(BitMatrix matrix, java.lang.String format, java.io.OutputStream stream, MatrixToImageConfig config) throws java.io.IOException
writeToStream(BitMatrix, String, OutputStream)
, but allows customization of the output.matrix
- BitMatrix
to writeformat
- image formatstream
- OutputStream
to write image toconfig
- output configurationjava.io.IOException
- if writes to the stream fail