本文整理汇总了Java中org.krysalis.barcode4j.HumanReadablePlacement.HRP_TOP属性的典型用法代码示例。如果您正苦于以下问题:Java HumanReadablePlacement.HRP_TOP属性的具体用法?Java HumanReadablePlacement.HRP_TOP怎么用?Java HumanReadablePlacement.HRP_TOP使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.krysalis.barcode4j.HumanReadablePlacement
的用法示例。
在下文中一共展示了HumanReadablePlacement.HRP_TOP属性的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: startBarcode
/** {@inheritDoc} */
public void startBarcode(String msg, String formattedMsg) {
super.startBarcode(msg, formattedMsg);
ITF14Bean bean = getITF14Bean();
double bbw = bean.getBearerBarWidth();
double w = dimensions.getWidthPlusQuiet();
double h = bean.getBarHeight();
double top = 0;
if (bcBean.getMsgPosition() == HumanReadablePlacement.HRP_TOP) {
top += bcBean.getHumanReadableHeight();
}
canvas.drawRect(0, top, w, top + bbw);
canvas.drawRect(0, top + bbw + h, w, top + bbw + h + bbw);
if (bean.isBearerBox()) {
canvas.drawRect(0, top + bbw, bbw, top + bbw + h);
canvas.drawRect(w - bbw, top + bbw, w, top + bbw + h);
}
//canvas.drawRect(getStartX(), 2 * bbw, getStartX() + dimensions.getWidth(), 3 * bbw);
}
示例2: drawLeadChar
private void drawLeadChar(String lead) {
final double leadw = 7 * bcBean.getBarWidth(1);
final double leadx = getStartX()
- 3 * bcBean.getBarWidth(1)
- leadw;
if (bcBean.getMsgPosition() == HumanReadablePlacement.HRP_NONE) {
//nop
} else if (bcBean.getMsgPosition() == HumanReadablePlacement.HRP_TOP) {
DrawingUtil.drawText(canvas, bcBean,
lead, leadx, leadx + leadw,
bcBean.getHumanReadableHeight(), TextAlignment.TA_CENTER);
} else if (bcBean.getMsgPosition() == HumanReadablePlacement.HRP_BOTTOM) {
DrawingUtil.drawText(canvas, bcBean,
lead, leadx, leadx + leadw,
bcBean.getHeight(), TextAlignment.TA_CENTER);
}
}
示例3: drawTrailingChar
private void drawTrailingChar(String trailer) {
final double trailerw = 7 * bcBean.getBarWidth(1);
final double trailerx = getStartX()
+ this.dim.getWidth()
- bcBean.supplementalWidth(this.msg)
+ 3 * bcBean.getBarWidth(1);
if (bcBean.getMsgPosition() == HumanReadablePlacement.HRP_NONE) {
//nop
} else if (bcBean.getMsgPosition() == HumanReadablePlacement.HRP_TOP) {
DrawingUtil.drawText(canvas, bcBean,
trailer, trailerx, trailerx + trailerw,
bcBean.getHumanReadableHeight(), TextAlignment.TA_CENTER);
} else if (bcBean.getMsgPosition() == HumanReadablePlacement.HRP_BOTTOM) {
DrawingUtil.drawText(canvas, bcBean,
trailer, trailerx, trailerx + trailerw,
bcBean.getHeight(), TextAlignment.TA_CENTER);
}
}
示例4: addBar
/**
* @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;
}
示例5: barcodeTextPosition
public static HumanReadablePlacement barcodeTextPosition(BarcodeTextPosition textPosition) {
if (textPosition == null) {
return null;
}
switch (textPosition) {
case NONE:
return HumanReadablePlacement.HRP_NONE;
case BOTTOM:
return HumanReadablePlacement.HRP_BOTTOM;
case TOP:
return HumanReadablePlacement.HRP_TOP;
default:
throw new JasperDesignException("BarcodeTextPosition " + textPosition.name() + " not supported");
}
}
示例6: getStartY
private double getStartY() {
double y = 0.0;
if (bcBean.hasQuietZone()) {
y += bcBean.getVerticalQuietZone();
}
if (bcBean.getMsgPosition() == HumanReadablePlacement.HRP_TOP) {
y += bcBean.getHumanReadableHeight();
}
return y;
}
示例7: getStartY
/**
* Returns the start Y position of the bars.
* @return the start Y position of the bars.
*/
protected double getStartY() {
double y = 0.0;
if (bcBean.hasQuietZone()) {
y += bcBean.getVerticalQuietZone();
}
if (bcBean.getMsgPosition() == HumanReadablePlacement.HRP_TOP) {
y += bcBean.getHumanReadableHeight();
}
return y;
}
示例8: getTextY
/**
* Determines the Y coordinate for the baseline of the human-readable part.
* @return the adjusted Y coordinate
*/
protected double getTextY() {
double texty = 0.0;
if (bcBean.getMsgPosition() == HumanReadablePlacement.HRP_NONE) {
//nop
} else if (bcBean.getMsgPosition() == HumanReadablePlacement.HRP_TOP) {
texty += bcBean.getHumanReadableHeight();
} else if (bcBean.getMsgPosition() == HumanReadablePlacement.HRP_BOTTOM) {
texty += bcBean.getHeight();
if (bcBean.hasQuietZone()) {
texty += bcBean.getVerticalQuietZone();
}
}
return texty;
}
示例9: drawGroupText
private void drawGroupText(String text) {
if (bcBean.getMsgPosition() == HumanReadablePlacement.HRP_NONE) {
//nop
} else if (bcBean.getMsgPosition() == HumanReadablePlacement.HRP_TOP) {
DrawingUtil.drawText(canvas, bcBean, text,
groupx + bcBean.getBarWidth(1),
x - bcBean.getBarWidth(1),
bcBean.getHumanReadableHeight(), TextAlignment.TA_JUSTIFY);
} else if (bcBean.getMsgPosition() == HumanReadablePlacement.HRP_BOTTOM) {
DrawingUtil.drawText(canvas, bcBean, text,
groupx + bcBean.getBarWidth(1),
x - bcBean.getBarWidth(1),
bcBean.getHeight(), TextAlignment.TA_JUSTIFY);
}
}
示例10: drawSupplementalText
private void drawSupplementalText(String supp) {
if (bcBean.getMsgPosition() == HumanReadablePlacement.HRP_TOP) {
DrawingUtil.drawText(canvas, bcBean, supp,
groupx,
x,
bcBean.getHeight(), TextAlignment.TA_CENTER);
} else if (bcBean.getMsgPosition() == HumanReadablePlacement.HRP_BOTTOM) {
DrawingUtil.drawText(canvas, bcBean, supp,
groupx,
x,
bcBean.getHumanReadableHeight(), TextAlignment.TA_CENTER);
}
}
示例11: getPlacement
private static HumanReadablePlacement getPlacement(TextPlacement placement) {
if (placement == null) {
return HumanReadablePlacement.HRP_NONE;
}
switch(placement) {
case TOP : return HumanReadablePlacement.HRP_TOP;
case BOTTOM : return HumanReadablePlacement.HRP_BOTTOM;
default : return HumanReadablePlacement.HRP_NONE;
}
}
示例12: addBar
/** @see org.krysalis.barcode4j.ClassicBarcodeLogicHandler */
public void addBar(boolean black, int width) {
final double w = bcBean.getBarWidth(width);
if (black) {
final double h;
final double y;
if (!inSupplemental) {
if (bcBean.getMsgPosition() == HumanReadablePlacement.HRP_NONE) {
canvas.drawRectWH(x, 0, w, bcBean.getHeight());
} else if (bcBean.getMsgPosition() == HumanReadablePlacement.HRP_TOP) {
if (inMsgGroup) {
h = bcBean.getBarHeight();
y = bcBean.getHumanReadableHeight();
} else {
h = bcBean.getBarHeight() + (bcBean.getHumanReadableHeight() / 2);
y = bcBean.getHumanReadableHeight() / 2;
}
canvas.drawRectWH(x, y, w, h);
} else if (bcBean.getMsgPosition() == HumanReadablePlacement.HRP_BOTTOM) {
if (inMsgGroup) {
h = bcBean.getBarHeight();
} else {
h = bcBean.getBarHeight() + (bcBean.getHumanReadableHeight() / 2);
}
canvas.drawRectWH(x, 0.0, w, h);
}
} else {
//Special painting in supplemental
if (bcBean.getMsgPosition() == HumanReadablePlacement.HRP_NONE) {
h = bcBean.getBarHeight();
y = bcBean.getHumanReadableHeight();
canvas.drawRectWH(x, y, w, h);
} else if (bcBean.getMsgPosition() == HumanReadablePlacement.HRP_TOP) {
h = bcBean.getBarHeight()
+ (bcBean.getHumanReadableHeight() / 2)
- bcBean.getHumanReadableHeight();
y = bcBean.getHumanReadableHeight() / 2;
canvas.drawRectWH(x, y, w, h);
} else if (bcBean.getMsgPosition() == HumanReadablePlacement.HRP_BOTTOM) {
h = bcBean.getBarHeight()
+ (bcBean.getHumanReadableHeight() / 2)
- bcBean.getHumanReadableHeight();
y = bcBean.getHumanReadableHeight();
canvas.drawRectWH(x, y, w, h);
}
}
}
x += w;
}