示例#1
0
 public BitmapFilm(Bitmap bitmap, int width, int height) {
   this.bitmap = bitmap;
   int cols = bitmap.getWidth() / width;
   int rows = bitmap.getHeight() / height;
   for (int i = 0; i < rows; i++) {
     for (int j = 0; j < cols; j++) {
       Rect rect = new Rect(j * width, i * height, (j + 1) * width, (i + 1) * height);
       add(i * cols + j, rect);
     }
   }
 }
示例#2
0
  public static int pick(int index, int x, int y) {
    Bitmap bmp = TextureCache.get(Assets.ITEMS).bitmap;
    int rows = bmp.getWidth() / SIZE;
    int row = index / rows;
    int col = index % rows;

    // FIXME: I'm assuming this is super slow?
    final TextureData td = bmp.getTextureData();
    if (!td.isPrepared()) {
      td.prepare();
    }
    final Pixmap pixmap = td.consumePixmap();
    int pixel = pixmap.getPixel(col * SIZE + x, row * SIZE + y);
    pixmap.dispose();
    return pixel;
  }
示例#3
0
 public BitmapFilm(Bitmap bitmap, int width) {
   this(bitmap, width, bitmap.getHeight());
 }
示例#4
0
 public BitmapFilm(Bitmap bitmap) {
   this.bitmap = bitmap;
   add(null, new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight()));
 }