Java Code Examples for com.google.zxing.Dimension#getWidth()

The following examples show how to use com.google.zxing.Dimension#getWidth() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SymbolInfo.java    From ZXing-Orient with Apache License 2.0 5 votes vote down vote up
public static SymbolInfo lookup(int dataCodewords,
                                SymbolShapeHint shape, 
                                Dimension minSize, 
                                Dimension maxSize, 
                                boolean fail) {
  for (SymbolInfo symbol : symbols) {
    if (shape == SymbolShapeHint.FORCE_SQUARE && symbol.rectangular) {
      continue;
    }
    if (shape == SymbolShapeHint.FORCE_RECTANGLE && !symbol.rectangular) {
      continue;
    }
    if (minSize != null
        && (symbol.getSymbolWidth() < minSize.getWidth()
        || symbol.getSymbolHeight() < minSize.getHeight())) {
      continue;
    }
    if (maxSize != null
        && (symbol.getSymbolWidth() > maxSize.getWidth()
        || symbol.getSymbolHeight() > maxSize.getHeight())) {
      continue;
    }
    if (dataCodewords <= symbol.dataCapacity) {
      return symbol;
    }
  }
  if (fail) {
    throw new IllegalArgumentException(
        "Can't find a symbol arrangement that matches the message. Data codewords: "
            + dataCodewords);
  }
  return null;
}
 
Example 2
Source File: SymbolInfo.java    From analyzer-of-android-for-Apache-Weex with Apache License 2.0 5 votes vote down vote up
public static SymbolInfo lookup(int dataCodewords,
                                SymbolShapeHint shape, 
                                Dimension minSize, 
                                Dimension maxSize, 
                                boolean fail) {
  for (SymbolInfo symbol : symbols) {
    if (shape == SymbolShapeHint.FORCE_SQUARE && symbol.rectangular) {
      continue;
    }
    if (shape == SymbolShapeHint.FORCE_RECTANGLE && !symbol.rectangular) {
      continue;
    }
    if (minSize != null
        && (symbol.getSymbolWidth() < minSize.getWidth()
        || symbol.getSymbolHeight() < minSize.getHeight())) {
      continue;
    }
    if (maxSize != null
        && (symbol.getSymbolWidth() > maxSize.getWidth()
        || symbol.getSymbolHeight() > maxSize.getHeight())) {
      continue;
    }
    if (dataCodewords <= symbol.dataCapacity) {
      return symbol;
    }
  }
  if (fail) {
    throw new IllegalArgumentException(
        "Can't find a symbol arrangement that matches the message. Data codewords: "
            + dataCodewords);
  }
  return null;
}
 
Example 3
Source File: SymbolInfo.java    From weex with Apache License 2.0 5 votes vote down vote up
public static SymbolInfo lookup(int dataCodewords,
                                SymbolShapeHint shape, 
                                Dimension minSize, 
                                Dimension maxSize, 
                                boolean fail) {
  for (SymbolInfo symbol : symbols) {
    if (shape == SymbolShapeHint.FORCE_SQUARE && symbol.rectangular) {
      continue;
    }
    if (shape == SymbolShapeHint.FORCE_RECTANGLE && !symbol.rectangular) {
      continue;
    }
    if (minSize != null
        && (symbol.getSymbolWidth() < minSize.getWidth()
        || symbol.getSymbolHeight() < minSize.getHeight())) {
      continue;
    }
    if (maxSize != null
        && (symbol.getSymbolWidth() > maxSize.getWidth()
        || symbol.getSymbolHeight() > maxSize.getHeight())) {
      continue;
    }
    if (dataCodewords <= symbol.dataCapacity) {
      return symbol;
    }
  }
  if (fail) {
    throw new IllegalArgumentException(
        "Can't find a symbol arrangement that matches the message. Data codewords: "
            + dataCodewords);
  }
  return null;
}
 
Example 4
Source File: SymbolInfo.java    From barcodescanner-lib-aar with MIT License 5 votes vote down vote up
public static SymbolInfo lookup(int dataCodewords,
                                SymbolShapeHint shape, 
                                Dimension minSize, 
                                Dimension maxSize, 
                                boolean fail) {
  for (SymbolInfo symbol : symbols) {
    if (shape == SymbolShapeHint.FORCE_SQUARE && symbol.rectangular) {
      continue;
    }
    if (shape == SymbolShapeHint.FORCE_RECTANGLE && !symbol.rectangular) {
      continue;
    }
    if (minSize != null
        && (symbol.getSymbolWidth() < minSize.getWidth()
        || symbol.getSymbolHeight() < minSize.getHeight())) {
      continue;
    }
    if (maxSize != null
        && (symbol.getSymbolWidth() > maxSize.getWidth()
        || symbol.getSymbolHeight() > maxSize.getHeight())) {
      continue;
    }
    if (dataCodewords <= symbol.dataCapacity) {
      return symbol;
    }
  }
  if (fail) {
    throw new IllegalArgumentException(
        "Can't find a symbol arrangement that matches the message. Data codewords: "
            + dataCodewords);
  }
  return null;
}
 
Example 5
Source File: SymbolInfo.java    From RipplePower with Apache License 2.0 5 votes vote down vote up
public static SymbolInfo lookup(int dataCodewords, SymbolShapeHint shape, Dimension minSize, Dimension maxSize,
		boolean fail) {
	for (SymbolInfo symbol : symbols) {
		if (shape == SymbolShapeHint.FORCE_SQUARE && symbol.rectangular) {
			continue;
		}
		if (shape == SymbolShapeHint.FORCE_RECTANGLE && !symbol.rectangular) {
			continue;
		}
		if (minSize != null && (symbol.getSymbolWidth() < minSize.getWidth()
				|| symbol.getSymbolHeight() < minSize.getHeight())) {
			continue;
		}
		if (maxSize != null && (symbol.getSymbolWidth() > maxSize.getWidth()
				|| symbol.getSymbolHeight() > maxSize.getHeight())) {
			continue;
		}
		if (dataCodewords <= symbol.dataCapacity) {
			return symbol;
		}
	}
	if (fail) {
		throw new IllegalArgumentException(
				"Can't find a symbol arrangement that matches the message. Data codewords: " + dataCodewords);
	}
	return null;
}