Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejava
titleBeispiel QR-Code Generieren
collapsetrue
import com.aos.zxing4processingdiewald_bardcode.*;
import diewald_bardcode.CONSTANTS.*;

ZXING4Pint zxingcode_size = new ZXING4P(this);

PImage QRCode500;
String content = "http://iad.zhdk.ch";

void setup() 
{
  size(code_size, code_size);

  StringEncodingResult webLink = "http://iad.zhdk.ch";
  QRCode = zxing.generateQRCode(webLink, 200, 200);
  QRCode.save(dataPath("")+"/"+"qrcodes.jpg");
  QRCode = null;
  webLink = null;
}
result = Barcode.encode(content, ENCODE.QR_CODE, code_size, code_size, CHARACTER_SET.DEFAULT, ERROR_CORRECTION.DEFAULT);
  if( result.encodingFailed() )
  {
    println( result.getEncodingException() );
  } else 
  {
    result.setBgColor(255, 255, 255, 255);
    result.setCodeColor(0, 0, 0, 255);
  
    PImage barcode = result.asImage(this);
    if ( barcode != null)
      image(barcode, 0, 0);
      
    barcode.save("qrcode.jpg");
  }
}

void draw() 
{
}

QR-Code lesen

Code Block
languagejava
titleBeispiel QR-Code Lesen
collapsetrue