本文整理匯總了Java中processing.core.PGraphics.imageMode方法的典型用法代碼示例。如果您正苦於以下問題:Java PGraphics.imageMode方法的具體用法?Java PGraphics.imageMode怎麽用?Java PGraphics.imageMode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類processing.core.PGraphics
的用法示例。
在下文中一共展示了PGraphics.imageMode方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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);
}
}
示例2: 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);
String mode = params.get(1).toString();
if ("CORNER".equals(mode)) {
pg.imageMode(PGraphics.CORNER);
} else if ("CORNERS".equals(mode)) {
pg.imageMode(PGraphics.CORNERS);
} else if ("CENTER".equals(mode)) {
pg.imageMode(PGraphics.CENTER);
} else {
throw new WarpScriptException(getName() + ": invalid mode, should be 'CENTER', 'CORNER' or 'CORNERS'.");
}
stack.push(pg);
return stack;
}
示例3: 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;
}
}
示例4: 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);
}
}