當前位置: 首頁>>代碼示例>>Java>>正文


Java PGraphics.stroke方法代碼示例

本文整理匯總了Java中processing.core.PGraphics.stroke方法的典型用法代碼示例。如果您正苦於以下問題:Java PGraphics.stroke方法的具體用法?Java PGraphics.stroke怎麽用?Java PGraphics.stroke使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在processing.core.PGraphics的用法示例。


在下文中一共展示了PGraphics.stroke方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: 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();
	
}
 
開發者ID:snavjivan,項目名稱:Earthquake-Tracker,代碼行數:21,代碼來源:EarthquakeMarker.java

示例2: 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);
	}
}
 
開發者ID:hyounesy,項目名稱:ChAsE,代碼行數:23,代碼來源:MetadataImageViewer.java

示例3: 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);
    }
}
 
開發者ID:nolanlab,項目名稱:vortex,代碼行數:25,代碼來源:frmScFDL.java

示例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);
}
 
開發者ID:diwi,項目名稱:LiquidFunProcessing,代碼行數:11,代碼來源:DwDebugDraw.java

示例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);
  }
}
 
開發者ID:diwi,項目名稱:LiquidFunProcessing,代碼行數:8,代碼來源:DwMouseShootBullet.java

示例6: 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);
	}
}
 
開發者ID:hyounesy,項目名稱:ChAsE,代碼行數:37,代碼來源:MetadataImageViewer.java

示例7: 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;
}
 
開發者ID:hyounesy,項目名稱:ChAsE,代碼行數:31,代碼來源:GuiUtils.java

示例8: 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());  
}
 
開發者ID:hyounesy,項目名稱:ChAsE,代碼行數:34,代碼來源:ControlPanelDetailPlot.java

示例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);
}
 
開發者ID:diwi,項目名稱:PixelFlow,代碼行數:10,代碼來源:DwMagnifier.java

示例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);
  }
}
 
開發者ID:diwi,項目名稱:PixelFlow,代碼行數:15,代碼來源:DwFoldingTile.java

示例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();
  }
}
 
開發者ID:linux-man,項目名稱:ptmx,代碼行數:59,代碼來源:Ptmx.java

示例12: apply

import processing.core.PGraphics; //導入方法依賴的package包/類
@Override
public Object apply(WarpScriptStack stack) throws WarpScriptException {
  
  List<Object> params = ProcessingUtil.parseParams(stack, 1, 2, 3, 4);
      
  PGraphics pg = (PGraphics) params.get(0);
  
  if (2 == params.size()) {
    if (params.get(1) instanceof Long) {
      pg.stroke(
        ((Number) params.get(1)).intValue()
      );                
    } else if (params.get(1) instanceof Double) {
      pg.stroke(
        ((Number) params.get(1)).floatValue()
      );        
    }
  } else if (3 == params.size()) {
    if (params.get(1) instanceof Long) {
      pg.stroke(
        ((Number) params.get(1)).intValue(),
        ((Number) params.get(2)).floatValue()
      );                
    } else if (params.get(1) instanceof Double) {
      pg.stroke(
        ((Number) params.get(1)).floatValue(),
        ((Number) params.get(2)).floatValue()
      );        
    }
  } else if (4 == params.size()) {
    pg.stroke(
      ((Number) params.get(1)).floatValue(),
      ((Number) params.get(2)).floatValue(),
      ((Number) params.get(3)).floatValue()
    );          
  } else if (5 == params.size()) {
    pg.stroke(
      ((Number) params.get(1)).floatValue(),
      ((Number) params.get(2)).floatValue(),
      ((Number) params.get(3)).floatValue(),
      ((Number) params.get(4)).floatValue()
    );
  }
  
  stack.push(pg);
      
  return stack;
}
 
開發者ID:cityzendata,項目名稱:warp10-platform,代碼行數:49,代碼來源:Pstroke.java


注:本文中的processing.core.PGraphics.stroke方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。