我有一个动画精灵使用路径修改器移动,我想限制该精灵不要移动特定的像素颜色。所以我试图使用获取像素和颜色,但我无法找到该颜色的颜色代码。任何人都可以帮助我在andengine 2.0中做到这一点吗?
int width = src.getWidth();
int height = src.getHeight();
// create output bitmap
Bitmap bmOut = Bitmap.createBitmap(width, height, src.getConfig());
// color information
int A, R, G, B;
int pixel;
int px;
px = src.getPixel(CAMERA_WIDTH / 2, CAMERA_HEIGHT / 2);
R = Color.red(px);
G = Color.green(px);
B = Color.blue(px);
int colblck = Color.rgb(R, G, B);
Log.e("Tag","Color code for center " + colblck);
// scan through all pixels
for (int x = 0; x < width; ++x) {
for (int y = 0; y < height; ++y) {
// get pixel color
pixel = src.getPixel(x, y);
// get color on each channel
// A = Color.alpha(pixel);
R = Color.red(pixel);
G = Color.green(pixel);
B = Color.blue(pixel);
String cd = "" + 00 + 00 + 00;
bmOut.setPixel(x, y, Color.rgb(255, 0, 0));