From 688a156f52b734daaca2c565a6d7950f3c152a5a Mon Sep 17 00:00:00 2001 From: dankito Date: Sun, 13 Mar 2022 23:45:13 +0100 Subject: [PATCH] Removed unused QrCodeGenerator --- EpcQrCode/build.gradle.kts | 2 +- .../banking/epcqrcode/EncodeToQrCodeConfig.kt | 16 --------- .../banking/epcqrcode/QrCodeGenerator.kt | 34 ------------------- 3 files changed, 1 insertion(+), 51 deletions(-) delete mode 100644 EpcQrCode/src/commonMain/kotlin/net/codinux/banking/epcqrcode/EncodeToQrCodeConfig.kt delete mode 100644 EpcQrCode/src/jvmMain/kotlin/net/codinux/banking/epcqrcode/QrCodeGenerator.kt diff --git a/EpcQrCode/build.gradle.kts b/EpcQrCode/build.gradle.kts index b9f8133..676086a 100644 --- a/EpcQrCode/build.gradle.kts +++ b/EpcQrCode/build.gradle.kts @@ -65,7 +65,7 @@ kotlin { val jvmMain by getting { dependencies { - implementation("com.google.zxing:javase:3.4.1") + } } val jvmTest by getting { diff --git a/EpcQrCode/src/commonMain/kotlin/net/codinux/banking/epcqrcode/EncodeToQrCodeConfig.kt b/EpcQrCode/src/commonMain/kotlin/net/codinux/banking/epcqrcode/EncodeToQrCodeConfig.kt deleted file mode 100644 index 69b8599..0000000 --- a/EpcQrCode/src/commonMain/kotlin/net/codinux/banking/epcqrcode/EncodeToQrCodeConfig.kt +++ /dev/null @@ -1,16 +0,0 @@ -package net.codinux.banking.epcqrcode - - -open class EncodeToQrCodeConfig( - open val width: Int = DefaultWidth, - open val height: Int = DefaultHeight, - open val format: ImageFormat = ImageFormat.PNG, - open val encoding: EpcQrCodeCharacterSet = EpcQrCodeCharacterSet.UTF_8 -) { - - companion object { - const val DefaultWidth = 350 - const val DefaultHeight = 350 - } - -} \ No newline at end of file diff --git a/EpcQrCode/src/jvmMain/kotlin/net/codinux/banking/epcqrcode/QrCodeGenerator.kt b/EpcQrCode/src/jvmMain/kotlin/net/codinux/banking/epcqrcode/QrCodeGenerator.kt deleted file mode 100644 index c0cb8cb..0000000 --- a/EpcQrCode/src/jvmMain/kotlin/net/codinux/banking/epcqrcode/QrCodeGenerator.kt +++ /dev/null @@ -1,34 +0,0 @@ -package net.codinux.banking.epcqrcode - -import com.google.zxing.BarcodeFormat -import com.google.zxing.EncodeHintType -import com.google.zxing.client.j2se.MatrixToImageWriter -import com.google.zxing.qrcode.QRCodeWriter -import java.io.ByteArrayOutputStream - - -class QrCodeGenerator { - - fun generateQrCode(informationToEncode: String, config: EncodeToQrCodeConfig = EncodeToQrCodeConfig()): ByteArray { - val hints = mutableMapOf() - - hints[EncodeHintType.CHARACTER_SET] = map(config.encoding) - - val bitMatrix = QRCodeWriter().encode(informationToEncode, BarcodeFormat.QR_CODE, config.width, config.height, hints) - - val outputStream = ByteArrayOutputStream() - MatrixToImageWriter.writeToStream(bitMatrix, config.format.name, outputStream) - outputStream.flush() - - return outputStream.toByteArray() - } - - - private fun map(encoding: EpcQrCodeCharacterSet): String { - return when (encoding) { - EpcQrCodeCharacterSet.UTF_8 -> "UTF8" - else -> encoding.name.replace("ISO_8859", "ISO8859") - } - } - -} \ No newline at end of file