Commit 704a4711 authored by Thomas Krex's avatar Thomas Krex

k

parent 3a6bb33e
package tttclient.utils;
import android.graphics.Bitmap;
public class BitmapContainer {
private final Bitmap image;
private final int width, height;
private final int[] pixels;
public BitmapContainer(Bitmap _source) {
image = _source;
width = image.getWidth();
height = image.getHeight();
pixels = new int[width * height];
image.getPixels(pixels, 0, width, 0, 0, width, height);
}
public int getPixel(int x, int y) {
return pixels[x + y * width];
}
public void setPixel(int x, int y, int color) {
pixels[x + y * width] = color;
}
public Bitmap getBimap() {
image.setPixels(pixels, 0, width, 0, 0, width, height);
return image;
}
public int getWidth() {
return image.getWidth();
}
public int getHeight() {
return image.getHeight();
}
public int[] getPixels() {
return pixels;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment