本文整理匯總了Java中processing.core.PGraphics.rect方法的典型用法代碼示例。如果您正苦於以下問題:Java PGraphics.rect方法的具體用法?Java PGraphics.rect怎麽用?Java PGraphics.rect使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類processing.core.PGraphics
的用法示例。
在下文中一共展示了PGraphics.rect方法的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: 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: drawPoint
import processing.core.PGraphics; //導入方法依賴的package包/類
public void drawPoint(PGraphics pg, int idx, float left, float top, float width, float height)
{
if (m_Images[idx] != null)
{
try
{
pg.imageMode(PApplet.CORNER);
pg.image(m_Images[idx], left, top, width, height);
}
catch (Exception e)
{
}
}
else
{
// just draw an empty rect with a cross
pg.stroke(0);
pg.rect(left, top, width, height);
pg.line(left, top, left + width, top + height);
pg.line(left + width, top, left, top + height);
}
}
示例5: drawCutOffMax
import processing.core.PGraphics; //導入方法依賴的package包/類
void drawCutOffMax(PGraphics gx)
{
float cutoff = (float)m_Framework.getGroup(m_iGroupIndex, true).m_CutOffMax;
float thresholdLineY = m_LargeRect.bottom() - m_LargeRect.height() * (cutoff - 1 + m_ZoomCoord.bottom()) / (m_ZoomCoord.bottom() - m_ZoomCoord.top());
float topVal = 1 - m_ScrollY.value();
float bottomVal = 1 - (m_ScrollY.value() + m_ScrollY.getVisibleAmount());
float gradTop = cutoff > topVal ? m_CuttOffRect.top() : thresholdLineY;
DrawUtils.gradientRect(gx, (int)m_CuttOffRect.left(), (int)gradTop,
m_CuttOffRect.width(), m_CuttOffRect.bottom() - gradTop,
gx.lerpColor(dp.hmColor0, dp.hmColor1, cutoff > topVal ? topVal / cutoff : 1),
gx.lerpColor(dp.hmColor0, dp.hmColor1, bottomVal / cutoff),
DrawUtils.Y_AXIS);
gx.noFill();
gx.rect(m_CuttOffRect.left(), m_CuttOffRect.top(), m_CuttOffRect.width(), m_CuttOffRect.height());
if (1 - cutoff > m_ZoomCoord.top() && 1 - cutoff < m_ZoomCoord.bottom())
{// draw the cuttoff max line
gx.strokeWeight(3);
gx.line(m_CuttOffRect.left(), thresholdLineY, m_CuttOffRect.right(), thresholdLineY);
}
}
示例6: 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();
}
示例7: 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();
}
示例8: 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();
}
示例9: 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();
}
示例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: drawProfile
import processing.core.PGraphics; //導入方法依賴的package包/類
public static void drawProfile(PGraphics p, double[] values, double dMin, double dMax, float fLeft, float fTop, float fWidth, float fHeight, boolean bFilled)
{
if (values == null || values.length == 0 || dMax - dMin <= 0)
return;
float fPrevX = 0;
float fPrevY = 0;
for (int i = 0; i < values.length; i++)
{
float fW = fWidth / (values.length - 1);
float fH = (float)Math.min(fHeight, (values[i] - dMin) * fHeight / (dMax - dMin));
float fX = i * fW + fLeft;
float fY = (float)(fTop + fHeight - fH);
if (bFilled)
{
p.rect(fX, fTop + fHeight, fW, -fH);
}
else if (i > 0)
{
p.line (fPrevX, fPrevY, fX, fY);
}
fPrevX = fX;
fPrevY = fY;
}
}
示例13: drawPointDetailed
import processing.core.PGraphics; //導入方法依賴的package包/類
public void drawPointDetailed(PGraphics pg, int idx, float left, float top, float width, float height)
{
if (m_iMetaDataColIndex == -1)
return;
if (m_iDetailedPointIndex != idx)
{
m_DetailedImage = null;
s_DetailedPointMetaData = m_Operator.getMetaData(m_iMetaDataColIndex, idx);
try
{
if ((new File(m_sFilePath + s_DetailedPointMetaData)).exists())
{
m_DetailedImage = m_Applet.loadImage(m_sFilePath + s_DetailedPointMetaData);
}
}
catch (Exception e)
{
}
m_iDetailedPointIndex = idx;
}
if (m_DetailedImage != null)
{
pg.imageMode(PApplet.CORNER);
pg.image(m_DetailedImage, left, top, width, height);
}
else
{
// just draw an empty rect with a cross
pg.stroke(128);
pg.rect(left, top, width, height);
pg.line(left, top, left + width, top + height);
pg.line(left + width, top, left, top + height);
}
}
示例14: 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;
}
示例15: drawSmallPlot
import processing.core.PGraphics; //導入方法依賴的package包/類
void drawSmallPlot(PGraphics gx)
{
// draw the small plot image on the top right corner
gx.fill(255);
gx.stroke(0);
gx.strokeWeight(1);
gx.rect(m_SmallRect.left()-1, m_SmallRect.top()-1, m_SmallRect.width()+2, m_SmallRect.height()+2); // border
if (!m_ShowSummary)
{
m_CDisplay.drawPlot(gx, dp, m_ClustInfo, m_iGroupIndex, m_SmallRect);
}
else
{
gx.stroke(128);
gx.strokeWeight(2);
m_CDisplay.drawSummaryPlot(gx, dp, m_ClustInfo, m_SmallRect, -1, false);
}
// shade the non-visible regions in the small plot image;
gx.fill(0, 40);
gx.noStroke();
Rect visibleRect = new Rect(m_SmallRect.left() + m_ZoomCoord.left() * m_SmallRect.width(),
m_SmallRect.top() + m_ZoomCoord.top() * m_SmallRect.height(),
m_ZoomCoord.width() * m_SmallRect.width(),
m_ZoomCoord.height() * m_SmallRect.height());
gx.rect(m_SmallRect.left(), m_SmallRect.top(), visibleRect.left() - m_SmallRect.left(), m_SmallRect.height());
gx.rect(visibleRect.left(), m_SmallRect.top(), visibleRect.width(), visibleRect.top() - m_SmallRect.top());
gx.rect(visibleRect.left(), visibleRect.bottom(), visibleRect.width(), m_SmallRect.bottom() - visibleRect.bottom());
gx.rect(visibleRect.right(), m_SmallRect.top(), m_SmallRect.right() - visibleRect.right(), m_SmallRect.height());
gx.noFill();
gx.stroke(0);
gx.rect(visibleRect.left(), visibleRect.top(), visibleRect.width(), visibleRect.height());
}