• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ImageType类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中net.glxn.qrgen.core.image.ImageType的典型用法代码示例。如果您正苦于以下问题:Java ImageType类的具体用法?Java ImageType怎么用?Java ImageType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ImageType类属于net.glxn.qrgen.core.image包,在下文中一共展示了ImageType类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: generateQrCode

import net.glxn.qrgen.core.image.ImageType; //导入依赖的package包/类
public void generateQrCode() {
    if (mResourceLocation != null) {
        return;
    }

    BufferedImage bufferedImage = null;
    File imageFile = QRCode.from(mIpAddress).to(ImageType.PNG).withSize(256, 256).file();

    try {
        bufferedImage = ImageIO.read(imageFile);
    } catch (IOException e) {
        e.printStackTrace();
    }

    mResourceLocation = Minecraft.getMinecraft().renderEngine.getDynamicTextureLocation(imageFile.getName(), new DynamicTexture(bufferedImage));
}
 
开发者ID:RemotecraftProject,项目名称:RemotecraftMod,代码行数:17,代码来源:QrCodeManager.java


示例2: makeQRs

import net.glxn.qrgen.core.image.ImageType; //导入依赖的package包/类
private QrHolder[] makeQRs(Device[] devices, int dashId, boolean onlyFirst) throws Exception {
    QrHolder[] qrHolders;
    if (onlyFirst) {
        qrHolders = new QrHolder[1];
    } else {
        qrHolders = new QrHolder[devices.length];
    }

    List<FlashedToken> flashedTokens = getAllTokens();

    int i = 0;
    for (Device device : devices) {
        if (onlyFirst && i > 0) {
            break;
        }
        String newToken = flashedTokens.get(i).token;
        qrHolders[i] = new QrHolder(dashId, device.id, device.name, newToken, QRCode.from(newToken).to(ImageType.JPG).stream().toByteArray());
        i++;
    }

    return qrHolders;
}
 
开发者ID:blynkkk,项目名称:blynk-server,代码行数:23,代码来源:PublishingPreviewFlow.java


示例3: getQR

import net.glxn.qrgen.core.image.ImageType; //导入依赖的package包/类
@GET
@Path("{token}/qr")
@Metric(HTTP_QR)
public Response getQR(@PathParam("token") String token) {
    TokenValue tokenValue = tokenManager.getTokenValueByToken(token);

    if (tokenValue == null) {
        log.debug("Requested token {} not found.", token);
        return badRequest("Invalid token.");
    }

    DashBoard dashBoard = tokenValue.dash;

    try {
        byte[] compressed = JsonParser.gzipDashRestrictive(dashBoard);
        String qrData = "bp1" + Base64.getEncoder().encodeToString(compressed);
        byte[] qrDataBinary = QRCode.from(qrData).to(ImageType.PNG).withSize(500, 500).stream().toByteArray();
        return ok(qrDataBinary, "image/png");
    } catch (Throwable e) {
        log.error("Error generating QR. Reason : {}", e.getMessage());
        return badRequest("Error generating QR.");
    }
}
 
开发者ID:blynkkk,项目名称:blynk-server,代码行数:24,代码来源:HttpAPILogic.java


示例4: makeQRs

import net.glxn.qrgen.core.image.ImageType; //导入依赖的package包/类
private QrHolder[] makeQRs(String username, String appId, DashBoard dash, boolean onlyFirst) throws Exception {
    int tokensCount = onlyFirst ? 1 : dash.devices.length;
    QrHolder[] qrHolders = new QrHolder[tokensCount];
    FlashedToken[] flashedTokens = new FlashedToken[tokensCount];

    int i = 0;
    for (Device device : dash.devices) {
        String newToken = TokenGeneratorUtil.generateNewToken();
        qrHolders[i] = new QrHolder(dash.id, device.id, device.name, newToken,
                QRCode.from(newToken).to(ImageType.JPG).stream().toByteArray());
        flashedTokens[i] = new FlashedToken(username, newToken, appId, dash.id, device.id);
        if (onlyFirst) {
            break;
        }
        i++;
    }

    if (!dbManager.insertFlashedTokens(flashedTokens)) {
        throw new Exception("App Publishing Preview requires enabled DB.");
    }

    return qrHolders;
}
 
开发者ID:blynkkk,项目名称:blynk-server,代码行数:24,代码来源:MailQRsLogic.java


示例5: main

import net.glxn.qrgen.core.image.ImageType; //导入依赖的package包/类
public static void main(String[] args) throws IOException {

		String build = new QRSCT()
				.serviceTag(QRSCTServiceTagEnum.DEFAULT)
				.version(QRSCTVersionEnum.DEFAULT)
				.characterSet(QRSCTCharacterSetEnum.DEFAULT)
				.bic("BHBLDEHHXXX") //$NON-NLS-1$
				.name("Franz Mustermaennchen") //$NON-NLS-1$
				.iban("DE71110220330123456789123456789876") //$NON-NLS-1$
				.amount(CurrencyCode.EUR, 999999999.11)
				.purpose(QRSCTPurposeEnum.DEFAULT)
				.reference("egon 123 test : dankeschoen").hint("kein Hinweis") //$NON-NLS-1$ //$NON-NLS-2$
				.build();

		FileOutputStream fileOutputStream = new FileOutputStream(new File(
				"C:/Temp/test.png"));
		QRCode.from(build).to(ImageType.PNG).withCharset("UTF-8") //$NON-NLS-1$
				.withErrorCorrection(ErrorCorrectionLevel.M)
				.writeTo(fileOutputStream); //$NON-NLS-1$
		fileOutputStream.close();
	}
 
开发者ID:deltatree,项目名称:qrsct,代码行数:22,代码来源:Example.java


示例6: create

import net.glxn.qrgen.core.image.ImageType; //导入依赖的package包/类
public OutputEvent create(InputEvent event) throws MalformedURLException, UnsupportedEncodingException {
    ImageType type = getFormat(event.getQueryParameters().get("format").orElse(defaultFormat));
    System.err.println("Default format: " + type.toString());
    String contents = event.getQueryParameters().get("contents").orElseThrow(() -> new RuntimeException("Contents must be provided to the QR code"));

    ByteArrayOutputStream stream = QRCode.from(contents).to(type).stream();
    System.err.println("Generated QR Code for contents: " + contents);

    return OutputEvent.fromBytes(stream.toByteArray(), OutputEvent.SUCCESS, getMimeType(type));
}
 
开发者ID:fnproject,项目名称:fdk-java,代码行数:11,代码来源:QRGen.java


示例7: getFormat

import net.glxn.qrgen.core.image.ImageType; //导入依赖的package包/类
private ImageType getFormat(String extension) {
    switch(extension.toLowerCase()) {
        case "png":
            return ImageType.PNG;
        case "jpg":
        case "jpeg":
            return ImageType.JPG;
        case "gif":
            return ImageType.GIF;
        case "bmp":
            return ImageType.BMP;
        default:
            throw new RuntimeException(String.format("Cannot use the specified format %s, must be one of png, jpg, gif, bmp", extension));
    }
}
 
开发者ID:fnproject,项目名称:fdk-java,代码行数:16,代码来源:QRGen.java


示例8: getMimeType

import net.glxn.qrgen.core.image.ImageType; //导入依赖的package包/类
private String getMimeType(ImageType type) {
     switch(type) {
         case JPG:
             return "image/jpeg";
         case GIF:
             return "image/gif";
         case PNG:
             return "image/png";
         case BMP:
             return "image/bmp";
         default:
             throw new RuntimeException("Invalid ImageType: " + type);
     }
}
 
开发者ID:fnproject,项目名称:fdk-java,代码行数:15,代码来源:QRGen.java


示例9: test

import net.glxn.qrgen.core.image.ImageType; //导入依赖的package包/类
@Test
public void test() {
    try {
        FileOutputStream fos = new FileOutputStream(new File("D:\\code.png"));
        QRCode.from("weixin://wxpay/bizpayurl?pr=WGFHCgc").to(ImageType.PNG).withSize(500, 500).writeTo(fos);
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    }
}
 
开发者ID:laohans,项目名称:swallow-core,代码行数:10,代码来源:QRCodeTest.java


示例10: qrCodeAsPng

import net.glxn.qrgen.core.image.ImageType; //导入依赖的package包/类
private byte[] qrCodeAsPng(final String baseUrl, final String nickname, final String suffix) {
    final ByteArrayOutputStream baos = new ByteArrayOutputStream();
    QRCode.from(baseUrl + "/devices/" + nickname + suffix).withSize(500, 500).to(ImageType.PNG).writeTo(baos);
    final byte[] imageData = baos.toByteArray();
    return imageData;
}
 
开发者ID:PaperCutSoftware,项目名称:dust-api,代码行数:7,代码来源:DeviceResource.java


示例11: createQrGen

import net.glxn.qrgen.core.image.ImageType; //导入依赖的package包/类
public static ByteArrayOutputStream createQrGen(String url) throws IOException {

        //如果有中文,可以使用withCharset("UTF-8")方法
        return QRCode.from(url).withSize(270,270).to(ImageType.JPG).stream();
    }
 
开发者ID:SnackMen,项目名称:DanmuChat,代码行数:6,代码来源:QrGenUtil.java


示例12: generateQR

import net.glxn.qrgen.core.image.ImageType; //导入依赖的package包/类
private static void generateQR(String text, Path outputFile) throws Exception {
    try (OutputStream out = Files.newOutputStream(outputFile)) {
        QRCode.from(text).to(ImageType.JPG).writeTo(out);
    }
}
 
开发者ID:blynkkk,项目名称:blynk-server,代码行数:6,代码来源:FlahsedTokenGenerator.java


示例13: sendMailForStaticProvisioning

import net.glxn.qrgen.core.image.ImageType; //导入依赖的package包/类
@Test
@Ignore
public void sendMailForStaticProvisioning() throws Exception {
    String body =
            "Hi there,<br>\n" +
                    "<br>\n" +
                    "Nice app you made with Blynk!<br>\n" +
                    "<br>\n" +
                    "Here is what's next:\n" +
                    "\n" +
                    "<ul>\n" +
                    "    <li>For Static Provisioning you need to upload Auth Tokens provided in this email to your devices. Tokens are in the attachment.</li>\n" +
                    "\n" +
                    "    <li>During the provisioning process, device will be connected to your network. You need to scan provided QRs in order to connect your app to devices. Learn <a href=\"http://help.blynk.cc/publishing-apps-made-with-blynk/1240196-provisioning-products-with-auth-tokens/static-auth-token-provisioning\">how Static Device Provisioning works</a>.</li>\n" +
                    "</ul>\n" +
                    "\n" +
                    "<b>If you would like to publish your app to App Store and Google Play, check out our <a href=\"https://www.blynk.io/plans/\">plans</a> and send a request.</b><br>\n" +
                    "<br>\n" +
                    "Let’s build a connected world together!<br>\n" +
                    "<br>\n" +
                    "--<br>\n" +
                    "<br>\n" +
                    "Blynk Team<br>\n" +
                    "<br>\n" +
                    "<a href=\"https://www.blynk.io\">blynk.io</a>\n" +
                    "<br>\n" +
                    "<a href=\"https://www.blynk.cc\">blynk.cc</a>";
    QrHolder[] qrHolders = new QrHolder[] {
            new QrHolder(1, 0, "My device", "12345678901", QRCode.from("21321321").to(ImageType.JPG).stream().toByteArray()),
            new QrHolder(1, 1, "My device2", "12345678902", QRCode.from("21321321").to(ImageType.JPG).stream().toByteArray())
    };

    Properties properties = new Properties();
    try (InputStream classPath = MailWrapperTest.class.getResourceAsStream("/mail.properties")) {
        if (classPath != null) {
            properties.load(classPath);
        }
    }

    MailWrapper mailWrapper = new MailWrapper(properties);
    mailWrapper.sendWithAttachment("[email protected]", "yo", body, qrHolders);
}
 
开发者ID:blynkkk,项目名称:blynk-server,代码行数:43,代码来源:MailWrapperTest.java



注:本文中的net.glxn.qrgen.core.image.ImageType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java IIntentReceiver类代码示例发布时间:2022-05-23
下一篇:
Java WXImageObject类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap