public void render ( QrCode qr ) { initialize ( qr ) ; render . init ( ) ; positionPattern ( 0 , 0 , qr . ppCorner ) ; positionPattern ( ( numModules - 7 ) * moduleWidth , 0 , qr . ppRight ) ; positionPattern ( 0 , ( numModules - 7 ) * moduleWidth , qr . ppDown ) ; timingPattern ( 7 * moduleWidth , 6 * moduleWidth , moduleWidth , 0 ) ; timingPattern ( 6 * moduleWidth , 7 * moduleWidth , 0 , moduleWidth ) ; formatInformation ( ) ; if ( qr . version >= QrCode . VERSION_ENCODED_AT ) versionInformation ( ) ; // render alignment patterns int alignment [ ] = QrCode . VERSION_INFO [ qr . version ] . alignment ; for ( int i = 0 ; i < alignment . length ; i ++ ) { int row = alignment [ i ] ; for ( int j = 0 ; j < alignment . length ; j ++ ) { if ( i == 0 & j == 0 ) continue ; if ( i == alignment . length - 1 & j == 0 ) continue ; if ( i == 0 & j == alignment . length - 1 ) continue ; int col = alignment [ j ] ; alignmentPattern ( col , row ) ; } } if ( renderData ) { if ( qr . rawbits . length != QrCode . VERSION_INFO [ qr . version ] . codewords ) throw new RuntimeException ( "Unexpected length of raw data." ) ; // mark which modules can store data bitLocations = new QrCodeCodeWordLocations ( qr . version ) . bits ; int numBytes = bitLocations . size ( ) / 8 ; if ( numBytes != qr . rawbits . length ) throw new RuntimeException ( "Egads. unexpected length of qrcode raw data" ) ; // Render the output data renderData ( ) ; } qr . bounds . set ( 0 , 0 , 0 ) ; qr . bounds . set ( 1 , markerWidth , 0 ) ; qr . bounds . set ( 2 , markerWidth , markerWidth ) ; qr . bounds . set ( 3 , 0 , markerWidth ) ; }
Generates a QR Code with the specified message . An exception is thrown if the message is too long to be encoded .