public class BitmapBuilder extends Object
| Modifier | Constructor and Description |
|---|---|
protected |
BitmapBuilder()
Utility class: Constructor prevents instantiating when subclassed.
|
| Modifier and Type | Method and Description |
|---|---|
static BufferedImage |
getImage(BarcodeGenerator bargen,
String msg,
int resolution)
Generates a barcode as bitmap image.
|
static void |
outputBarcodeImage(BarcodeGenerator bargen,
String msg,
OutputStream out,
String mime,
int resolution)
Generates a barcode as bitmap image file.
|
static Graphics2D |
prepareGraphics2D(BufferedImage image,
BarcodeDimension dim,
int orientation,
boolean antiAlias)
Prepares a Graphics2D object for painting on a given BufferedImage.
|
static BufferedImage |
prepareImage(BarcodeDimension dim,
int resolution,
int imageType)
Prepares a BufferedImage to paint to.
|
static BufferedImage |
prepareImage(BarcodeDimension dim,
int orientation,
int resolution,
int imageType)
Prepares a BufferedImage to paint to.
|
static void |
saveImage(BufferedImage image,
OutputStream out,
String mime,
int resolution)
Convenience method for save a bitmap to a file/OutputStream.
|
protected BitmapBuilder()
public static BufferedImage prepareImage(BarcodeDimension dim, int resolution, int imageType)
dim - the barcode dimensionsresolution - the desired image resolution (dots per inch)imageType - the desired image type (Values: BufferedImage.TYPE_*)public static BufferedImage prepareImage(BarcodeDimension dim, int orientation, int resolution, int imageType)
dim - the barcode dimensionsorientation - the barcode orientation (0, 90, 180, 270)resolution - the desired image resolution (dots per inch)imageType - the desired image type (Values: BufferedImage.TYPE_*)public static Graphics2D prepareGraphics2D(BufferedImage image, BarcodeDimension dim, int orientation, boolean antiAlias)
image - the BufferedImage instancedim - the barcode dimensionsorientation - the barcode orientation (0, 90, 180, 270)antiAlias - true enables anti-aliasingpublic static BufferedImage getImage(BarcodeGenerator bargen, String msg, int resolution)
bargen - the BarcodeGenerator to usemsg - the message to encoderesolution - the desired image resolution (dots per inch)public static void saveImage(BufferedImage image, OutputStream out, String mime, int resolution) throws IOException
image - image to saveout - OutputStream to write tomime - MIME type of the desired output format (ex. "image/png")resolution - the image resolution (dots per inch)IOException - In case of an I/O problemBitmapEncoderRegistrypublic static void outputBarcodeImage(BarcodeGenerator bargen, String msg, OutputStream out, String mime, int resolution) throws IOException
bargen - the BarcodeGenerator to usemsg - the message to encodeout - the OutputStream to write tomime - MIME type of the desired output format (ex. "image/png")resolution - the desired image resolution (dots per inch)IOException - In case of an I/O problemCopyright © 2003–2023. All rights reserved.