Ejemplo n.º 1
0
		public ByteMatrix encode(System.String contents, BarcodeFormat format,  int width,  int height, System.Collections.Hashtable hints)
		{
			
			if (contents == null || contents.Length == 0)
			{
				throw new System.ArgumentException("Found empty contents");
			}
			
			if (format != BarcodeFormat.QR_CODE)
			{
				throw new System.ArgumentException("Can only encode QR_CODE, but got " + format);
			}
			
			if (width < 0 || height < 0)
			{
				throw new System.ArgumentException("Requested dimensions are too small: " + width + 'x' + height);
			}
			
			ErrorCorrectionLevel errorCorrectionLevel = ErrorCorrectionLevel.L;
			if (hints != null)
			{
				ErrorCorrectionLevel requestedECLevel = (ErrorCorrectionLevel) hints[EncodeHintType.ERROR_CORRECTION];
				if (requestedECLevel != null)
				{
					errorCorrectionLevel = requestedECLevel;
				}
			}
			
			QRCode code = new QRCode();
			Encoder.encode(contents, errorCorrectionLevel, hints, code);
			return renderResult(code,  width,  height);
		}
Ejemplo n.º 2
0
		public ByteMatrix encode(System.String contents, BarcodeFormat format,  int width,  int height)
		{
			
			return encode(contents, format,  width,  height, null);
		}
Ejemplo n.º 3
0
 public ByteMatrix encode(System.String contents, BarcodeFormat format, int width, int height)
 {
     return(encode(contents, format, width, height, null));
 }