本文整理匯總了Java中processing.core.PGraphics.image方法的典型用法代碼示例。如果您正苦於以下問題:Java PGraphics.image方法的具體用法?Java PGraphics.image怎麽用?Java PGraphics.image使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類processing.core.PGraphics
的用法示例。
在下文中一共展示了PGraphics.image方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: drawTileLayer
import processing.core.PGraphics; //導入方法依賴的package包/類
public void drawTileLayer(PGraphics pg, int m){
int n;
float x, y;
PVector p;
Tile tileN;
Layer l = Ptmx.this.layer[m];
int xstart = parent.max(0, parent.floor(this.canvasToMap(Ptmx.this.camleft, Ptmx.this.camtop).x - Ptmx.this.drawmargin));
int xstop = parent.min(Ptmx.this.mapwidth, parent.ceil(this.canvasToMap(Ptmx.this.camleft + pg.width, Ptmx.this.camtop + pg.height).x + Ptmx.this.drawmargin));
int ystart = parent.max(0, parent.floor(this.canvasToMap(Ptmx.this.camleft, Ptmx.this.camtop).y - Ptmx.this.drawmargin));
int ystop = parent.min(Ptmx.this.mapheight, parent.ceil(this.canvasToMap(Ptmx.this.camleft + pg.width, Ptmx.this.camtop + pg.height).y + Ptmx.this.drawmargin));
for(int ny = ystart; ny < ystop; ny++) for(int nx = xstart; nx < xstop; nx++){
n = l.data[nx + ny * Ptmx.this.mapwidth] - 1;
if(n >= 0){
tileN = Ptmx.this.tile[n];
p = Ptmx.this.mapToCam(nx, ny);
x = p.x - Ptmx.this.tilewidth / 2 + tileN.offsetx + l.offsetx;
y = p.y - Ptmx.this.tileheight / 2 + tileN.offsety + l.offsety + (Ptmx.this.tileheight - tileN.image.height);;
pg.image(tileN.image, x, y);
}
}
}
示例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);
}
}
示例3: 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);
}
}
示例4: apply
import processing.core.PGraphics; //導入方法依賴的package包/類
@Override
public Object apply(WarpScriptStack stack) throws WarpScriptException {
List<Object> params = ProcessingUtil.parseParams(stack, 3, 5);
PGraphics pg = (PGraphics) params.get(0);
if (!(params.get(1) instanceof PImage)) {
throw new WarpScriptException(getName() + " expects an image as parameter deepest.");
}
PImage img = (PImage) params.get(1);
if (4 == params.size()) {
pg.image(
img,
((Number) params.get(2)).floatValue(),
((Number) params.get(3)).floatValue()
);
} else if (6 == params.size()) {
pg.image(
img,
((Number) params.get(2)).floatValue(),
((Number) params.get(3)).floatValue(),
((Number) params.get(4)).floatValue(),
((Number) params.get(5)).floatValue()
);
}
stack.push(pg);
return stack;
}
示例5: 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);
}
示例6: drawMarker
import processing.core.PGraphics; //導入方法依賴的package包/類
public void drawMarker(PGraphics pg, float x, float y) {
pg.fill(11);
zoomLevel = map.getZoomLevel();
radius = (zoomLevel*2) + 5;
img.resize(radius, radius);
pg.image(img, x - radius/2, y - radius/2);
if (selected) {
showTitle(pg, x, y);
}
}
示例7: 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();
}
}