Guest

image()

By: a guest on Aug 3rd, 2010  |  syntax: JavaScript  |  size: 0.41 KB  |  hits: 149  |  expires: Never
download  |  raw  |  embed  |  report abuse
This paste has a previous version, view the difference. Copied
  1. p.image = function image(img, x, y, w, h) {
  2.   if (img.width > 0) {
  3.     var wid = w || img.width;
  4.     var hgt = h || img.height;
  5.     if(p.use3DContext){
  6.       p.beginShape(p.QUADS);
  7.       p.textureMode(p.NORMAL)
  8.       p.texture(img);
  9.       p.vertex(x, y, 0, 0, 0);
  10.       p.vertex(x+wid, y, 0, 0, 1);
  11.       p.vertex(x+wid, y+hgt, 0, 1, 1);
  12.       p.vertex(x, y+hgt, 0, 1, 0);
  13.       p.endShape();
  14.     } else ...
  15. }