本文整理匯總了Java中processing.core.PGraphics.rectMode方法的典型用法代碼示例。如果您正苦於以下問題:Java PGraphics.rectMode方法的具體用法?Java PGraphics.rectMode怎麽用?Java PGraphics.rectMode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類processing.core.PGraphics
的用法示例。
在下文中一共展示了PGraphics.rectMode方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: showTitle
import processing.core.PGraphics; //導入方法依賴的package包/類
/** 顯示選中的標記對應的城市名稱 */
public void showTitle(PGraphics pg, float x, float y)
{
String name = getCity() + " " + getCountry() + " ";
String pop = "Pop: " + getPopulation() + " Million";
pg.pushStyle();
pg.fill(255, 255, 255);
pg.textSize(12);
pg.rectMode(PConstants.CORNER);
pg.rect(x, y-TRI_SIZE-39, Math.max(pg.textWidth(name), pg.textWidth(pop)) + 6, 39);
pg.fill(0, 0, 0);
pg.textAlign(PConstants.LEFT, PConstants.TOP);
pg.text(name, x+3, y-TRI_SIZE-33);
pg.text(pop, x+3, y - TRI_SIZE -18);
pg.popStyle();
}
示例2: showTitle
import processing.core.PGraphics; //導入方法依賴的package包/類
/** Show the title of the earthquake if this marker is selected */
public void showTitle(PGraphics pg, float x, float y)
{
String title = getTitle();
pg.pushStyle();
pg.rectMode(PConstants.CORNER);
pg.stroke(110);
pg.fill(255,255,255);
pg.rect(x, y + 15, pg.textWidth(title) +6, 18, 5);
pg.textAlign(PConstants.LEFT, PConstants.TOP);
pg.fill(0);
pg.text(title, x + 3 , y +18);
pg.popStyle();
}
示例3: showTitle
import processing.core.PGraphics; //導入方法依賴的package包/類
public void showTitle(PGraphics pg, float x, float y)
{
String name = getCity() + " " + getCountry() + " ";
String pop = "Pop: " + getPopulation() + " Million";
pg.pushStyle();
pg.fill(255, 255, 255);
pg.textSize(12);
pg.rectMode(PConstants.CORNER);
pg.rect(x, y-TRI_SIZE-39, Math.max(pg.textWidth(name), pg.textWidth(pop)) + 6, 39);
pg.fill(0, 0, 0);
pg.textAlign(PConstants.LEFT, PConstants.TOP);
pg.text(name, x+3, y-TRI_SIZE-33);
pg.text(pop, x+3, y - TRI_SIZE -18);
pg.popStyle();
}
示例4: showTitle
import processing.core.PGraphics; //導入方法依賴的package包/類
/** Show the title of the city if this marker is selected */
public void showTitle(PGraphics pg, float x, float y)
{
String name = getCity() + " " + getCountry() + " ";
String pop = "Pop: " + getPopulation() + " Million";
pg.pushStyle();
pg.fill(255, 255, 255);
pg.textSize(12);
pg.rectMode(PConstants.CORNER);
pg.rect(x, y-TRI_SIZE-39, Math.max(pg.textWidth(name), pg.textWidth(pop)) + 6, 39);
pg.fill(0, 0, 0);
pg.textAlign(PConstants.LEFT, PConstants.TOP);
pg.text(name, x+3, y-TRI_SIZE-33);
pg.text(pop, x+3, y - TRI_SIZE -18);
pg.popStyle();
}
示例5: apply
import processing.core.PGraphics; //導入方法依賴的package包/類
@Override
public Object apply(WarpScriptStack stack) throws WarpScriptException {
List<Object> params = ProcessingUtil.parseParams(stack, 1);
PGraphics pg = (PGraphics) params.get(0);
String mode = params.get(1).toString();
if ("CORNER".equals(mode)) {
pg.rectMode(PGraphics.CORNER);
} else if ("CORNERS".equals(mode)) {
pg.rectMode(PGraphics.CORNERS);
} else if ("RADIUS".equals(mode)) {
pg.rectMode(PGraphics.RADIUS);
} else if ("CENTER".equals(mode)) {
pg.rectMode(PGraphics.CENTER);
} else {
throw new WarpScriptException(getName() + ": invalid mode, should be 'CENTER', 'RADIUS', 'CORNER' or 'CORNERS'.");
}
stack.push(pg);
return stack;
}
示例6: showTitle
import processing.core.PGraphics; //導入方法依賴的package包/類
public void showTitle(PGraphics pg, float x, float y) {
// show rectangle with title
// show routes
String id = "ID : " + getId();
String name = getName();
pg.pushStyle();
pg.fill(255,255,255);
pg.textSize(12);
pg.rectMode(PConstants.CORNER);
pg.rect(x,y-8*radius,Math.max(pg.textWidth(id),pg.textWidth(name))+6,8*radius);
pg.fill(0,0,0);
pg.textAlign(PConstants.LEFT,PConstants.TOP);
pg.text(id,x+3,y-7*radius);
pg.text(name,x+3,y-4*radius);
pg.popStyle();
}
示例7: loadNoTextureTexture
import processing.core.PGraphics; //導入方法依賴的package包/類
private static void loadNoTextureTexture(int size){
PGraphics pg = Public.p.createGraphics(size, size);
pg.beginDraw();
pg.translate(pg.width/2, pg.height/2);
pg.rectMode(PConstants.CENTER);
pg.fill(229,22,215);
pg.rect(-size/2, -size/2,size,size);
pg.fill(0,0,0);
pg.rect(size/2, -size/2,size,size);
pg.fill(229,22,215);
pg.rect(size/2, size/2,size,size);
pg.fill(0,0,0);
pg.rect(-size/2, size/2,size,size);
pg.fill(255,255,255);
pg.textSize(11);
pg.text("TEXTURE", -size/2+PApplet.map(size, 50, 100, 0, 26), -10);
pg.text("NOT", -size/2+pg.textWidth("NOT")/2+PApplet.map(size, 50, 100, 0, 26), 5);
pg.text("FOUND", -(size/2-pg.textWidth("FOUND")/6)+PApplet.map(size, 50, 100, 0, 26), 20);
pg.endDraw();
noTextureTexture = pg.get();
}
示例8: display
import processing.core.PGraphics; //導入方法依賴的package包/類
public void display(PGraphics pg_canvas, int x, int y){
setDisplayPosition(x, y);
pg_canvas.image(pg_region, x, y, w, h);
pg_canvas.rectMode(PConstants.CORNER);
pg_canvas.stroke(128);
pg_canvas.strokeWeight(1);
pg_canvas.noFill();
pg_canvas.rect(x, y, w, h);
}