本文整理匯總了Java中processing.core.PGraphics.strokeWeight方法的典型用法代碼示例。如果您正苦於以下問題:Java PGraphics.strokeWeight方法的具體用法?Java PGraphics.strokeWeight怎麽用?Java PGraphics.strokeWeight使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類processing.core.PGraphics
的用法示例。
在下文中一共展示了PGraphics.strokeWeight方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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);
}
}
示例2: 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);
}
}
示例3: drawMarker
import processing.core.PGraphics; //導入方法依賴的package包/類
@Override
public void drawMarker(PGraphics pg, float x, float y) {
// 保存之前的風格
pg.pushStyle();
// 根據地震深度來確定標記的顏色
colorDetermine(pg);
// 調用子類中實現的抽象方法來繪製標記形狀
drawEarthquake(pg, x, y);
// IMPLEMENT: add X over marker if within past day
String age = getStringProperty("age");
if ("Past Hour".equals(age) || "Past Day".equals(age)) {
pg.strokeWeight(2);
int buffer = 2;
pg.line(x-(radius+buffer),
y-(radius+buffer),
x+radius+buffer,
y+radius+buffer);
pg.line(x-(radius+buffer),
y+(radius+buffer),
x+radius+buffer,
y-(radius+buffer));
}
// 恢複之前的風格
pg.popStyle();
}
示例4: 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);
}
示例5: drawSpawnTrack
import processing.core.PGraphics; //導入方法依賴的package包/類
public void drawSpawnTrack(PGraphics pg){
if(is_active){
pg.strokeWeight(1f / transform.screen_scale);
pg.stroke(200,128,128, 128);
pg.line(bomb_spawn_start.x, bomb_spawn_start.y, bomb_spawn_end.x, bomb_spawn_end.y);
}
}
示例6: drawMarker
import processing.core.PGraphics; //導入方法依賴的package包/類
@Override
public void drawMarker(PGraphics pg, float x, float y) {
// save previous styling
pg.pushStyle();
// determine color of marker from depth
colorDetermine(pg);
// call abstract method implemented in child class to draw marker shape
drawEarthquake(pg, x, y);
String age = getStringProperty("age");
if ("Past Hour".equals(age) || "Past Day".equals(age)) {
pg.strokeWeight(2);
int buffer = 2;
pg.line(x-(radius+buffer),
y-(radius+buffer),
x+radius+buffer,
y+radius+buffer);
pg.line(x-(radius+buffer),
y+(radius+buffer),
x+radius+buffer,
y-(radius+buffer));
}
// reset to previous styling
pg.popStyle();
}
示例7: 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());
}
示例8: drawMarker
import processing.core.PGraphics; //導入方法依賴的package包/類
@Override
public void drawMarker(PGraphics pg, float x, float y) {
// save previous styling
pg.pushStyle();
// determine color of marker from depth
colorDetermine(pg);
// call abstract method implemented in child class to draw marker shape
drawEarthquake(pg, x, y);
// IMPLEMENT: add X over marker if within past day
String age = getStringProperty("age");
if ("Past Hour".equals(age) || "Past Day".equals(age)) {
pg.strokeWeight(2);
int buffer = 2;
pg.line(x-(radius+buffer),
y-(radius+buffer),
x+radius+buffer,
y+radius+buffer);
pg.line(x-(radius+buffer),
y+(radius+buffer),
x+radius+buffer,
y-(radius+buffer));
}
// reset to previous styling
pg.popStyle();
}
示例9: 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);
}
示例10: displayWireframe
import processing.core.PGraphics; //導入方法依賴的package包/類
public void displayWireframe(PGraphics pg, DwParticle3D[] particles){
pg.strokeWeight(DEF.style.stroke_w);
pg.stroke(DEF.style.stroke_r, DEF.style.stroke_g, DEF.style.stroke_b);
int[] vid = updateVIDX();
for(int i = 0; i < DEF.EDGES_COUNT; i++){
int[] edge = DEF.EDGES[i];
int i0 = vid[edge[0]];
int i1 = vid[edge[1]];
DwParticle3D v0 = particles[i0];
DwParticle3D v1 = particles[i1];
if(v0.all_springs_deactivated || v1.all_springs_deactivated) continue;
DwDisplayUtils.line(pg, v0, v1);
}
}
示例11: drawLayer
import processing.core.PGraphics; //導入方法依賴的package包/類
private void drawLayer(PGraphics pg, int m){
int tileoffsetx, tileoffsety, n, dif;
float x = 0, y = 0;
Layer l = this.layer[m];
switch(l.type){
case "layer":
map.drawTileLayer(pg, m);
break;
case "imagelayer":
pg.image(l.image, -this.camleft + l.offsetx, -this.camtop + l.offsety);
break;
case "objectgroup":
pg.fill(l.objcolor);pg.stroke(l.objcolor); pg.strokeWeight(1);
for(StringDict o: l.objects){
if(!o.hasKey("visible")){
pg.pushMatrix();
pg.resetMatrix();
pg.pushStyle();
pg.ellipseMode(parent.CORNER);
pg.translate(parent.parseFloat(o.get("x")) - l.offsetx - this.camleft, parent.parseFloat(o.get("y"))- l.offsety - this.camtop);
if(o.hasKey("rotation")) pg.rotate(parent.parseFloat(o.get("rotation")) * parent.PI / 180);
switch(o.get("object")){
case "rectangle":
pg.rect(0, 0, parent.parseFloat(o.get("width")), parent.parseFloat(o.get("height")));
break;
case "ellipse":
pg.ellipse(0, 0, parent.parseFloat(o.get("width")), parent.parseFloat(o.get("height")));
break;
case "tile":
if(o.hasKey("rotation")) pg.rotate(-parent.parseFloat(o.get("rotation")) * parent.PI / 180);
pg.translate(0, -this.tile[parent.parseInt(o.get("gid")) - 1].image.height);
if(o.hasKey("rotation")) pg.rotate(parent.parseFloat(o.get("rotation")) * parent.PI / 180);
pg.image(this.tile[parent.parseInt(o.get("gid")) - 1].image, this.tile[parent.parseInt(o.get("gid")) - 1].offsetx, this.tile[parent.parseInt(o.get("gid")) - 1].offsety, parent.parseFloat(o.get("width")), parent.parseFloat(o.get("height")));
break;
case "polygon":
case "polyline":
if(o.get("object").equals("polyline")) pg.noFill();
pg.beginShape();
for(String s: parent.split(o.get("points"), " ")){
float [] p = parent.parseFloat(parent.split(s, ","));
pg.vertex(p[0], p[1]);
}
if(o.get("object").equals("polyline")) pg.endShape(); else pg.endShape(parent.CLOSE);
break;
}
pg.popStyle();
pg.popMatrix();
}
}
break;
}
if(pg != parent.g && l.opacity < 1){//applyOpacity
pg.loadPixels();
int a = parent.parseInt(parent.map(l.opacity, 0, 1, 1, 255));
for (int p = 0; p < pg.pixels.length; p++) if(parent.alpha(pg.pixels[p]) > a) pg.pixels[p] = parent.color(parent.red(pg.pixels[p]), parent.green(pg.pixels[p]), parent.blue(pg.pixels[p]), a);
pg.updatePixels();
}
}
示例12: 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);
pg.strokeWeight(((Number) params.get(1)).floatValue());
stack.push(pg);
return stack;
}