SHARE
TWEET

Untitled

a guest Mar 26th, 2019 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public Sprite getSubImage(int sX, int sY, int w, int h)
  2.     {
  3.     try {
  4.         Sprite s = new Sprite(w, h);
  5.         int[] thePixels = new int[w * h];
  6.         for (int i = sX; i < w; i++)
  7.         {
  8.             for (int i1 = sY; i1 < h; i1++)
  9.             {
  10.                 int i2 = i - sX;
  11.                 int i3 = i1 - sY;
  12.                 thePixels[i2 + i3 * w] = this.myPixels[i + i1 * this.myWidth];
  13.             }
  14.         }      
  15.         s.myHeight = h - sY;
  16.         s.myWidth = w - sX;
  17.         s.myPixels = thePixels;
  18.         return s;
  19.     } catch(Exception e) {
  20.         e.printStackTrace();
  21.     }
  22.     return null;
  23.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top