本文整理汇总了Java中processing.core.PFont类的典型用法代码示例。如果您正苦于以下问题:Java PFont类的具体用法?Java PFont怎么用?Java PFont使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PFont类属于processing.core包,在下文中一共展示了PFont类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setup
import processing.core.PFont; //导入依赖的package包/类
public void setup() {
size(700,400);
PFont font = createFont("arial",20);
cp5 = new ControlP5(this);
cp5.addTextfield("input")
.setPosition(20,100)
.setSize(200,40)
.setFont(font)
.setFocus(true)
.setColor(color(255,0,0))
;
cp5.addTextfield("textValue")
.setPosition(20,170)
.setSize(200,40)
.setFont(createFont("arial",20))
.setAutoClear(false)
;
cp5.addBang("clear")
.setPosition(240,170)
.setSize(80,40)
.getCaptionLabel().align(ControlP5.CENTER, ControlP5.CENTER)
;
cp5.addTextfield("default")
.setPosition(20,350)
.setAutoClear(false)
;
textFont(font);
}
示例2: apply
import processing.core.PFont; //导入依赖的package包/类
@Override
public Object apply(WarpScriptStack stack) throws WarpScriptException {
List<Object> params = ProcessingUtil.parseParams(stack, 1, 2);
PGraphics pg = (PGraphics) params.get(0);
if (2 == params.size()) {
pg.textFont((PFont) params.get(1));
} else if (3 == params.size()) {
pg.textFont((PFont) params.get(1),
((Number) params.get(2)).floatValue());
}
stack.push(pg);
return stack;
}
示例3: drawText
import processing.core.PFont; //导入依赖的package包/类
static public void drawText(PGraphicsOpenGL pg3d, String text, PFont font, int x, int y) {
pg3d.pushMatrix();
pg3d.translate(x, y);
pg3d.text(text, 0, 0);
pg3d.popMatrix();
// pg3d.pushMatrix();
// pg3d.translate(x, y);
// pg3d.scale(-1, 1, 1);
// pg3d.rotate(PApplet.PI);
// pg3d.textMode(PApplet.MODEL);
// pg3d.textFont(font);
// pg3d.text(text, 0, 0);
// pg3d.popMatrix();
}
示例4: Papart
import processing.core.PFont; //导入依赖的package包/类
/**
* Create the main PapARt object, look at the examples for how to use it.
*
* @param applet
*/
public Papart(Object applet) {
this.displayInitialized = false;
this.cameraInitialized = false;
this.touchInitialized = false;
this.applet = (PApplet) applet;
cameraConfiguration = getDefaultCameraConfiguration(this.applet);
screenConfiguration = getDefaultScreenConfiguration(this.applet);
this.appletClass = applet.getClass();
PFont font = this.applet.loadFont(defaultFont);
// TODO: singleton -> Better implementation.
if (Papart.singleton == null) {
Papart.singleton = this;
}
}
示例5: initTexture
import processing.core.PFont; //导入依赖的package包/类
protected void initTexture(PGraphicsOpenGL pg, PFont font) {
currentTex = -1;
lastTex = -1;
int spow = PGL.nextPowerOfTwo(font.getSize());
minSize = PApplet.min(PGraphicsOpenGL.maxTextureSize,
PApplet.max(PGL.MIN_FONT_TEX_SIZE, spow));
maxSize = PApplet.min(PGraphicsOpenGL.maxTextureSize,
PApplet.max(PGL.MAX_FONT_TEX_SIZE, 2 * spow));
if (maxSize < spow) {
PGraphics.showWarning("The font size is too large to be properly " +
"displayed with OpenGL");
}
addTexture(pg);
offsetX = 0;
offsetY = 0;
lineHeight = 0;
texinfoMap = new HashMap<PFont.Glyph, TextureInfo>();
glyphTexinfos = new TextureInfo[font.getGlyphCount()];
addAllGlyphsToTexture(pg, font);
}
示例6: guiCreateMain
import processing.core.PFont; //导入依赖的package包/类
void guiCreateMain()
{
// color and font
controlP5 = new ControlP5(this);
PFont p = createFont("Verdana",10);
controlP5.setControlFont(p, 10);
controlP5.setColorLabel(color(0));
controlP5.setColorBackground(200);
controlP5.setColorForeground(140);
// main panel
PanelController parentPanel = new PanelController(controlP5, "panelMain", 0, 20, width, height - 20);
parentPanel.setColorBackground(0x01000000); // transparent background
// left and right panels
SplitPanelController heatmapSplit = new controlP5.SplitPanelController(controlP5, "heatmapSplit", 0, 0, parentPanel.getWidth(), parentPanel.getHeight());
heatmapSplit.setDividerLocation(0.2);
heatmapSplit.getPane(SplitPanelController.LEFT).setColorBackground(0x01000000);
heatmapSplit.getPane(SplitPanelController.RIGHT).setColorBackground(0x01000000);
parentPanel.addToLayout(heatmapSplit, PanelController.ANCHOR_ALL);
m_GUIClusterHierarchyPanel = heatmapSplit.getPane(SplitPanelController.LEFT);
m_GUIHeatMapPanel = heatmapSplit.getPane(SplitPanelController.RIGHT);
// scroller on the left panel.
m_GUIClusterHierarchySlider = controlP5.addSlider("scrollCH", 0, 100, 0, 10, m_GUIClusterHierarchyPanel.getHeight() - 30, m_GUIClusterHierarchyPanel.getWidth() - 20, 15);
m_GUIClusterHierarchySlider.setSliderMode(Slider.FLEXIBLE);
m_GUIClusterHierarchySlider.captionLabel().setVisible(false);
m_GUIClusterHierarchySlider.valueLabel().setVisible(false);
m_GUIClusterHierarchyPanel.addToLayout(m_GUIClusterHierarchySlider, PanelController.ANCHOR_ALL & ~PanelController.ANCHOR_TOP);
//guiCreateNavigation();
// controlP5
// m_GUIHeatMapPanel.addTab("Clusters");
guiCreateTabs();
}
示例7: renderProcessing
import processing.core.PFont; //导入依赖的package包/类
@Override
public void renderProcessing(ProcessingTarget target, String label, float x, float y, int fontSize, Color color, float outlineSize, Color outlineColor, boolean showBox, Color boxColor) {
if(!textOn)return;
if (label != null) {
PGraphics graphics = target.getGraphics();
//
graphics.fill(color.getRGB(), 255f);
//target.getGraphics().text //graphics.textFont;
//System.out.println(label);
if (label.contains("|")) {
try {
graphics.beginText();
PFont f = new PFont(frmMain.getInstance().getFont(), true);
graphics.textFont = f;
graphics.textSize = 8;
String[] l = label.split(":");
//System.out.println(Arrays.toString(l));
graphics.text(l[l.length-1], 15 + x + graphics.textSize, y);
graphics.endText();
} catch (Exception e) {
logger.print(e);
}
}
//
}
}
示例8: renderProcessing
import processing.core.PFont; //导入依赖的package包/类
@Override
public void renderProcessing(ProcessingTarget target, String label, float x, float y, int fontSize, Color color, float outlineSize, Color outlineColor, boolean showBox, Color boxColor) {
if(!textOn)return;
if (label != null) {
PGraphics graphics = target.getGraphics();
//
graphics.fill(color.getRGB(), 255f);
//target.getGraphics().text //graphics.textFont;
//System.err.println(label);
if (label.contains("|")) {
try {
graphics.beginText();
PFont f = new PFont(frmMain.getInstance().getFont(), true);
graphics.textFont = f;
graphics.textSize = 8;
String[] l = label.split("\\|");
System.err.println(Arrays.toString(l));
graphics.text(l[l.length-1], 15 + x + graphics.textSize, y);
graphics.endText();
} catch (Exception e) {
logger.print(e);
}
}
//
}
}
示例9: apply
import processing.core.PFont; //导入依赖的package包/类
@Override
public Object apply(WarpScriptStack stack) throws WarpScriptException {
List<Object> params = ProcessingUtil.parseParams(stack, 2, 3, 4);
PGraphics pg = (PGraphics) params.get(0);
PFont font = null;
if (3 == params.size()) {
font = pg.parent.createFont(params.get(1).toString(), ((Number) params.get(2)).floatValue());
} else if (4 == params.size()) {
font = pg.parent.createFont(
params.get(1).toString(),
((Number) params.get(2)).floatValue(),
Boolean.TRUE.equals(params.get(3)));
} else if (5 == params.size()) {
font = pg.parent.createFont(
params.get(1).toString(),
((Number) params.get(2)).floatValue(),
Boolean.TRUE.equals(params.get(3)),
params.get(4).toString().toCharArray());
}
stack.push(pg);
stack.push(font);
return stack;
}
示例10: initMatrixGui
import processing.core.PFont; //导入依赖的package包/类
void initMatrixGui() {
PFont arial = createFont("arial", 12);
cameraMatrixText = skatolo.addTextarea("Camera")
.setPosition(10, MATRICES_HEIGHT)
.setSize(330, 100)
.setFont(arial)
.setLineHeight(14);
projectorMatrixText = skatolo.addTextarea("Projector")
.setPosition(300, MATRICES_HEIGHT)
.setSize(330, 100)
.setFont(arial)
.setLineHeight(14);
if (useExternalColorCamera) {
System.out.println("Depth camera OK...");
kinectMatrixText = skatolo.addTextarea("Kinect")
.setPosition(600, MATRICES_HEIGHT)
.setSize(330, 100)
.setFont(arial)
.setLineHeight(14) //.setColor(color(128))
;
} else {
System.out.println("External camera not activated.");
}
}
示例11: Rain
import processing.core.PFont; //导入依赖的package包/类
/**
* 降水強度を表示させる
*/
public void Rain(){
fill(197,42,92);
rect(this.x*3/4,this.y/2,this.x/4,this.y/2);
fill(0);
PFont font = createFont("MS Gothic",48,true);
textFont(font);
textAlign(CENTER);
textSize(this.x/55);
text("ただいまの降水強度は",this.x*3/4 + this.x/8,this.y*3/4);
textSize(this.x/30);
text("\n" + this.rain.getSurveyRainfall() + "[mm/h]",this.x*3/4 + this.x/8,this.y*3/4);
textAlign(LEFT);
}
开发者ID:ryohashioka,项目名称:Visual-Programming-Environment-for-Coordinating-Appliances-and-Services-in-a-Smart-House,代码行数:17,代码来源:UserTwitter.java
示例12: drawBox
import processing.core.PFont; //导入依赖的package包/类
private PGraphics drawBox(String text, PFont font, int textColor, int backgroundColor, boolean hasBorder) {
PGraphics graphics = createGraphics(width, height);
graphics.beginDraw();
graphics.textFont(font);
graphics.textAlign(CENTER, CENTER);
int w = (int)graphics.textWidth(text) + 16;
int h = (int)graphics.textSize;
if (hasBorder) {
graphics.stroke(BORDER);
graphics.strokeWeight(4);
}
graphics.fill(backgroundColor);
graphics.beginShape();
graphics.vertex(4, 0);
graphics.vertex(w - 4, 0);
graphics.vertex(w, 4);
graphics.vertex(w, h - 4);
graphics.vertex(w - 4, h);
graphics.vertex(4, h);
graphics.vertex(0, h - 4);
graphics.vertex(0, 4);
graphics.endShape(CLOSE);
graphics.noStroke();
graphics.fill(textColor);
graphics.text(text, w / 2, h / 2);
graphics.endDraw();
return graphics;
}
示例13: InfoBox
import processing.core.PFont; //导入依赖的package包/类
public InfoBox(PApplet sketch, Sky sky, PFont font) {
this.sketch = sketch;
this.sky = sky;
this.infos = new ArrayList<Info>();
this.font = font;
this.top = sketch.height - InfoBox.HEIGHT;
this.center = InfoBox.HEIGHT / 2;
}
示例14: TimeZones
import processing.core.PFont; //导入依赖的package包/类
public TimeZones(PApplet sketch, PFont font) {
this.sketch = sketch;
this.timeZoneWidth = this.sketch.width / 24F;
this.halfTimeZoneWidth = this.timeZoneWidth / 2F;
this.font = font;
this.center = TimeZones.HEIGHT / 2F;
this.top = this.sketch.height / 2F + this.center;
}
示例15: checkFontSize
import processing.core.PFont; //导入依赖的package包/类
static private int checkFontSize(PFont theFont) {
try {
// was: return theFont.getFont().getSize(); but disappeared with p5 2.0b1
return theFont.getSize();
} catch (NullPointerException e) {
System.out.println("ControlP5: could not find font-size details for font " + theFont.getName() + ", use constructor ControlFont(PFont theFont, int theFontSize) to specify the font size.");
return 10;
}
}