本文整理汇总了Java中org.jdesktop.swingx.painter.TextPainter类的典型用法代码示例。如果您正苦于以下问题:Java TextPainter类的具体用法?Java TextPainter怎么用?Java TextPainter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TextPainter类属于org.jdesktop.swingx.painter包,在下文中一共展示了TextPainter类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: watermarkImage
import org.jdesktop.swingx.painter.TextPainter; //导入依赖的package包/类
public BufferedImage watermarkImage(BufferedImage src, TextPainter textPainter) {
BufferedImage dest;
int width = src.getWidth();
int height = src.getHeight();
// the text is with white on black background on the bump map image
BufferedImage bumpImage = new BufferedImage(width, height, TYPE_INT_RGB);
Graphics2D g = bumpImage.createGraphics();
g.setColor(BLACK);
g.fillRect(0, 0, width, height);
textPainter.setFillPaint(WHITE);
textPainter.paint(g, this, width, height);
g.dispose();
dest = ImageUtils.bumpMap(src, bumpImage);
return dest;
}
示例2: transform
import org.jdesktop.swingx.painter.TextPainter; //导入依赖的package包/类
@Override
public BufferedImage transform(BufferedImage src, BufferedImage dest) {
if (settings.getText().isEmpty()) {
return src;
}
TextPainter textPainter = new TextPainter();
settings.configurePainter(textPainter);
if (settings.isWatermark()) {
dest = settings.watermarkImage(src, textPainter);
} else {
int width = dest.getWidth();
int height = dest.getHeight();
textPainter.setFillPaint(settings.getColor());
Graphics2D g = dest.createGraphics();
textPainter.paint(g, this, width, height);
g.dispose();
}
return dest;
}
示例3: configurePainter
import org.jdesktop.swingx.painter.TextPainter; //导入依赖的package包/类
public void configurePainter(TextPainter painter) {
painter.setAntialiasing(true);
painter.setText(text);
painter.setFont(font);
if (areaEffects != null) {
painter.setAreaEffects(areaEffects.asArray());
}
painter.setHorizontalAlignment(horizontalAlignment);
painter.setVerticalAlignment(verticalAlignment);
}