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


Java PGraphics.background方法代碼示例

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


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

示例1: prepareDraw

import processing.core.PGraphics; //導入方法依賴的package包/類
private void prepareDraw(PGraphics pg, float left, float top){
  this.camwidth = pg.width;
  this.camheight = pg.height;
  if(this.positionmode.equals("MAP")){
    PVector p = this.mapToCanvas(left, top);
    left = p.x;
    top = p.y;
  }
  if(this.drawmode == 3){
    this.camleft = parent.floor(left - this.camwidth / 2);
    this.camtop = parent.floor(top - this.camheight / 2);
  }
  else{
    this.camleft = parent.floor(left);
    this.camtop = parent.floor(top);
  }
  if(pg != parent.g) pg.beginDraw();
  pg.pushMatrix();
  pg.resetMatrix();
  pg.pushStyle();
  pg.imageMode(parent.CORNER);
  switch(this.backgroundmode) {
    case "COLOR":
      pg.background(this.backgroundcolor);
      break;
    case "CLEAR":
      if(pg != parent.g) pg.clear();
      else pg.background(this.backgroundcolor);
      break;
  }
}
 
開發者ID:linux-man,項目名稱:ptmx,代碼行數:32,代碼來源:Ptmx.java

示例2: 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.background(
        ((Number) params.get(1)).intValue()
      );                
    } else if (params.get(1) instanceof Double) {
      pg.background(
        ((Number) params.get(1)).floatValue()
      );        
    } else if (params.get(1) instanceof PImage) {
      pg.background((PImage) params.get(1));
    }
  } else if (3 == params.size()) {
    if (params.get(1) instanceof Long) {
      pg.background(
        ((Number) params.get(1)).intValue(),
        ((Number) params.get(2)).floatValue()
      );                
    } else if (params.get(1) instanceof Double) {
      pg.background(
        ((Number) params.get(1)).floatValue(),
        ((Number) params.get(2)).floatValue()
      );        
    }
  } else if (4 == params.size()) {
    pg.background(
      ((Number) params.get(1)).floatValue(),
      ((Number) params.get(2)).floatValue(),
      ((Number) params.get(3)).floatValue()
    );          
  } else if (5 == params.size()) {
    pg.background(
      ((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,代碼行數:51,代碼來源:Pbackground.java

示例3: displayScene

import processing.core.PGraphics; //導入方法依賴的package包/類
public void displayScene(PGraphics canvas){
  if(canvas == skylight.renderer.pg_render){
    canvas.background(32);
  }
  canvas.shape(shape);
}
 
開發者ID:diwi,項目名稱:PixelFlow,代碼行數:7,代碼來源:Skylight_Basic.java


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