Examples of BitMatrix


Examples of com.google.zxing.common.BitMatrix

        // set values
        final String type = this.params.getType().toString();
       
        // create code image 
        final BitMatrix matrix = writer.encode(
                payload,
                this.params.getFormat(),
                this.params.getWidth(),
                this.params.getHeight(),
                writerHintMap);
View Full Code Here

Examples of com.google.zxing.common.BitMatrix

    this.height = height;
  }

  public BufferedImage encode(String data) {
    // get a byte matrix for the data
    BitMatrix matrix;
    com.google.zxing.Writer writer = new QRCodeWriter();
    try {
      matrix = writer.encode(data, com.google.zxing.BarcodeFormat.QR_CODE, width, height);
    } catch (com.google.zxing.WriterException e) {
      // exit the method
      return null;
    }

    // generate an image from the byte matrix
    int width = matrix.getWidth();
    int height = matrix.getHeight();

    // create buffered image to draw to
    BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);

    // iterate through the matrix and draw the pixels to the image
    for (int y = 0; y < height; y++) {
      for (int x = 0; x < width; x++) {
        boolean imageValue = matrix.get(x, y);
        image.setRGB(x, y, (imageValue ? 0 : 0xFFFFFF));
      }
    }

    // //write the image to the output stream
View Full Code Here

Examples of com.google.zxing.common.BitMatrix

        // set values
        final String type = this.params.getType().toString();
       
        // create code image 
        final BitMatrix matrix = writer.encode(
                payload,
                this.params.getFormat(),
                this.params.getWidth(),
                this.params.getHeight(),
                writerHintMap);
View Full Code Here

Examples of com.google.zxing.common.BitMatrix

            size = SpaydConstants.minQRSize;
        } else if (size > SpaydConstants.maxQRSize) {
            size = SpaydConstants.maxQRSize;
        }

        BitMatrix matrix = null;
        int h = size;
        int w = size;
        int barsize = -1;
        Writer writer = new MultiFormatWriter();
        try {
View Full Code Here

Examples of com.google.zxing.common.BitMatrix

            Hashtable<EncodeHintType, ErrorCorrectionLevel> hintMap = new Hashtable<EncodeHintType, ErrorCorrectionLevel>();

            hintMap.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.L);

            QRCodeWriter writer = new QRCodeWriter();
            BitMatrix matrix = writer.encode(data, BarcodeFormat.QR_CODE, size, size, hintMap);
            BufferedImage image = new BufferedImage(size, size, BufferedImage.TYPE_INT_RGB);

            image.createGraphics();

            Graphics2D graphics = (Graphics2D) image.getGraphics();

            graphics.setColor(Color.WHITE);
            graphics.fillRect(0, 0, size, size);
            graphics.setColor(Color.BLACK);

            for (int i = 0; i < size; ++ i) {
                for (int j = 0; j < size; ++ j) {
                    if (matrix.get(i, j)) {
                        graphics.fillRect(i, j, 1, 1);
                    }
                }
            }
View Full Code Here

Examples of com.google.zxing.common.BitMatrix

        if (width > 1000 || height > 1000 || contents.length() > 1000) {
            return Response.status(Response.Status.BAD_REQUEST).build();
        }

        QRCodeWriter writer = new QRCodeWriter();
        final BitMatrix bitMatrix = writer.encode(contents, BarcodeFormat.QR_CODE, width, height);

        StreamingOutput stream = new StreamingOutput() {
            @Override
            public void write(OutputStream os) throws IOException,
                    WebApplicationException {
View Full Code Here

Examples of umontreal.iro.lecuyer.util.BitMatrix

      //computes the state transition matrices

      System.out.println("Creating the WELL512 state transition matrices.");

      //the state transition matrices
      BitMatrix STp0, STpw, STpz;

      BitVector[] bv = new BitVector[512];
      WELL512 well;
      int[] vect = new int[R];

      for(int i = 0; i < 512; i++) {
         well = new WELL512(i);

         well.nextValue();
         for(int j = 0; j < R; j++)
            vect[j] = well.state[(well.state_i + j) & MASK];

         bv[i] = new BitVector(vect, 512);
      }

      STp0 = (new BitMatrix(bv)).transpose();

      STpw = STp0.power2e(200);
      STpz = STpw.power2e(150);


      try {
         FileOutputStream fos = new FileOutputStream(args[0]);
View Full Code Here

Examples of umontreal.iro.lecuyer.util.BitMatrix

      //computes the state transition matrices

      System.out.println("Creating the GenF2w32 state transition matrices.");

      //the state transition matrices
      BitMatrix STp0, STpw, STpz;

      BitVector[] bv = new BitVector[800];
      GenF2w32 gen;
      int[] vect = new int[R];

      for(int i = 0; i < 800; i++) {
         gen = new GenF2w32(i);

         gen.nextValue();
         for(int j = 0; j < R; j++)
            vect[j] = gen.state[(j + R - 1) % R];

         bv[i] = new BitVector(vect, 800);
      }

      STp0 = (new BitMatrix(bv)).transpose();

      STpw = STp0.power2e(w);
      STpz = STpw.power2e(v);


      try {
         FileOutputStream fos = new FileOutputStream(args[0]);
View Full Code Here

Examples of umontreal.iro.lecuyer.util.BitMatrix

      System.out.println("Creating the WELL1024 state " +
                         "transition matrices.");

      //the state transition matrices
      BitMatrix STp0, STpw, STpz;

      BitVector[] bv = new BitVector[1024];
      WELL1024 well;
      int[] vect = new int[R];

      for(int i = 0; i < 1024; i++) {
         well = new WELL1024(i);

         well.nextValue();
         for(int j = 0; j < R; j++)
            vect[j] = well.state[(well.state_i + j) & MASK];

         bv[i] = new BitVector(vect, 1024);
      }

      STp0 = (new BitMatrix(bv)).transpose();

      STpw = STp0.power2e(400);
      STpz = STpw.power2e(300);


      try {
         FileOutputStream fos = new FileOutputStream(args[0]);
View Full Code Here

Examples of umontreal.iro.lecuyer.util.BitMatrix

      //computes the state transition matrices
      System.out.println("Creating the WELL607 state transition matrices.");

      //the state transition matrices
      BitMatrix STp0, STpw, STpz;

      BitVector[] bv = new BitVector[NUM_BITS];

      int[] state = new int[BUFFER_SIZE];
      int[] vect = new int[R];

      int z0, z1, z2;

      for(int i = 0; i < NUM_BITS; i++) {
         //state is a unit vector
         for(int j = 0; j < BUFFER_SIZE; j++)
            state[j] = 0;
         state[i / W] = 1 << (i % W);


         //advance one state of the recurrence (state_i = 0)
         z0 = (state[R1] & MASKL) | (state[R2] & MASKU);
         z1 = (state[0]^(state[0]>>>19)) ^ (state[M1]^(state[M1]>>>11));
         z2 = (state[M2]^(state[M2]<<(14))) ^ state[M3];
         state[0]      = z1 ^ z2;
         state[BUFFER_SIZE - 1] = (z0^(z0>>>18)) ^
                                  z1 ^ (state[0]^(state[0]<<5));


         //put the state vector in vect (state_i = -1)
         for(int j = 0; j < R; j++)
            vect[j] = state[(j - 1) & MASK_STATE];

         bv[i] = new BitVector(vect, NUM_BITS);
      }

      STp0 = (new BitMatrix(bv)).transpose();

      STpw = STp0.power2e(w);
      STpz = STpw.power2e(v);

      try {
         FileOutputStream fos = new FileOutputStream(args[0]);
         ObjectOutputStream oos = new ObjectOutputStream(fos);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.