Package com.google.zxing.client.j2se
Class MatrixToImageWriter
- java.lang.Object
-
- com.google.zxing.client.j2se.MatrixToImageWriter
-
public final class MatrixToImageWriter extends java.lang.Object
Writes aBitMatrix
toBufferedImage
, file or stream. Provided here instead of core since it depends on Java SE libraries.
-
-
Field Summary
Fields Modifier and Type Field Description private static MatrixToImageConfig
DEFAULT_CONFIG
-
Constructor Summary
Constructors Modifier Constructor Description private
MatrixToImageWriter()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static java.awt.image.BufferedImage
toBufferedImage(BitMatrix matrix)
Renders aBitMatrix
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)
AstoBufferedImage(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 aBitMatrix
to a file with default configuration.static void
writeToPath(BitMatrix matrix, java.lang.String format, java.nio.file.Path file, MatrixToImageConfig config)
AswriteToPath(BitMatrix, String, Path)
, but allows customization of the output.static void
writeToStream(BitMatrix matrix, java.lang.String format, java.io.OutputStream stream)
Writes aBitMatrix
to a stream with default configuration.static void
writeToStream(BitMatrix matrix, java.lang.String format, java.io.OutputStream stream, MatrixToImageConfig config)
AswriteToStream(BitMatrix, String, OutputStream)
, but allows customization of the output.
-
-
-
Field Detail
-
DEFAULT_CONFIG
private static final MatrixToImageConfig DEFAULT_CONFIG
-
-
Method Detail
-
toBufferedImage
public static java.awt.image.BufferedImage toBufferedImage(BitMatrix matrix)
Renders aBitMatrix
as an image, where "false" bits are rendered as white, and "true" bits are rendered as black. Uses default configuration.- Parameters:
matrix
-BitMatrix
to write- Returns:
BufferedImage
representation of the input
-
toBufferedImage
public static java.awt.image.BufferedImage toBufferedImage(BitMatrix matrix, MatrixToImageConfig config)
AstoBufferedImage(BitMatrix)
, but allows customization of the output.- Parameters:
matrix
-BitMatrix
to writeconfig
- output configuration- Returns:
BufferedImage
representation of the input
-
writeToFile
@Deprecated public static void writeToFile(BitMatrix matrix, java.lang.String format, java.io.File file) throws java.io.IOException
Deprecated.- Parameters:
matrix
-BitMatrix
to writeformat
- image formatfile
- fileFile
to write image to- Throws:
java.io.IOException
- if writes to the file fail
-
writeToPath
public static void writeToPath(BitMatrix matrix, java.lang.String format, java.nio.file.Path file) throws java.io.IOException
Writes aBitMatrix
to a file with default configuration.- Parameters:
matrix
-BitMatrix
to writeformat
- image formatfile
- filePath
to write image to- Throws:
java.io.IOException
- if writes to the stream fail- See Also:
toBufferedImage(BitMatrix)
-
writeToFile
@Deprecated public static void writeToFile(BitMatrix matrix, java.lang.String format, java.io.File file, MatrixToImageConfig config) throws java.io.IOException
Deprecated.- Parameters:
matrix
-BitMatrix
to writeformat
- image formatfile
- fileFile
to write image toconfig
- output configuration- Throws:
java.io.IOException
- if writes to the file fail
-
writeToPath
public static void writeToPath(BitMatrix matrix, java.lang.String format, java.nio.file.Path file, MatrixToImageConfig config) throws java.io.IOException
AswriteToPath(BitMatrix, String, Path)
, but allows customization of the output.- Parameters:
matrix
-BitMatrix
to writeformat
- image formatfile
- filePath
to write image toconfig
- output configuration- Throws:
java.io.IOException
- if writes to the file fail
-
writeToStream
public static void writeToStream(BitMatrix matrix, java.lang.String format, java.io.OutputStream stream) throws java.io.IOException
Writes aBitMatrix
to a stream with default configuration.- Parameters:
matrix
-BitMatrix
to writeformat
- image formatstream
-OutputStream
to write image to- Throws:
java.io.IOException
- if writes to the stream fail- See Also:
toBufferedImage(BitMatrix)
-
writeToStream
public static void writeToStream(BitMatrix matrix, java.lang.String format, java.io.OutputStream stream, MatrixToImageConfig config) throws java.io.IOException
AswriteToStream(BitMatrix, String, OutputStream)
, but allows customization of the output.- Parameters:
matrix
-BitMatrix
to writeformat
- image formatstream
-OutputStream
to write image toconfig
- output configuration- Throws:
java.io.IOException
- if writes to the stream fail
-
-