本文整理匯總了Java中processing.core.PGraphics.fill方法的典型用法代碼示例。如果您正苦於以下問題:Java PGraphics.fill方法的具體用法?Java PGraphics.fill怎麽用?Java PGraphics.fill使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類processing.core.PGraphics
的用法示例。
在下文中一共展示了PGraphics.fill方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: drawAttribution
import processing.core.PGraphics; //導入方法依賴的package包/類
private void drawAttribution(PGraphics pGraphics) {
String name = "(C) OpenStreetMap contributors - www.openstreetmap.org/copyright";
float x = 580;
float y = 680;
float spaceWidth = pGraphics.textWidth(" ");
float textHeight = pGraphics.textAscent() + pGraphics.textDescent();
float toolTipWidth = pGraphics.textWidth(" " + name + " ");
float toolTipHeight = textHeight;
pGraphics.pushStyle();
pGraphics.noStroke();
pGraphics.fill(255, 255, 255, 30);
pGraphics.rect(x, y, toolTipWidth, toolTipHeight);
pGraphics.fill(0, 0, 0);
pGraphics.text(name, x + spaceWidth, y + pGraphics.textAscent());
pGraphics.popStyle();
}
示例4: drawToolTip
import processing.core.PGraphics; //導入方法依賴的package包/類
private void drawToolTip(PGraphics pGraphics, float x, float y) {
x = 20;
y = 20;
float spaceWidth = pGraphics.textWidth(" ");
float textHeight = pGraphics.textAscent() + pGraphics.textDescent();
float toolTipWidth = pGraphics.textWidth(name) * 11 / 10;
int toolTipLines = name.length() - name.replace("\n", "").length() + 1;
float toolTipHeight = textHeight * toolTipLines;
pGraphics.pushStyle();
pGraphics.noStroke();
pGraphics.fill(255, 255, 255);
pGraphics.rect(x, y, toolTipWidth, toolTipHeight);
pGraphics.fill(0, 0, 0);
pGraphics.text(name, x + spaceWidth, y + textHeight);
pGraphics.popStyle();
}
示例5: 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();
}
示例6: renderProcessing
import processing.core.PGraphics; //導入方法依賴的package包/類
@Override
public void renderProcessing(Item item, ProcessingTarget target, PreviewProperties properties) {
Float x = item.getData(NodeItem.X);
Float y = item.getData(NodeItem.Y);
Float size = item.getData(NodeItem.SIZE);
Color color = item.getData(NodeItem.COLOR);
int alpha = (int) ((properties.getFloatValue(PreviewProperty.NODE_OPACITY) / 100f) * 255f);
if (alpha > 255) {
alpha = 255;
}
PGraphics graphics = target.getGraphics();
graphics.fill(color.getRed(), color.getGreen(), color.getBlue(), alpha);
if (size > 21) {
logger.print(size);
Color stC = color.darker().darker().darker();
graphics.stroke(stC.getRed(), stC.getGreen(), stC.getBlue(), alpha);
graphics.strokeWeight(3f);
graphics.ellipse(x, y, size, size);
} else {
graphics.stroke(color.getRed(), color.getGreen(), color.getBlue(), alpha);
graphics.strokeWeight(1f);
graphics.ellipse(x, y, size, size);
}
}
示例7: draw
import processing.core.PGraphics; //導入方法依賴的package包/類
public void draw(PGraphics pg, java.util.List<MapPosition> mapPositions)
{
if(!hidden)
{
pg.pushStyle();
sourcescreen = source.getScreenPosition(map);
destscreen = dest.getScreenPosition(map);
pg.fill(150, 30, 30);
pg.line(sourcescreen.x-xbase,sourcescreen.y-ybase,destscreen.x-xbase,destscreen.y-ybase);
// Restore previous drawing style
pg.popStyle();
}
}
示例8: colorDetermine
import processing.core.PGraphics; //導入方法依賴的package包/類
private void colorDetermine(PGraphics pg) {
float depth = getDepth();
if (depth < THRESHOLD_INTERMEDIATE) {
pg.fill(255, 255, 0);
}
else if (depth < THRESHOLD_DEEP) {
pg.fill(0, 0, 255);
}
else {
pg.fill(255, 0, 0);
}
}
示例9: drawMarker
import processing.core.PGraphics; //導入方法依賴的package包/類
/**
* 在地圖上繪製標記
*/
public void drawMarker(PGraphics pg, float x, float y) {
// 保存之前的繪製風格
pg.pushStyle();
// 為每個城市繪製一個三角形標記
pg.fill(150, 30, 30);
pg.triangle(x, y-TRI_SIZE, x-TRI_SIZE, y+TRI_SIZE, x+TRI_SIZE, y+TRI_SIZE);
// 恢複之前的繪製風格
pg.popStyle();
}
示例10: draw
import processing.core.PGraphics; //導入方法依賴的package包/類
public void draw(PGraphics pg){
pg.noStroke();
pg.fill(0,100,200,150);
pg.rect(px,py,sx,sy);
float tx = px+sx+5;
float ty = py+sy/2 + 5;
pg.fill(0,150);
pg.rect(px+sx, py, pg.textWidth(name)+10, sy);
pg.fill(255); pg.text(name, tx, ty);
}
示例11: 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();
}
示例12: display
import processing.core.PGraphics; //導入方法依賴的package包/類
static public void display(PGraphics pg, DwWorld world, boolean bodies, boolean particles, boolean joints){
pg.fill(200);
pg.tint(255);
pg.stroke(0);
pg.strokeWeight(1f/world.transform.screen_scale);
if(bodies ) displayBodies (pg, world);
if(particles) displayParticles(pg, world);
if(joints ) displayJoints (pg, world);
}
示例13: checkbox
import processing.core.PGraphics; //導入方法依賴的package包/類
static boolean checkbox(PGraphics gx, float left, float top, boolean checked)
{
boolean bClicked = false;
if (m_MouseState.clickedInside(MouseState.LEFT, left, top, CHECKBOX_SIZE, CHECKBOX_SIZE)) {
bClicked = true;
checked = !checked;
}
gx.pushStyle();
try{
gx.fill(255);
gx.stroke(m_MouseState.isStartIn(left, top, CHECKBOX_SIZE, CHECKBOX_SIZE) &&
m_MouseState.isIn(left, top, CHECKBOX_SIZE, CHECKBOX_SIZE) ? 0xFFFF0000 : 0);
gx.rect(left, top, CHECKBOX_SIZE, CHECKBOX_SIZE);
gx.fill(0);
if (checked)
{
gx.textFont(dp.fontGuiFx);
gx.textSize(CHECKBOX_SIZE);
gx.textAlign(PConstants.CENTER, PConstants.CENTER);
gx.text("z", left + CHECKBOX_SIZE/2, top + CHECKBOX_SIZE/2);
}
} catch (Exception e) {
e.printStackTrace();
}
gx.popStyle();
return bClicked;
}
示例14: drawMarker
import processing.core.PGraphics; //導入方法依賴的package包/類
private void drawMarker(PGraphics pGraphics, float x, float y) {
pGraphics.pushStyle();
pGraphics.noStroke();
pGraphics.fill(128, 255, 128, 200);
pGraphics.ellipse(x, y, MARKER_SIZE, MARKER_SIZE);
pGraphics.popStyle();
}
示例15: drawMarker
import processing.core.PGraphics; //導入方法依賴的package包/類
public void drawMarker(PGraphics pg, float x, float y) {
pg.fill(11);
zoomLevel = map.getZoomLevel();
radius = (zoomLevel*2) + 5;
img.resize(radius, radius);
pg.image(img, x - radius/2, y - radius/2);
if (selected) {
showTitle(pg, x, y);
}
}