class QRCode@JvmOverloadsconstructor(val data: String, val squareSize: Int = DEFAULT_SQUARE_SIZE, val colorFn: QRCodeColorFunction = DefaultColorFunction(), val shapeFn: QRCodeShapeFunction = DefaultShapeFunction(squareSize, innerSpace = 0), var graphicsFactory: QRCodeGraphicsFactory = QRCodeGraphicsFactory(), doBefore: QRCode.(QRCodeGraphics, Int, Int) -> Unit = EMPTY_FN, doAfter: QRCode.(QRCodeGraphics, Int, Int) -> Unit = EMPTY_FN)
A simple class to create easily create aesthetic pleasing QRCodes.
It’ll create a QRCodeProcessor and build a custom render function on top of it.
It includes things like:
If you have a suggestion for a nice QR Code style, feel free to open a PR, or an Issue with your suggestion :)
Rafael Lins - g0dkar
QRCodeBuilder |
QRCode.Companion.ofSquares |
QRCode.Companion.ofCircles |
QRCode.Companion.ofRoundedSquares |
QRCode | [common] @JvmOverloads constructor(data: String, squareSize: Int = DEFAULT_SQUARE_SIZE, colorFn: QRCodeColorFunction = DefaultColorFunction(), shapeFn: QRCodeShapeFunction = DefaultShapeFunction(squareSize, innerSpace = 0), graphicsFactory: QRCodeGraphicsFactory = QRCodeGraphicsFactory(), doBefore: QRCode.(QRCodeGraphics, Int, Int) -> Unit = EMPTY_FN, doAfter: QRCode.(QRCodeGraphics, Int, Int) -> Unit = EMPTY_FN) |
Name | Summary |
---|---|
Companion | [common] object Companion |
Name | Summary |
---|---|
colorFn | [common] val colorFn: QRCodeColorFunction |
computedSize | [common] val computedSize: Int Calculated size of the whole QRCode (the final image will be a square of computedSize by computedSize ) |
data | [common] val data: String |
graphics | [common] val graphics: QRCodeGraphics The QRCodeGraphics (aka "canvas") where all the drawing will happen |
graphicsFactory | [common] var graphicsFactory: QRCodeGraphicsFactory |
qrCodeProcessor | [common] val qrCodeProcessor: QRCodeProcessor The underlying QRCodeProcessor object that’ll do all calculations |
rawData | [common] val rawData: Array<Array<QRCodeSquare>> Raw QRCode data computed by QRCodeProcessor |
shapeFn | [common] val shapeFn: QRCodeShapeFunction |
squareSize | [common] val squareSize: Int |
typeNum | [common] val typeNum: Int Computed type number for the given data parameter |
Name | Summary |
---|---|
render | [common] @JvmOverloads fun render(qrCodeGraphics: QRCodeGraphics = graphics, xOffset: Int = 0, yOffset: Int = 0): QRCodeGraphics Executes all the drawing of the QRCode and returns the QRCodeGraphics of the complete QRCode. |
renderToBytes | [common] @JvmOverloads fun renderToBytes(format: String = "PNG"): ByteArray Calls render and then returns the bytes of a format (default = PNG) render of the QRCode. |
reset | [common] fun reset() Completely resets the QRCode drawing. After this, you can call renderToBytes or render to redraw the whole QRCode. Useful when you want, for example, a transparent background QRCode to add to a larger image and then the same QRCode drawn on top of a custom background. |