adjust QR code size and resolution

This commit is contained in:
woodser 2022-12-02 17:25:33 +00:00
parent dd0a307a84
commit 2dc5481101
4 changed files with 9 additions and 4 deletions

View file

@ -165,6 +165,8 @@ public class DepositView extends ActivatableView<VBox, Void> {
titledGroupBg.getStyleClass().add("last"); titledGroupBg.getStyleClass().add("last");
qrCodeImageView = new ImageView(); qrCodeImageView = new ImageView();
qrCodeImageView.setFitHeight(150);
qrCodeImageView.setFitWidth(150);
qrCodeImageView.getStyleClass().add("qr-code"); qrCodeImageView.getStyleClass().add("qr-code");
Tooltip.install(qrCodeImageView, new Tooltip(Res.get("shared.openLargeQRWindow"))); Tooltip.install(qrCodeImageView, new Tooltip(Res.get("shared.openLargeQRWindow")));
qrCodeImageView.setOnMouseClicked(e -> UserThread.runAfter( qrCodeImageView.setOnMouseClicked(e -> UserThread.runAfter(
@ -275,7 +277,7 @@ public class DepositView extends ActivatableView<VBox, Void> {
if (addressTextField.getAddress() != null && !addressTextField.getAddress().isEmpty()) { if (addressTextField.getAddress() != null && !addressTextField.getAddress().isEmpty()) {
final byte[] imageBytes = QRCode final byte[] imageBytes = QRCode
.from(getPaymentUri()) .from(getPaymentUri())
.withSize(150, 150) // code has 41 elements 8 px is border with 150 we get 3x scale and min. border .withSize(300, 300)
.to(ImageType.PNG) .to(ImageType.PNG)
.stream() .stream()
.toByteArray(); .toByteArray();

View file

@ -765,7 +765,7 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel<?>> exten
if (!newValue.toString().equals("")) { if (!newValue.toString().equals("")) {
final byte[] imageBytes = QRCode final byte[] imageBytes = QRCode
.from(getMoneroURI()) .from(getMoneroURI())
.withSize(98, 98) // code has 41 elements 8 px is border with 98 we get double scale and min. border .withSize(300, 300)
.to(ImageType.PNG) .to(ImageType.PNG)
.stream() .stream()
.toByteArray(); .toByteArray();

View file

@ -489,7 +489,7 @@ public class TakeOfferView extends ActivatableViewAndModel<AnchorPane, TakeOffer
final byte[] imageBytes = QRCode final byte[] imageBytes = QRCode
.from(getMoneroURI()) .from(getMoneroURI())
.withSize(98, 98) // code has 41 elements 8 px is border with 98 we get double scale and min. border .withSize(300, 300)
.to(ImageType.PNG) .to(ImageType.PNG)
.stream() .stream()
.toByteArray(); .toByteArray();

View file

@ -48,12 +48,15 @@ public class QRCodeWindow extends Overlay<QRCodeWindow> {
this.bitcoinURI = bitcoinURI; this.bitcoinURI = bitcoinURI;
final byte[] imageBytes = QRCode final byte[] imageBytes = QRCode
.from(bitcoinURI) .from(bitcoinURI)
.withSize(250, 250) .withSize(300, 300)
.to(ImageType.PNG) .to(ImageType.PNG)
.stream() .stream()
.toByteArray(); .toByteArray();
Image qrImage = new Image(new ByteArrayInputStream(imageBytes)); Image qrImage = new Image(new ByteArrayInputStream(imageBytes));
qrCodeImageView = new ImageView(qrImage); qrCodeImageView = new ImageView(qrImage);
qrCodeImageView.setFitHeight(250);
qrCodeImageView.setFitWidth(250);
qrCodeImageView.getStyleClass().add("qr-code");
type = Type.Information; type = Type.Information;
width = 468; width = 468;