本文整理汇总了Java中org.krysalis.barcode4j.BaselineAlignment类的典型用法代码示例。如果您正苦于以下问题:Java BaselineAlignment类的具体用法?Java BaselineAlignment怎么用?Java BaselineAlignment使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BaselineAlignment类属于org.krysalis.barcode4j包,在下文中一共展示了BaselineAlignment类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visitPostnet
import org.krysalis.barcode4j.BaselineAlignment; //导入依赖的package包/类
@Override
public void visitPostnet(POSTNETComponent postnet)
{
verifyBarcode(postnet);
verifyChecksumMode(postnet.getChecksumMode(), postnet);
if (postnet.getBaselinePosition() != null)
{
try
{
BaselineAlignment.byName(postnet.getBaselinePosition());
}
catch (Exception e)
{
verifier.addBrokenRule(e, postnet);
}
}
}
示例2: addBar
import org.krysalis.barcode4j.BaselineAlignment; //导入依赖的package包/类
/**
* @see org.krysalis.barcode4j.ClassicBarcodeLogicHandler#addBar(boolean, int)
*/
public void addBar(boolean black, int height) {
POSTNETBean pnBean = (POSTNETBean)bcBean;
final double w = black ? bcBean.getBarWidth(1) : bcBean.getBarWidth(-1);
final double h = bcBean.getBarHeight(height);
final BaselineAlignment baselinePosition = pnBean.getBaselinePosition();
if (black) {
if (bcBean.getMsgPosition() == HumanReadablePlacement.HRP_TOP) {
if (baselinePosition == BaselineAlignment.ALIGN_TOP) {
canvas.drawRectWH(x, y + bcBean.getHumanReadableHeight(), w, h);
} else if (baselinePosition == BaselineAlignment.ALIGN_BOTTOM) {
canvas.drawRectWH(x, y + bcBean.getHeight() - h, w, h);
}
} else {
if (baselinePosition == BaselineAlignment.ALIGN_TOP) {
canvas.drawRectWH(x, y, w, h);
} else if (baselinePosition == BaselineAlignment.ALIGN_BOTTOM) {
canvas.drawRectWH(x, y + bcBean.getBarHeight() - h, w, h);
}
}
}
x += w;
}
示例3: visitPostnet
import org.krysalis.barcode4j.BaselineAlignment; //导入依赖的package包/类
@Override
public void visitPostnet(POSTNETComponent postnet)
{
POSTNETBean postnetBean = new POSTNETBean();
barcodeBean = postnetBean;
evaluatePOSTNET(postnet);
setBaseAttributes(postnet);
if (postnet.getShortBarHeight() != null)
{
postnetBean.setShortBarHeight(
UnitConv.pt2mm(postnet.getShortBarHeight().doubleValue()));
}
if (postnet.getBaselinePosition() != null)
{
postnetBean.setBaselinePosition(
BaselineAlignment.byName(postnet.getBaselinePosition()));
}
if (postnet.getChecksumMode() != null)
{
postnetBean.setChecksumMode(
ChecksumMode.byName(postnet.getChecksumMode()));
}
if (postnet.getDisplayChecksum() != null)
{
postnetBean.setDisplayChecksum(
postnet.getDisplayChecksum().booleanValue());
}
if (postnet.getIntercharGapWidth() != null)
{
postnetBean.setIntercharGapWidth(
UnitConv.pt2mm(postnet.getIntercharGapWidth().doubleValue()));
}
evaluateBarcodeRenderable(postnet);
}
示例4: configure
import org.krysalis.barcode4j.BaselineAlignment; //导入依赖的package包/类
/** {@inheritDoc} */
public void configure(Configuration cfg) throws ConfigurationException {
//Module width (MUST ALWAYS BE FIRST BECAUSE QUIET ZONE MAY DEPEND ON IT)
Length mw = new Length(cfg.getChild("module-width").getValue(
POSTNETBean.DEFAULT_MODULE_WIDTH + Length.INCH), Length.MM);
getPOSTNETBean().setModuleWidth(mw.getValueAsMillimeter());
super.configure(cfg);
//Checksum mode
getPOSTNETBean().setChecksumMode(ChecksumMode.byName(
cfg.getChild("checksum").getValue(ChecksumMode.CP_AUTO.getName())));
//Inter-character gap width
Length igw = new Length(cfg.getChild("interchar-gap-width").getValue(
POSTNETBean.DEFAULT_MODULE_WIDTH + Length.INCH), Length.MM);
getPOSTNETBean().setIntercharGapWidth(igw.getValueAsMillimeter());
Length h = new Length(cfg.getChild("tall-bar-height").getValue(
POSTNETBean.DEFAULT_TALL_BAR_HEIGHT + Length.INCH), Length.MM);
getPOSTNETBean().setBarHeight(h.getValueAsMillimeter());
Length hbh = new Length(cfg.getChild("short-bar-height").getValue(
POSTNETBean.DEFAULT_SHORT_BAR_HEIGHT + Length.INCH), Length.MM);
getPOSTNETBean().setShortBarHeight(hbh.getValueAsMillimeter());
getPOSTNETBean().setBaselinePosition(BaselineAlignment.byName(
cfg.getChild("baseline-alignment").getValue(BaselineAlignment.ALIGN_BOTTOM.getName())));
Configuration hr = cfg.getChild("human-readable", false);
if (hr != null) {
//Display checksum in hr-message or not
getPOSTNETBean().setDisplayChecksum(
hr.getChild("display-checksum").getValueAsBoolean(false));
}
}
示例5: barcodeBaselinePosition
import org.krysalis.barcode4j.BaselineAlignment; //导入依赖的package包/类
public static BaselineAlignment barcodeBaselinePosition(BarcodeBaselinePosition baselinePosition) {
if (baselinePosition == null) {
return null;
}
switch (baselinePosition) {
case TOP:
return BaselineAlignment.ALIGN_TOP;
case BOTTOM:
return BaselineAlignment.ALIGN_BOTTOM;
default:
throw new JasperDesignException("BarcodeBaselinePosition " + baselinePosition.name() + " not supported");
}
}
示例6: getBaselinePosition
import org.krysalis.barcode4j.BaselineAlignment; //导入依赖的package包/类
/**
* Returns the baseline position. Indicates whether the bars are top-align or bottom-aligned.
* @return the baseline position
*/
public BaselineAlignment getBaselinePosition() {
return baselinePosition;
}
示例7: setBaselinePosition
import org.krysalis.barcode4j.BaselineAlignment; //导入依赖的package包/类
/**
* Sets the baseline position. Indicates whether the bars are top-align or bottom-aligned.
* @param baselinePosition the baseline position
*/
public void setBaselinePosition(BaselineAlignment baselinePosition) {
this.baselinePosition = baselinePosition;
}